OSPF Configuration Part 1 : Network Connectivity


In order to demonstrate how the OSPF routing protocol performs I have configured 4 routers connected to 2 ethernet networks VMnet2 and VMnet3.
The configuration process has two steps:
1st – Network Configuration and Connectivity
2nd – Configuring OSPF


OSPF Network Scenario

Figure 1 - Network Scenario

As long as you can reach one of your routers with a SSH/Telnet client it really doesn't matter on which network you configure your ip addresses, on the other hand I prevented the use of VMnet0 since if we were going to use VMnet0 to connect to our routers we should have had VMnet0 configured on at least one of routers and I didn't want the network picking up routes from my external network or the Internet (although we could have assigned a static route to the router which we have enabled VMnet0 and excluded it from the OSPF network), you also could move physically from one router and configure them separately rather than from one single point.

Router Configuration

Configure R1 interfaces
root@r1# set interfaces loopback lo address 127.1.1.1/24
root@r1# set interfaces ethernet eth0 address 10.10.10.1/24
root@r1# set system host-name r1
root@r1# set service ssh protocol-version 2
root@r1# commit


Configure R2 interfaces
root@r2# set interfaces loopback lo address 127.2.2.2/24
root@r2# set interfaces ethernet eth0 address 10.10.10.2/24
root@r2# set interfaces ethernet eth1 address 20.20.20.2 prefix-length 24
root@r2# set system host-name r2
root@r2# set service telnet port 23
root@r2# commit


Configure R3 interfaces
root@r3# set interfaces loopback lo address 127.3.3.3/24
root@r3# set interfaces ethernet eth0 address 10.10.10.3/24
root@r3# set interfaces ethernet eth1 address 20.20.20.3 prefix-length 24
root@r3# set system host-name r3
root@r3# set service telnet port 23
root@r3# commit


Configure R4 interfaces
root@r4# set interfaces loopback lo address 127.4.4.4/24
root@r4# set interfaces ethernet eth0 address 20.20.20.4/24
root@r4# set service telnet port 23
root@r4# set system host-name r4
root@r4# commit


Well one good reason to configure loopback interfaces with ip addresses is that first of all OSPF routing protocol normally uses this ip address as the default ip address for the router-id and in case the loopback ip addresses on your routers all remain the same you would definitely be running into problems, so first thing to consider is to configure a unique loopback ip address for each of your routers, i normally use 127.x.x.x while x the number of the router so it would be quite easy distinguishable while dealing with routes and also routing tables.

Now let’s take a look at the routing tables on some of our routers e.g. R1, R2, R3

vyatta@r1:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O -OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route
C>* 127.1.1.0/24 is directly connected, lo
C>* 10.10.10.0/24 is directly connected, eth0

vyatta@r2:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O -OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route
C>* 127.2.2.0/24 is directly connected, lo
C>* 10.10.10.0/24 is directly connected, eth0
C>* 20.20.20.0/24 is directly connected, eth1

vyatta@r4:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O -OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route
C>* 127.4.4.0/8 is directly connected, lo
C>* 20.20.20.0/24 is directly connected, eth0


As you see the routing tables only include routes to their directly connected interfaces, in order to generate the OSPF routes we have to configure the routers with the OSPF protocol but before anything we have to make sure we have connectivity over the network.
For now we only have connectivity from and to interfaces residing on the same segments. Let’s check it out to see if it’s true.

Pinging from R1 to R2(interface eth0)
vyatta@r1:~$ ping 10.10.10.2
PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data.

64 bytes from 10.10.10.2: icmp_seq=1 ttl=64 time=6.39 ms
64 bytes from 10.10.10.2: icmp_seq=2 ttl=64 time=1.39 ms
64 bytes from 10.10.10.2: icmp_seq=3 ttl=64 time=0.884 ms
64 bytes from 10.10.10.2: icmp_seq=4 ttl=64 time=1.46 ms
64 bytes from 10.10.10.2: icmp_seq=5 ttl=64 time=1.77 ms
64 bytes from 10.10.10.2: icmp_seq=6 ttl=64 time=1.35 ms
64 bytes from 10.10.10.2: icmp_seq=7 ttl=64 time=0.920 ms
64 bytes from 10.10.10.2: icmp_seq=8 ttl=64 time=0.958 ms
64 bytes from 10.10.10.2: icmp_seq=9 ttl=64 time=0.990 ms
64 bytes from 10.10.10.2: icmp_seq=10 ttl=64 time=1.45 ms
64 bytes from 10.10.10.2: icmp_seq=11 ttl=64 time=0.946 ms
64 bytes from 10.10.10.2: icmp_seq=12 ttl=64 time=1.33 ms
64 bytes from 10.10.10.2: icmp_seq=13 ttl=64 time=2.85 ms



From R1 to R3 interface eth1
vyatta@v1:~$ ping 20.20.20.3
PING 20.20.20.3 (20.20.20.3) 56(84) bytes of data.
64 bytes from 20.20.20.3: icmp_seq=1 ttl=64 time=5.94 ms
64 bytes from 20.20.20.3: icmp_seq=2 ttl=64 time=1.33 ms
64 bytes from 20.20.20.3: icmp_seq=3 ttl=64 time=2.85 ms
64 bytes from 20.20.20.3: icmp_seq=4 ttl=64 time=1.03 ms
64 bytes from 20.20.20.3: icmp_seq=5 ttl=64 time=0.880 ms
64 bytes from 20.20.20.3: icmp_seq=6 ttl=64 time=1.00 ms
64 bytes from 20.20.20.3: icmp_seq=7 ttl=64 time=1.46 ms
64 bytes from 20.20.20.3: icmp_seq=8 ttl=64 time=1.50 ms
64 bytes from 20.20.20.3: icmp_seq=9 ttl=64 time=3.62 ms
64 bytes from 20.20.20.3: icmp_seq=10 ttl=64 time=1.16 ms
64 bytes from 20.20.20.3: icmp_seq=11 ttl=64 time=1.36 ms
64 bytes from 20.20.20.3: icmp_seq=12 ttl=64 time=0.873 ms
64 bytes from 20.20.20.3: icmp_seq=13 ttl=64 time=1.23 ms


Make sure you have connectivity on other segments as well, if not check for duplicate ip addresses and misconfigurations in case you face similar MAC addresses (in a virtual environment anything is possible but rarely probable) use the following command to change the MAC address , reboot the router and you’re good to go.

vyatta@v1# set interfaces ethernet eth0 hw-id 00:0c:29:9f:5f:22

CONTINUE TO PART2 - CONFIGURING OSPF ON VYATTA ROUTERS