# Connect R1 and C1 sudo /snap/bin/lxc launch Quagga_Template R1 sudo /snap/bin/lxc launch Client_Ubuntu2004 C1 sudo /snap/bin/lxc network create C1R1 ipv6.address&#61;none ipv4.address&#61;192.168.1.1/24 sudo /snap/bin/lxc network attach C1R1 C1 eth0 sudo /snap/bin/lxc network attach C1R1 R1 eth1 sudo /snap/bin/lxc exec R1 -- /bin/baship addr add 192.168.1.1/24 dev eth1 && ip link set eth1 up && exit sudo /snap/bin/lxc exec C1 -- /bin/baship addr add 192.168.1.2/24 dev eth0 && ip link set eth0 uproute add default gw 192.168.1.1ping 192.168.1.1exit# Connect R2 and C2 sudo /snap/bin/lxc launch Quagga_Template R2 sudo /snap/bin/lxc launch Client_Ubuntu2004 C2 sudo /snap/bin/lxc network create C2R2 ipv6.address&#61;none ipv4.address&#61;192.168.2.1/24 sudo /snap/bin/lxc network attach C2R2 C2 eth0 sudo /snap/bin/lxc network attach C2R2 R2 eth1 sudo /snap/bin/lxc exec R2 -- /bin/baship addr add 192.168.2.1/24 dev eth1 && ip link set eth1 up && exit sudo /snap/bin/lxc exec C2 -- /bin/baship addr add 192.168.2.2/24 dev eth0 && ip link set eth0 uproute add default gw 192.168.2.1ping 192.168.2.1exit# Connect R1R2 sudo /snap/bin/lxc network create R1R2 ipv6.address&#61;none ipv4.address&#61;192.168.0.1/24 sudo /snap/bin/lxc network attach R1R2 R1 eth0 sudo /snap/bin/lxc network attach R1R2 R2 eth0 sudo /snap/bin/lxc exec R1 -- /bin/baship addr add 192.168.0.1/24 dev eth0 && ip link set eth0 up && exit sudo /snap/bin/lxc exec R2 -- /bin/baship addr add 192.168.0.2/24 dev eth0 && ip link set eth0 up && exit# Configure OSPF on R1 sudo /snap/bin/lxc exec R1 -- /bin/bash cat <! OSPF configuration file hostname R1 password password enable password password router ospfospf router-id 192.168.0.1network 192.168.0.0/24 area 0network 192.168.1.0/24 area 1 debug ospf event log file /usr/local/etc/ospfd.log EOF zebra -d && ospfd -d && exit# Configure OSPF on R2 sudo /snap/bin/lxc exec R2 -- /bin/bash cat <! OSPF configuration file hostname R2 password password enable password password router ospfospf router-id 192.168.0.2network 192.168.0.0/24 area 0network 192.168.2.0/24 area 2 debug ospf event log file /usr/local/etc/ospfd.log EOF zebra -d && ospfd -d && exit
Test Result
# Test - C1 -> C2 $ sudo /snap/bin/lxc exec C1 -- /usr/bin/ping 192.168.2.2 -c1 PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data. 64 bytes from 192.168.2.2: icmp_seq&#61;1 ttl&#61;62 time&#61;0.204 ms
Some Debug Data
sudo /snap/bin/lxc exec R1 -- /bin/bash vtysh R1# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL 192.168.0.2 1 Full/Backup 37.551s 192.168.0.2 eth0:192.168.0.1 0 0 0sudo /snap/bin/lxc exec R2 -- /bin/bash vtysh R2# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL 192.168.0.1 1 Full/DR 36.633s 192.168.0.1 eth0:192.168.0.2 0 0 0R1# show ip ospf dataOSPF Router with ID (192.168.0.1)Router Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum Link count 192.168.0.1 192.168.0.1 815 0x80000004 0x722a 1 192.168.0.2 192.168.0.2 269 0x80000005 0x6e2a 1Net Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum 192.168.0.1 192.168.0.1 815 0x80000001 0x941bSummary Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum Route 192.168.1.0 192.168.0.1 785 0x80000002 0xfe7e 192.168.1.0/24 192.168.2.0 192.168.0.2 129 0x80000002 0xed8d 192.168.2.0/24R2# show ip ospf dataOSPF Router with ID (192.168.0.2)Router Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum Link count 192.168.0.1 192.168.0.1 881 0x80000004 0x722a 1 192.168.0.2 192.168.0.2 333 0x80000005 0x6e2a 1Net Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum 192.168.0.1 192.168.0.1 882 0x80000001 0x941bSummary Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum Route 192.168.1.0 192.168.0.1 852 0x80000002 0xfe7e 192.168.1.0/24 192.168.2.0 192.168.0.2 193 0x80000002 0xed8d 192.168.2.0/24Router Link States (Area 0.0.0.2) Link ID ADV Router Age Seq# CkSum Link count 192.168.0.2 192.168.0.2 843 0x80000003 0x3dc6 1Summary Link States (Area 0.0.0.2) Link ID ADV Router Age Seq# CkSum Route 192.168.0.0 192.168.0.2 293 0x80000003 0x027a 192.168.0.0/24 192.168.1.0 192.168.0.2 871 0x80000001 0x5f14 192.168.1.0/24