Monday 20 March 2017

Inter Vlan Routing - Switch Virtual Interface (SVI) in Packet Tracer


This lab is performed in Packet Tracer Version 6.2.0.0052



We basically know that to perform routing between Vlans we would require routing device such as external router. It is known as Router On a Stick in CCNA Syllabus. We could also use Multi-Layer Switch (Layer 3 Switch)and it would do routing. Switch Virtual Interface is the key to do it.



Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#Vlan 10
Switch(config-vlan)#name PC1
Switch(config-vlan)#vlan 20
Switch(config-vlan)#name PC0
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#name SERVER
Switch(config-vlan)#exit

First Create 3 Different Vlans

Switch(config)#int fa0/1
Switch(config-if)#sw mo acc
Switch(config-if)#sw acc vlan 10
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

Switch(config-if)#
Switch(config-if)#int fa0/2
Switch(config-if)#sw mo acc
Switch(config-if)#sw acc vlan 20
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

Switch(config-if)#
Switch(config-if)#int fa0/3
Switch(config-if)#sw mo acc
Switch(config-if)#sw acc vlan 30
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up

Assign interfaces to the relative Vlans

Switch(config-if)#
Switch(config-if)#exit
Switch(config)#ip routing

The Important command which will perform routing. Run show ip route command to check if it has learnt any route so far.

Switch(config)#do show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

As you see, there is no route in the routing table. This is because we have not given ip address to any interface. Create Switch Virtual Interface and assign them Ip addresses as below

Switch(config)#int vlan 10
Switch(config-if)#ip add 192.168.10.254 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#int vlan 20
Switch(config-if)#ip add 192.168.20.254 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#int vlan 30
Switch(config-if)#ip add 192.168.30.254 255.255.255.0
Switch(config-if)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console

show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.10.0/24 is directly connected, Vlan10
C    192.168.20.0/24 is directly connected, Vlan20
C    192.168.30.0/24 is directly connected, Vlan30

Here they are up in routing table, which mean the routing is done. Lets ping from PC1 to PC2 and SERVER.

PC>ping 192.168.20.1

Pinging 192.168.20.1 with 32 bytes of data:

Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=11ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127

Ping statistics for 192.168.20.1:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 11ms, Average = 3ms

Control-C
^C

PC>ping 192.168.30.1

Pinging 192.168.30.1 with 32 bytes of data:

Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=1ms TTL=127

Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127

Ping statistics for 192.168.30.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms

Try to ping from PC2 to Server and PC1 and it will give the reply. Congrats! We have established routing between different Vlans.

No comments:

Post a Comment