Sunday, May 13, 2012

Inter-VLAN Routing

VLANs can not communicate outside their subnet without the help of a router or layer 3 switch.  A router's interface can be sub-interfaced to allow multiple VLANs layer three access without using an interface for each VLAN. Each sub-interface on a router will be the default gateway for that subnet. Encapsulation must match on both trunk ports (router/switch) and must be define before IP address can be assigned to sub-interface.



R1(config)#interface fastEthernet 0/0
R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R1(config)#interface fastEthernet 0/0.10

%LINK-5-CHANGED: Interface FastEthernet0/0.10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.10, changed state to up

R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#ip address 192.168.10.1 255.255.255.0

R1(config-subif)#interface fastEthernet 0/0.20

%LINK-5-CHANGED: Interface FastEthernet0/0.20, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.20, changed state to up

R1(config-subif)#encapsulation dot1q 20
R1(config-subif)#ip address 192.168.20.1 255.255.255.0


R1(config)#interface fastEthernet 0/1
R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

R1(config-if)#interface fastethernet 0/1.100

%LINK-5-CHANGED: Interface FastEthernet0/1.100, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.100, changed state to up

R1(config-subif)#encapsulation dot1q 100
R1(config-subif)#ip address 10.1.1.1 255.255.255.0
R1(config-subif)#interface fastethernet 0/1.120

%LINK-5-CHANGED: Interface FastEthernet0/1.120, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.120, changed state to up
R1(config-subif)#encapsulation dot1q 120
R1(config-subif)#ip address 10.1.2.1 255.255.255.0





No comments:

Post a Comment