Our objective here is to route from PC-1 on vlan 10 to PC-2 on vlan 20 trough Router 1.
Our objectives:
1. Configure R1 with two sub-interfaces
Gi0/0.10 – 10.10.10.1/24
Gi0/0.20 – 20.20.20.1/24
2. Configure SW1 with VLAN 10 and VLAN 20
3. Configure SW1 port Gi0/0 with trunking
4. Configure PC-1 with IP address 10.10.10.10/24
5. Configure PC-2 with IP address 20.20.20.20/24
R1 – Sub-interfaces
!
Router(config)#int gi0/0
Router(config-if)#no shutdown
!
Router(config)#int gi0/0.10
Router(config-subif)#encapsulation dot1Q ?
<1-4094> IEEE 802.1Q VLAN ID
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 10.10.10.1 255.255.255.0
Router(config-subif)#no shutdown
!
!
Router(config)#interface gigabitEthernet 0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 20.20.20.1 255.255.255.0
Router(config-subif)#no shutdown
!
SW1 Configuration
!
Switch(config)#interface gi0/0
Switch(config-if)#switchport trunk encapsulation dot1q
!
!
Switch(config)#vlan 10
Switch(config-vlan)#name Blue
!
Switch(config)#vlan 20
Switch(config-vlan)#name Red
!
!
Switch(config)#int gi1/0
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
!
Switch(config)#int gi2/0
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
!
Configure virtual PC-1 and PC-2
!
PC-1> ip 10.10.10.10/24 10.10.10.1
Checking for duplicate address...
PC1 : 10.10.10.10 255.255.255.0 gateway 10.10.10.1
!
!
PC-2> ip 20.20.20.20/24 20.20.20.1
Checking for duplicate address...
PC1 : 20.20.20.20 255.255.255.0 gateway 20.20.20.1
!
Verification R1
!
Router#show ip int brief
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 unassigned YES unset up up
GigabitEthernet0/0.10 10.10.10.1 YES manual up up
GigabitEthernet0/0.20 20.20.20.1 YES manual up up
GigabitEthernet0/1 unassigned YES unset administratively down down
GigabitEthernet0/2 unassigned YES unset administratively down down
GigabitEthernet0/3 unassigned YES unset administratively down down
!
!
Router#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, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/24 is directly connected, GigabitEthernet0/0.10
L 10.10.10.1/32 is directly connected, GigabitEthernet0/0.10
20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 20.20.20.0/24 is directly connected, GigabitEthernet0/0.20
L 20.20.20.1/32 is directly connected, GigabitEthernet0/0.20
Verification SW1
!
Switch#show interfaces trunk
Port Mode Encapsulation Status Native vlan
Gi0/0 on 802.1q trunking 1
Port Vlans allowed on trunk
Gi0/0 1-4094
Port Vlans allowed and active in management domain
Gi0/0 1,10,20
Port Vlans in spanning tree forwarding state and not pruned
Gi0/0 1,10,20
!
!
Switch#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Gi0/1, Gi0/2, Gi0/3, Gi1/1
Gi1/2, Gi1/3, Gi2/1, Gi2/2
Gi2/3, Gi3/0, Gi3/1, Gi3/2
Gi3/3
10 Blue active Gi1/0
20 Red active Gi2/0
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
!
Ping from PC to PC
!
PC-1> ping 20.20.20.20
84 bytes from 20.20.20.20 icmp_seq=1 ttl=63 time=25.052 ms
84 bytes from 20.20.20.20 icmp_seq=2 ttl=63 time=13.984 ms
84 bytes from 20.20.20.20 icmp_seq=3 ttl=63 time=11.581 ms
84 bytes from 20.20.20.20 icmp_seq=4 ttl=63 time=14.161 ms
84 bytes from 20.20.20.20 icmp_seq=5 ttl=63 time=14.908 ms
!
!
PC-2> ping 10.10.10.10
84 bytes from 10.10.10.10 icmp_seq=1 ttl=63 time=6.084 ms
84 bytes from 10.10.10.10 icmp_seq=2 ttl=63 time=27.189 ms
84 bytes from 10.10.10.10 icmp_seq=3 ttl=63 time=15.047 ms
84 bytes from 10.10.10.10 icmp_seq=4 ttl=63 time=10.452 ms
84 bytes from 10.10.10.10 icmp_seq=5 ttl=63 time=17.651 ms
!
[…] Topology used: Router-on-a-stick […]