Sunday, November 25, 2012

How to setup VLAN on CISCO routers

It is assumed that:
- you are into router as user with full rights – level 15 – ssh, telnet or console
- You just want to route a specific range of IPs through one interface
- You will not use STP / Trunks on that VLAN
- Physical interface is FastEthernet 4
a1) Setup VLAN
cisco1#configure terminal
cisco1(config)#interface vlan4
cisco1(config-if)# ip address 192.168.1.1 255.255.255.0
cisco1(config-if)#exit
cisco1(config)#exit
cisco1#write
a2) Link VLAN and physical interface
cisco1#configure terminal
cisco1(config)#interface FastEthernet4
cisco1(config-if)#speed 100
cisco1(config-if)#no cdp enable
cisco1(config-if)#spanning-tree portfast
cisco1(config-if)#switchport access vlan 4
(Will you receive error the see b), solve the issue and come back )
cisco1(config-if)#exit
cisco1(config)#exit
cisco1#write
a3) Create route
cisco1#configure terminal
cisco1(config)ip route 192.168.1.0 255.255.255.0 vlan4
cisco1(config)#exit
cisco1#write
a4) Create access list
Use by your own access-list command
b) Error when try to add vlan4
It is possible to get this error :
“..Access VLAN 4 does not exist. Please add it to vlan database”
It may help to fix this problem:
It is assumed that:
-you are into router as user with full rights – level 15 – ssh, telnet or console
-do not go to configure menu
cisco1#vlan database
cisco1(vlan)#vlan 4
VLAN 4 added
….
….
cisco1(vlan)#write