Configuring a VLAN
Configuring a VLAN is easy, within privileged mode # enter the following commands to create a VLAN, assign individual ports to a VLAN or even a range of ports:
Create a VLAN:
configure terminal VLAN 10 Name Marketing
Assign a FastEthernet port to vlan 10:
configure terminal interface fa0/1 switchport access vlan 10
Assign a range of ports to vlan 10:
configure terminal interface range fa0/2-fa0/5 switchport access vlan 10
Verify a VLAN
There are a couple of ways to verify the above commands have actually worked.
The following command will show all the VLANs currently on the switch and what ports are associated with that vlan.
As you can see, we created VLAN 10 earlier with the name Marketing and we have Fa0/1 through to Fa0/5 in this vlan.
The next way is to check the running config, if the commands have been entered successfully we should see Fa0/1 through to Fa0/5 in VLAN 10.
As you can see from the above, the command we entered switchport access vlan 10 has been successfully assigned to ports Fa0/1 through to Fa0/5.
Another option is to run the show switchport command against the interface:
show interface fa0/1 switchport
Troubleshooting a VLAN
- Ensure physical connections are connected and are configured with correct IP information – Can check LEDs on switch for connectivity
- Check whether the hosts are in the same VLAN – Remember hosts in different VLANs will not communicate without a Layer 3 device