.
.

Configuration Static VLAN on Switch

In this example tutorial I want to show you, how you can configure a static VLAN on the Switch,

Configuring a static VLAN on a Cisco Switch


Host_A C:\> ping 192.168.1.2 (ping IP address of Switch)
Host_A C:\>ipconfig (IP address Host_A)

Host_B C:\> ping 192.168.1.3 (ping IP address of Switch)
Host_B C:\>ipconfig (IP address Host_B)

Switch#enable
Switch#class (password)

Switch#show version (display IOS version)
Switch#show interface vlan (view table of all VLANs on the switch)

Switch#vlan database (enter the configuration mode for the VLAN on the switch, if we set a new VLAN)
Switch(vlan)#vlan 2 name VLAN2 (setting a new moist named VLAN2, be sure to put a number 2 next to the name of the VLAN.)
Switch(vlan)#vlan 3 name VLAN3 (setting a new moist named VLAN3, be sure to put a number 3 next to the name of the VLAN.)
Switch(vlan)#exit

Switch#show vlan (displays all VLANs on the Switch. Here we can see that we have added two new VLAN, 2 and 3 but im not a single port/interface assigned.)

Switch#configure terminal (entry in global config mode)
Switch(config)#interface fastethernet 0/2 (entry in config mode fastethetnet interfaces 0/2)
Switch(config-if)#switchport mode access (change a switchport to a non-default VLAN, entry in config mode where we move the interface/port from the default VLAN1 in the non-default VLAN, in this case it is VLAN 2)
Switch(config-if)#switchport access vlan 2 (moving interfaces FA0/2 in VLAN 2)
Switch(config-if)#end (prelazak u EXEC mode)
Switch#show vlan (view table VLAN where we can see now that port FA0/2 belongs to VLAN 2)

Switch#configure terminal (entry in global config mode)
Switch(config)#interface fastethernet 0/3 (entry in config mode fastethetnet interfaces 0/3)
Switch(config-if)#switchport mode access (change a switchport to a non-default VLAN, entry in config mode where we move the interface/port from the default VLAN1 in the non-default VLAN, in this case it is VLAN 3)
Switch(config-if)#switchport access vlan 3 (moving interfaces FA0/3 in VLAN 3)
Switch(config-if)#end (go to User Exec mode)

How to see, which interfaces belong to a particular VLAN


Switch#show vlan id 2 (view table VLAN 2 where we can see that the interfaces/ports belong to VLAN 2 with further information)
or
Switch#show vlan name vlan2 (this command is the same as above above, ie. displays the same information, the table view to VLAN 2, where we can see which ports belong to VLAN 2 with further information)