Routing between vlans – Router on a Stick and Switching L3 routing

 

S1#conf t
S1(config)#vlan 51
S1(config-vlan)#name ENG

S1(config-vlan)#vlan 52
S1(config-vlan)#name MGMT

S1(config)#int gi0/0
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 51
S1(config-if)#spanning-tree portfast

S1(config)#int gi0/1
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 52
S1(config-if)#spanning-tree portfast

 

S1#show vlan

VLAN Name                             Status    Ports
 ---- -------------------------------- --------- -------------------------------
 1    default                          active    Gi0/2, Gi0/3, Gi1/0, Gi1/1
 Gi1/2, Gi1/3
 51   ENG                              active    Gi0/0
 52   MGMT                             active    Gi0/1

R1

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

R1(config)#interface fastEthernet 0/0.51
R1(config-subif)#encapsulation dot1Q 51
R1(config-subif)#ip address 10.1.51.1 255.255.255.0

R1(config)#interface fastEthernet 0/0.52
R1(config-subif)#encapsulation dot1Q 52
R1(config-subif)#ip address 10.1.52.1 255.255.255.0

R1(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset up up
FastEthernet0/0.51 10.1.51.1 YES manual up up
FastEthernet0/0.52 10.1.52.1 YES manual up up
Serial0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down

 

S1(config)#interface gigabitEthernet 1/3
S1(config-if)#switchport trunk encapsulation dot1q
S1(config-if)#switchport mode trunk
S1(config-if)#switchport nonegotiate

gns3@PC1:~$ sudo ifconfig eth0 10.1.51.50 netmask 255.255.255.0
gns3@PC1:~$ sudo route add default gw 10.1.51.1

gns3@PC2:~$ sudo ifconfig eth0 10.1.52.50 netmask 255.255.255.0
gns3@PC2:~$ sudo route add default gw 10.1.52.1

 

 

Layer 3 switching

S1# show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi0/2, Gi0/3, Gi1/0, Gi1/1
                                                Gi1/2, Gi1/3
51   ENG                              active    Gi0/0
52   MGMT                             active    Gi0/1

 

 

 

R1#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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

10.0.0.0/24 is subnetted, 2 subnets
C 10.1.51.0 is directly connected, FastEthernet0/0.51
C 10.1.52.0 is directly connected, FastEthernet0/0.52

 

gns3@PC2:~$ ping 10.1.51.50
PING 10.1.51.50 (10.1.51.50): 56 data bytes
64 bytes from 10.1.51.50: seq=0 ttl=63 time=46.518 ms
64 bytes from 10.1.51.50: seq=1 ttl=63 time=41.367 ms

 

R1#show arp         
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  10.1.51.50              1   00cf.7122.8900  ARPA   FastEthernet0/0.51
Internet  10.1.52.50              1   00cf.7112.fd00  ARPA   FastEthernet0/0.52
Internet  10.1.51.1               -   c201.09ba.0000  ARPA   FastEthernet0/0.51
Internet  10.1.52.1               -   c201.09ba.0000  ARPA   FastEthernet0/0.52
gns3@PC2:~$ traceroute -d 10.1.51.50
traceroute to 10.1.51.50 (10.1.51.50), 30 hops max, 38 byte packets
 1  10.1.52.1 (10.1.52.1)  21.114 ms  18.455 ms  15.752 ms
 2  10.1.51.50 (10.1.51.50)  30.915 ms  17.952 ms  26.543 ms

1) Turn on routing to convert to L3 SW -- ip routing -- (IMPORTANT!!!!) 

S1(config)#ip routing

S1(config)#interface vlan 51
S1(config-if)#ip address 10.1.51.1 255.255.255.0
S1(config-if)#description ENG ROUTED INTERFACE

S1(config-if)#int vlan 52
S1(config-if)#ip address 10.1.52.1 255.255.255.0
S1(config-if)#description MGMT VLAN

S1#show ip int brief
Interface              IP-Address      OK? Method Status                Protocol
Vlan51                 10.1.51.1       YES manual up                    up      
Vlan52                 10.1.52.1       YES manual up                    up 

S1#show ip route
Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.1.51.0/24 is directly connected, Vlan51
L        10.1.51.1/32 is directly connected, Vlan51
C        10.1.52.0/24 is directly connected, Vlan52
L        10.1.52.1/32 is directly connected, Vlan52

gns3@PC1:~$ ping 10.1.52.50
PING 10.1.52.50 (10.1.52.50): 56 data bytes
64 bytes from 10.1.52.50: seq=0 ttl=63 time=34.760 ms
64 bytes from 10.1.52.50: seq=1 ttl=63 time=17.715 ms


54