В крупных сетях для InterVlan Routing лучше использовать L3 коммутаторы вместо Router-on-a-stick

S1
vlan 10
name LAN10
vlan 20
name LAN20
exit
interface vlan 10
description SVI GW to 192.168.10.0/24
ip address 192.168.10.1 255.255.255.0
no shutdown
exit
interface vlan 20
description SVI GW to 192.168.20.0/24
ip address 192.168.20.1 255.255.255.0
no shutdown
exit
interface e1/0
description Access port PC1
switchport mode access
switchport access vlan 10
exit
interface e1/1
description Access port PC2
switchport mode access
switchport access vlan 20
exit
interface e0/0
description Link to R1
no switchport
ip address 10.10.10.2 255.255.255.0
no shutdown
exit
ip routing
router ospf 10
network 192.168.10.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0
network 10.10.10.0 0.0.0.3 area 0
end
wr mem
Проверим
show ip route | begin Gateway
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, Ethernet0/0
L 10.10.10.2/32 is directly connected, Ethernet0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.10.0/24 is directly connected, Vlan10
L 192.168.10.1/32 is directly connected, Vlan10
192.168.20.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.20.0/24 is directly connected, Vlan20
L 192.168.20.1/32 is directly connected, Vlan20
R1
interface e0/0
description Link to S1
ip address 10.10.10.1 255.255.255.0
no shutdown
exit
interface e1/0
description GW to 10.10.20.0/24
ip address 10.10.20.1 255.255.255.0
no shutdown
router ospf 10
network 10.10.10.0 0.0.0.3 area 0
network 10.10.20.0 0.0.0.255 area 0
end
wr mem
Проверим
show ip route | begin Gateway
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.10.10.0/24 is directly connected, Ethernet0/0
L 10.10.10.1/32 is directly connected, Ethernet0/0
C 10.10.20.0/24 is directly connected, Ethernet1/0
L 10.10.20.1/32 is directly connected, Ethernet1/0
O 192.168.10.0/24 [110/11] via 10.10.10.2, 00:00:11, Ethernet0/0
O 192.168.20.0/24 [110/11] via 10.10.10.2, 00:00:11, Ethernet0/0
Проверим связность между сетями
Ping PC1 to PC2
PC1> ping 192.168.20.10
192.168.20.10 icmp_seq=1 timeout
84 bytes from 192.168.20.10 icmp_seq=2 ttl=63 time=0.788 ms
84 bytes from 192.168.20.10 icmp_seq=3 ttl=63 time=0.830 ms
84 bytes from 192.168.20.10 icmp_seq=4 ttl=63 time=0.749 ms
84 bytes from 192.168.20.10 icmp_seq=5 ttl=63 time=0.775 ms
Ping PC1 to PC3
PC1> ping 10.10.20.254
84 bytes from 10.10.20.254 icmp_seq=1 ttl=62 time=1.515 ms
84 bytes from 10.10.20.254 icmp_seq=2 ttl=62 time=1.558 ms
84 bytes from 10.10.20.254 icmp_seq=3 ttl=62 time=1.517 ms
84 bytes from 10.10.20.254 icmp_seq=4 ttl=62 time=1.378 ms
84 bytes from 10.10.20.254 icmp_seq=5 ttl=62 time=1.571 ms
Ping PC2 to PC3
PC2> ping 10.10.20.254
84 bytes from 10.10.20.254 icmp_seq=1 ttl=62 time=1.313 ms
84 bytes from 10.10.20.254 icmp_seq=2 ttl=62 time=1.245 ms
84 bytes from 10.10.20.254 icmp_seq=3 ttl=62 time=0.948 ms
84 bytes from 10.10.20.254 icmp_seq=4 ttl=62 time=0.873 ms
84 bytes from 10.10.20.254 icmp_seq=5 ttl=62 time=1.103 ms