VLAN Config
VLAN Config
Overview of VLANs
A VLAN is a group of devices on one or more LANs that are configured to communicate as if they were attached
to the same wire, when in fact they are located on a number of different LAN segments. Because VLANs are
based on logical instead of physical connections, they are extremely flexible.
VLANs define broadcast domains in a Layer 2 network. A broadcast domain is the set of all devices that will
receive broadcast frames originating from any device within the set. Broadcast domains are typically bounded by
routers because routers do not forward broadcast frames. Layer 2 switches create broadcast domains based on
the configuration of the switch. Switches are multiport bridges that allow you to create multiple broadcast
domains. Each broadcast domain is like a distinct virtual bridge within a switch.
You can define one or many virtual bridges within a switch. Each virtual bridge you create in the switch defines a
new broadcast domain (VLAN). Traffic cannot pass directly to another VLAN (between broadcast domains) within
the switch or between two switches. To interconnect two different VLANs, you must use routers or Layer 3
switches.
Figure 10-1 Sample VLANs
VLANs are often associated with IP subnetworks. For example, all of the end stations in a particular IP subnet
belong to the same VLAN. Traffic between VLANs must be routed. You must assign LAN interface VLAN
membership on an interface-by-interface basis (this is known as interface-based or static VLAN membership).
You can set the following parameters when you create a VLAN in the management domain:
• VLAN number
• VLAN name
• VLAN type
• VLAN state (active or suspended)
• Maximum transmission unit (MTU) for the VLAN
• Security Association Identifier (SAID)
• VLAN number to use when translating from one VLAN type to another
PC Configurations
For our VLAN Configuration example, we will set our PC IP addresses as below. These ip addresses will be
required at the end of this configuration example to test our configuration.
PC 1 –> 192.168.1.2 VLAN 2
PC 2 –> 192.168.1.3 VLAN 2
PC 3 –> 192.168.1.4 VLAN 3
PC 4 –> 192.168.1.6 VLAN 3
PC 5 –> 192.168.1.7 VLAN 3
PC 6 –> 192.168.1.8 VLAN 2
1. We will set access ports that will access specific VLANs. We will do this with “switchport mode access”
command under these interfaces.
2. We will also set the VLAN, that this port will access.
3. After that, we will set the trunk port that will carry multiple VLANs with “swithcport mode trunk”
command.
4. Then we will also set this port with “no negotiate” command to prevent negotiation about the port role.
5. Laslty, we will set the allowed VLANs with “switchport trunk allowed vlan” command on this trunk and
save our configuration.
You can check the same outputs for switch 2. The outputs for both switch 1 and swicth too are also in the below
configuration documents.
Switch 2# show vlan brief
Switch 2#show interfaces fastEthernet 0/1 switchport
Switch 2#show interfaces fastEthernet 0/2 switchport
Switch 2#show interfaces fastEthernet 0/3 switchport
Switch 2#show interfaces fastEthernet 0/4 switchport
Switch 2#show interfaces trunk
To verify the communication between same VLANs now we will use ping command to check the communication
between two PCs in the same VLAN. Here, if the PCs are in the same VLAN, the ping will successfull. If they are
in different VLANs, ping will not be successful.
PC 1>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address………: FE80::2D0:BCFF:FED8:3229
IP Address………………….: 192.168.1.2
Subnet Mask…………………: 255.255.255.0
Default Gateway……………..: 0.0.0.0
PC>ping 192.168.1.3
Pinging 192.168.1.3 with 32 bytes of data:
Reply from 192.168.1.3: bytes=32 time=0ms TTL=128
Reply from 192.168.1.3: bytes=32 time=0ms TTL=128
Reply from 192.168.1.3: bytes=32 time=0ms TTL=128
Reply from 192.168.1.3: bytes=32 time=0ms TTL=128
Ping statistics for 192.168.1.3: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
PC>ping 192.168.1.4
Pinging 192.168.1.4 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.1.4: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)
PC>ping 192.168.1.6
Pinging 192.168.1.6 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.1.6: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)
PC>ping 192.168.1.7
Pinging 192.168.1.7 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.1.7: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)
PC>ping 192.168.1.8
Pinging 192.168.1.8 with 32 bytes of data:
Reply from 192.168.1.8: bytes=32 time=0ms TTL=128
Reply from 192.168.1.8: bytes=32 time=0ms TTL=128
Reply from 192.168.1.8: bytes=32 time=0ms TTL=128
Reply from 192.168.1.8: bytes=32 time=0ms TTL=128
Ping statistics for 192.168.1.8: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
As you can see above, the PC 1 can ping the PCs in the same VLAN, even if it is connected to a different
switch. You can find the packet tracer example (.pkt), switches’ and PCs’ configurations below.