Tuesday, February 24, 2009

Routing Between VLANs on Cisco IOS





SWITCH # conf t

(config)# vlan database

(config-vlan)# vlan 10 name RED

(config-vlan)# vlan 30 name GREEN

(config-vlan)# exit(config)# interface FastEthernet1/0/1

(config-if)# description trunk-to-router

(config-if)# switchport trunk encapsulation dot1q

(config-if)# switchport mode trunk

(config-if)# exit

(config)# interface FastEthernet1/0/2

(config-if)# description connection-to-VLAN-10

(config-if)# switchport mode access

(config-if)# switchport access vlan 10

(config-if)# exit(config)# interface FastEthernet1/0/3

(config-if)# description connection-to-VLAN-30

(config-if)# switchport mode access

(config-if)# switchport access vlan 30

(config-if)# exit(config)# exit# copy run start



ROUTER# conf t

(config)# interface fastethernet 0/0.10

(config-if)# encapsulation dot1q 10

(config-if)# ip address 10.10.10.2 255.255.255.0

(config-if)# exit(config)# interface fastethernet 0/0.20

(config-if)# encapsulation dot1q 30

(config-if)# ip address 20.20.20.2 255.255.255.0
(config-if)# exit
In order for the two hosts that are in different VLANs can communicate between them, they must set as default gateway the IP address of the corresponding router subinterface address.

No comments:

Post a Comment

 
span.fullpost {display:inline;}