16

A dumb question for the majority, but I am interested to know "why does a VLAN have an IP address?"

Is this address different from the default gateway? Or is this address, same as broadcast address for this VLAN?

IP address 192.168.4.100 255.255.255.0

splattne
  • 28,348
  • 19
  • 97
  • 147
RainDoctor
  • 4,162
  • 3
  • 22
  • 25

7 Answers7

17

A VLAN doesn't have an IP address. It's the devices communicating on the VLAN which have IP addresses

Dominik
  • 2,198
  • 13
  • 9
  • 6
    +1 - A vlan (an 802.1q vlan anyway) in and of itself doesn't have any IP addresses: It's an ethernet-header-level thing and doesn't much care what you're running on top of it (IP, IPX/SPX, whatever). VLAN-aware devices tend to be managed devices though, and they usually have IP addresses like David said in the other answer. – voretaq7 Mar 02 '10 at 20:30
7

I believe this is merely an IP address for the VLAN-aware device that happens to be on that VLAN. You need it if the device in question is going to be doing routing involving that VLAN, or if you expect to manage the device (ie through SNMP) on that VLAN.

(after your update) I see you are enabling routing through the Netgear switch this VLAN is defined on. This IP is the address that local systems will use as the router.

David Mackintosh
  • 14,223
  • 6
  • 46
  • 77
5

You can think of a VLAN as a network if that helps. So where I work we have all kinds of networks, ones for PLCs, Servers, Networking Devices, Wireless, etc. To make things easy with our networking environment we created VLANs for each one of these. This way we can have multiple devices from each main category connected to any switch we want but we can have that device in it's own VLAN.

In other words, without VLANs you would need a lot more networking devices because each access layer switch would have to be on it's own network, just like your home network. Any switch(es) you plug into your router or modem at home is going to be on the same network. With VLANs we can plug a server, PLC, regular user, and wireless AP into the same switch if needed and still have them all be in their respective VLANs.

VLANs themselves do not have IPs assigned to them like computers and servers do. Instead they are assigned networks. Which is why many people exchange the word VLAN for network and vice versa. So at home your probably have a 192.168.0.0 255.255.255.0 network or something similar. Well for VLANs we do the same thing...

We might assign 192.168.1.0 255.255.255.0 to servers, 192.168.2.0 255.255.255.0 to PLCs, 192.168.3.0 255.255.255.0 to regular users, and 192.168.4.0 255.255.255.0 to wireless. This means a server will get a different IP than a PLC, etc. Thus our segregation with VLANs. And if you understand how IPs and Subnet masks work, you will know that each VLAN above will have its own network and communication and be separate from each other.

Your IP you mentioned above, 192.168.4.100 255.255.255.0, is likely an IP within a VLAN and not a gateway for that VLAN or anything like that. Typically the gateway is the first or last usable IP in the network range but it doesn't have to be. The broadcast address is always the last IP in the range and can never be assigned to anything, in your case the broadcast IP would be 192.168.4.255.

I hope this ramble helps...

chicks
  • 3,639
  • 10
  • 26
  • 36
Webs
  • 376
  • 1
  • 9
2

From the wikipedia (since it says it well):

Virtual LANs are essentially Layer 2 constructs, compared with IP subnets which are Layer 3 constructs. In an environment employing VLANs, a one-to-one relationship often exists between VLANs and IP subnets, although it is possible to have multiple subnets on one VLAN or have one subnet spread across multiple VLANs. Virtual LANs and IP subnets provide independent Layer 2 and Layer 3 constructs that map to one another and this correspondence is useful during the network design process.

The IP address the OP listed as:

ip address 192.168.4.100 255.255.255.0

This would indeed be the IP addressed assigned to the VLAN itself. Specifically, it is the IP address of the "switch" the VLAN is on. It doesn't necessarily have to be the gateway IP for the VLAN but typically is since you typically setup IP addresses on the VLAN at the Layer 3 "router" for the VLAN and thus use this IP address for the gateway for clients on that VLAN. The Layer3 switch will have IP routing/forwarding enabled if necessary.

The mask basically says that the VLAN is the 192.168.4.0/24 network. It's up to you to decide if you want to actually use the 192.168.4.100 as the actual client gateway IP or if this is simply a management IP for the switch/vlan.

TheCleaner
  • 32,352
  • 26
  • 126
  • 188
2

For most Level 3 switches out there, the line you specified represents the gateway address of the VLAN.

Don't confuse it with default gateway, which only applies when routing is turned OFF.

jackbean
  • 53
  • 1
  • 5
2

Informally, yes, a VLAN can have an IP address. Technically this is called a VLAN interface, as you configure it from interface configuration mode and it will be listed in the config as interface VLAN 100 (example). These are virtual interfaces (not physical ports) and are named "VLAN #"

On a layer two switch you are generally limited to only having one active VLAN interface. On a multilayer switch there can be multiple. These VLAN interfaces are virtual interfaces and can be pinged as well as provide the connection point for remote management. This IP address can only be used as the default gateway on a multilayer switch.

A VLAN (Virtual Local Area Network) is its own logically segregated broadcast domain. You assign networks, or subnets, just as you would with a physically separated broadcast domain.

David
  • 21
  • 1
1

@TheCleaner:

This would indeed be the IP addressed assigned to the VLAN itself

VLANs do not really have IP addresses assigned to them. They have a network assigned to them, or a subnet, or a network range, however you want to refer to it. The address the OP supplied us is an assignable address within the range of 192.168.4.1-255. So lets say the range is applied to a group of servers so on a Cisco switch and we give the VLAN a description of "Server VLAN", 4.100 would be an address that can be given to an individual server. When referring to the Server VLAN, generally one may use the VLAN number or the network address, but typically not a specific address and the whole mask. At least the network admins I work with do not.

As I mentioned above, the OPs address can be a gateway address, but typically would not be because when you think of an environment like a large corporation, if you do not have a system of how gateway addresses are assigned, keeping track of them can be rather difficult. Thus most network admins use the first or last assignable address of a given range for the gateway. In the case of the OP, that would be 192.168.4.1 or 192.168.4.254. I'm not saying this is always the case, rather best practice and generally makes the most sense.

Specifically, it is the IP address of the "switch" the VLAN is on. It doesn't necessarily have to be the gateway IP for the VLAN but typically is since you typically setup IP addresses on the VLAN at the Layer 3 "router" for the VLAN and thus use this IP address for the gateway for clients on that VLAN.

This statement is confusing to me. We don't know anything about the address the OP gave us except the range it exists in, because the OP never said on what device it was found. We do not know if it is the address of a switch, a server, an AP, a computer, a printer, etc. So how you would know that from the small post from the OP wrote is beyond me.

I agree it doesn't have to be the gateway and I have already mentioned this. As I already explained, when you look at most large companies (but this is Cisco's best practice and is usually applied to most businesses) you actually find that gateway addresses will be the last or first assignable address in a range. 4.100 would be in the middle and would make no sense to be a gateway address. While some network admins might assign it that way, keeping track of this would be cumbersome, especially in increasing network sizes. This becomes even more true when HSRP and such technologies are used which take up two address on each layer 3 interface and give out a third address for the gateway. Keeping track of hundreds of such gateways when HSRP is being used becomes very difficult if there isn't a system for assigning addresses. Think of a company that might have 100 different VLANs...

Webs
  • 376
  • 1
  • 9
  • 1
    @"this statement is confusing to me"...the OP clarified in his comments that it was an IP on the netgear switch...that's how I knew. – TheCleaner Mar 07 '10 at 02:49
  • Yes he did, I just saw that. With a /24 I have to say that is an odd IP to use as a mask. I know some home routers can configure themselves that way, but in a business environment it seems to make more sense to stick to the last or first usable IP of a range. – Webs Mar 09 '10 at 16:24