I've created a "line" topology using virtual box - creating 4 machines and making a separate link between each using internal networks - R1 (eth0, 10.0.1.1) <-> (eth0, 10.0.2.1) R2 (eth2, 10.0.2.2) <-> (eth0, 10.0.3.1) R3 (eth2, 10.0.3.2) <-> (eth0, 10.0.4.1) R4. I've enabled packet forwarding for ipv4 using:
sudo sysctl net.ipv4.ip_forward=1
the OSPF configuration for R2 and R3 in /etc/bird.conf looks like this:
protocol ospf MyOSPF {
tick 2;
rfc1583compat yes;
area 0.0.0.0 {
stub no;
interface "eth2" {
hello 9;
retransmit 6;
cost 10;
transmit delay 5;
dead count 5;
wait 50;
type broadcast;
};
interface "eth0" {
hello 9;
retransmit 6;
cost 10;
transmit delay 5;
dead count 5;
wait 50;
type broadcast;
};
};
}
when I enter birdc and type
ospf show topology
and
ospf show neighbors
it seems that all the routers see the correct topology, recognize the adjacent routers as neighbors and calculate the costs correctly. However it's not possible to ping R3 from R2, unless the interface is manually specified (ping -I eth2 10.0.3.1). This is not the case with R1 and R2, where eth0 is used on both ends.
Here is what /etc/network/interfaces looks on R2:
allow-hotplug eth0
iface eth0 inet static
address 10.0.2.1
auto eth1 #this is the bridged adapter used to ssh to the vm from the host
iface eth1 inet dhcp
allow-hotplug eth2
iface eth2 inet static
address 10.0.2.2
I'm a bit confused whether the problem is in the configuration of the interfaces or that of the routing protocol.
Here is the output of
ip link
and
ip route
for each machine