Example Configuration of Three Networks with OSPF
Author: Jess Cannata
Network setup - three Debian 7 routers, each with three networks
Router rcp100-11
- eth0: address 192.168.201.15/24
- eth1: address 192.168.232.1/30
- eth2: address 192.168.232.5/30
Router rcp100-12
- eth0: address 192.168.202.15/24
- eth1: address 192.168.232.2/30
- eth2: address 192.168.232.9/30
Router rcp100-13
- eth0: address 192.168.203.15/24
- eth1: address 192.168.232.6/30
- eth2: address 192.168.232.10/30
Three PCs (one connected to each router)
- v11 (address 192.168.201.5/24, gateway 192.168.201.15)
- v12 (address 192.168.202.5/24, gateway 192.168.202.15)
- v13 (address 192.168.203.5/24, gateway 192.168.203.15)
Step 1: Default configuration without OSPF, checking the existing routes
Router rcp100-11
rcp100-11#show ip route Codes: C - connected, S - static, R - RIP, B - blackhole, O - OSPF IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2 C 192.168.201.0/24 is directly connected, eth0 C 192.168.232.0/30 is directly connected, eth1 C 192.168.232.4/30 is directly connected, eth2
Router rcp100-12
rcp100-12#show ip route Codes: C - connected, S - static, R - RIP, B - blackhole, O - OSPF IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2 C 192.168.202.0/24 is directly connected, eth0 C 192.168.232.0/30 is directly connected, eth1 C 192.168.232.8/30 is directly connected, eth2
Router rcp100-13
rcp100-13#show ip route Codes: C - connected, S - static, R - RIP, B - blackhole, O - OSPF IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2 C 192.168.203.0/24 is directly connected, eth0 C 192.168.232.4/30 is directly connected, eth1 C 192.168.232.8/30 is directly connected, eth2
Step 2: Ping from one client (v13) to another (v11)
root@v13:~# ping 192.168.201.5 PING 192.168.201.5 (192.168.201.5) 56(84) bytes of data. From 192.168.203.15 icmp_seq=1 Destination Net Unreachable From 192.168.203.15 icmp_seq=2 Destination Net Unreachable --- 192.168.201.5 ping statistics --- 2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 999ms
Step 3: OSPF Configuration
Router rcp100-11
router ospf router-id 192.168.232.5 network 192.168.232.0/30 area 0 network 192.168.232.4/30 area 0 network 192.168.201.0/24 area 0
Router rcp100-12
router ospf router-id 192.168.232.9 network 192.168.202.0/24 area 0 network 192.168.232.0/30 area 0 network 192.168.232.8/30 area 0
Router rcp100-13
router ospf router-id 192.168.232.10 network 192.168.203.0/24 area 0 network 192.168.232.4/30 area 0 network 192.168.232.8/30 area 0
Step 4: Show all routes
Router rcp100-11
rcp100-11#show ip route Codes: C - connected, S - static, R - RIP, B - blackhole, O - OSPF IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2 C 192.168.201.0/24 is directly connected, eth0 O 192.168.202.0/24[110/2] via 192.168.232.2, eth1 O 192.168.203.0/24[110/2] via 192.168.232.6, eth2 C 192.168.232.0/30 is directly connected, eth1 C 192.168.232.4/30 is directly connected, eth2 O 192.168.232.8/30[110/2] via 192.168.232.2, eth1 via 192.168.232.6, eth2
Router rcp100-12
rcp100-12#show ip route Codes: C - connected, S - static, R - RIP, B - blackhole, O - OSPF IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2 O 192.168.201.0/24[110/2] via 192.168.232.1, eth1 C 192.168.202.0/24 is directly connected, eth0 O 192.168.203.0/24[110/2] via 192.168.232.10, eth2 C 192.168.232.0/30 is directly connected, eth1 O 192.168.232.4/30[110/2] via 192.168.232.1, eth1 via 192.168.232.10, eth2 C 192.168.232.8/30 is directly connected, eth2
Router rcp100-13
rcp100-13#show ip route Codes: C - connected, S - static, R - RIP, B - blackhole, O - OSPF IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2 O 192.168.201.0/24[110/2] via 192.168.232.5, eth1 O 192.168.202.0/24[110/2] via 192.168.232.9, eth2 C 192.168.203.0/24 is directly connected, eth0 O 192.168.232.0/30[110/2] via 192.168.232.5, eth1 via 192.168.232.9, eth2 C 192.168.232.4/30 is directly connected, eth1 C 192.168.232.8/30 is directly connected, eth2
Step 5: Ping from one client (v13) to another (v11)
root@v13:~# ping 192.168.201.5 PING 192.168.201.5 (192.168.201.5) 56(84) bytes of data. 64 bytes from 192.168.201.5: icmp_req=1 ttl=62 time=1.52 ms 64 bytes from 192.168.201.5: icmp_req=2 ttl=62 time=1.55 ms --- 192.168.201.5 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 1.529/1.541/1.553/0.012 ms
Step 6: Test dynamic routing - packets take the shortest path (three hops)
root@v13:~# traceroute 192.168.201.5 traceroute to 192.168.201.5 (192.168.201.5), 30 hops max, 60 byte packets 1 192.168.203.15 (192.168.203.15) 0.796 ms 0.721 ms 1.938 ms 2 192.168.232.5 (192.168.232.5) 1.920 ms 1.899 ms 1.879 ms 3 192.168.201.5 (192.168.201.5) 1.893 ms 1.873 ms 1.853 ms
Step 7: Test dynamic routing - shutdown a Link
rcp100-11(config)#interface ethernet eth2 rcp100-11(config-if eth2)#shutdown
Step 8: Test dynamic routing - packets take the only available path (four hops)
root@v13:~# traceroute 192.168.201.5 traceroute to 192.168.201.5 (192.168.201.5), 30 hops max, 60 byte packets 1 192.168.203.15 (192.168.203.15) 0.600 ms 0.591 ms 0.569 ms 2 192.168.232.9 (192.168.232.9) 1.943 ms 1.935 ms 1.919 ms 3 192.168.232.1 (192.168.232.1) 1.897 ms 1.895 ms 1.888 ms 4 192.168.201.5 (192.168.201.5) 2.485 ms 2.544 ms 2.538 ms