Facebook Badge

Tuesday, February 10, 2009

VLAN

I’m going to show how to segment logical network using VLAN.

Say, there are two department in the office.

VLAN 2 is for IT department and VLAN 3 is for sales department.

There are 2 switches, and placed at two places, switch 1 and 2 connected on fast ethernet port 0/24 which configured for trunk port. So here is the switch configuration:

switch1>enable
switch1#configure terminal
switch1(config)#int fa0/24
switch1(config-if)#switchport mode trunk
switch1(config-if)#switchport trunk allowed vlan 2-3
switch(config-if)#switchport native vlan 40
switch1(config-if)#exit
switch1(config)#vlan 2
switch1(config)#name IT-department
switch1(config)#vlan 3
switch1(config)#name Sales-department
switch1(config)#int fa0/1
switch1(config-if)#switchport mode access
switch1(config-if)#switchport access vlan 2
switch1(config-if)#int fa0/2
switch1(config-if)#switchport mode access
switch1(config-if)#switchport access vlan 3
switch1(config-if)#^Z
switch1(config)#copy running-config startup-config

if you want to access the switch using telnet you have to configure it like this:

switch1#configure terminal
switch1(config)#int vlan1
switch1(config-if)#ip address 192.168.100.253 255.255.255.0
switch1(config-if)#no shut
switch1(config-if)#line vty 0 4
switch1(config-line)#password yourpassword
switch1(config-line)#login
switch1(config-line)#exit
switch1(config)#service password-encryption
switch1(config)#enable secret yourpassword
switch1(config)#exit
switch1#copy running-config startup-config

for switch 2, follow the configuration above. Both switches, trunk port must use vlan 40 in order to communicate.