1. Add new configuration files in rftest/config for rfvmA to rfvmD:
rftest/config/rfvmA/rootfs/usr/etc/xorp.conf
protocols {
ospf4 {
router-id: 1.1.1.1
area 0.0.0.0 {
interface eth2 {
vif eth2 {
address 10.0.0.1 {
}
}
}
}
area 0.0.0.1 {
interface eth3 {
vif eth3 {
address 30.0.0.1 {
}
}
}
}
area 0.0.0.4 {
interface eth4 {
vif eth4 {
address 50.0.0.1 {
}
}
}
}
export: "redis.connect"
}
}
policy {
policy-statement "redis.connect" {
term connect {
from {
protocol: "connected"
}
}
}
}
fea {
unicast-forwarding4 {
}
}
interfaces {
interface eth1 {
description: "eth1"
vif eth1 {
address 172.31.1.1 {
prefix-length: 24
}
}
}
interface eth2 {
description: "eth2"
vif eth2 {
address 10.0.0.1 {
prefix-length: 24
}
}
}
interface eth3 {
description: "eth3"
vif eth3 {
address 30.0.0.1 {
prefix-length: 24
}
}
}
interface eth4 {
description: "eth4"
vif eth4 {
address 50.0.0.1 {
prefix-length: 24
}
}
}
interface lo {
vif lo {
address 1.1.1.1 {
prefix-length: 32
}
}
}
}
rftest/config/rfvmB/rootfs/usr/etc/xorp.conf
protocols {
ospf4 {
router-id: 2.2.2.2
area 0.0.0.0 {
interface eth2 {
vif eth2 {
address 10.0.0.2 {
}
}
}
}
area 0.0.0.2 {
interface eth3 {
vif eth3 {
address 40.0.0.2 {
}
}
}
}
export: "redis.connect"
}
}
policy {
policy-statement "redis.connect" {
term connect {
from {
protocol: "connected"
}
}
}
}
fea {
unicast-forwarding4 {
}
}
interfaces {
interface eth1 {
description: "eth1"
vif eth1 {
address 172.31.2.1 {
prefix-length: 24
}
}
}
interface eth2 {
description: "eth2"
vif eth2 {
address 10.0.0.2 {
prefix-length: 24
}
}
}
interface eth3 {
description: "eth3"
vif eth3 {
address 40.0.0.2 {
prefix-length: 24
}
}
}
interface lo {
vif lo {
address 2.2.2.2 {
prefix-length: 32
}
}
}
}
rftest/config/rfvmC/rootfs/usr/etc/xorp.conf
protocols {
ospf4 {
router-id: 3.3.3.3
area 0.0.0.1 {
interface eth3 {
vif eth3 {
address 30.0.0.3 {
}
}
}
}
area 0.0.0.3 {
interface eth2 {
vif eth2 {
address 20.0.0.3 {
}
}
}
}
export: "redis.connect"
}
}
policy {
policy-statement "redis.connect" {
term connect {
from {
protocol: "connected"
}
}
}
}
fea {
unicast-forwarding4 {
}
}
interfaces {
interface eth1 {
description: "eth1"
vif eth1 {
address 172.31.3.1 {
prefix-length: 24
}
}
}
interface eth2 {
description: "eth2"
vif eth2 {
address 20.0.0.3 {
prefix-length: 24
}
}
}
interface eth3 {
description: "eth3"
vif eth3 {
address 30.0.0.3 {
prefix-length: 24
}
}
}
interface lo {
vif lo {
address 3.3.3.3 {
prefix-length: 32
}
}
}
}
rftest/config/rfvmD/rootfs/usr/etc/xorp.conf
protocols {
ospf4 {
router-id: 4.4.4.4
area 0.0.0.2 {
interface eth2 {
vif eth2 {
address 40.0.0.4 {
}
}
}
}
area 0.0.0.3 {
interface eth3 {
vif eth3 {
address 20.0.0.4 {
}
}
}
}
area 0.0.0.4 {
interface eth4 {
vif eth4 {
address 50.0.0.4 {
}
}
}
}
export: "redis.connect"
}
}
policy {
policy-statement "redis.connect" {
term connect {
from {
protocol: "connected"
}
}
}
}
fea {
unicast-forwarding4 {
}
}
interfaces {
interface eth1 {
description: "eth1"
vif eth1 {
address 172.31.4.1 {
prefix-length: 24
}
}
}
interface eth2 {
description: "eth2"
vif eth2 {
address 40.0.0.4 {
prefix-length: 24
}
}
}
interface eth3 {
description: "eth3"
vif eth3 {
address 20.0.0.4 {
prefix-length: 24
}
}
}
interface eth4 {
description: "eth4"
vif eth4 {
address 50.0.0.4 {
prefix-length: 24
}
}
}
interface lo {
vif lo {
address 4.4.4.4 {
prefix-length: 32
}
}
}
}
2. Modify the "rftest/create" shell script
chroot $LXCDIR/base/rootfs apt-get -y --force-yes install xorp quagga libboost-thread-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev rsyslog vlan tcpdump
chroot $LXCDIR/base/rootfs usermod -a -G xorp root
chroot $LXCDIR/rfvmA/rootfs usermod -a -G xorp root
chroot $LXCDIR/rfvmB/rootfs usermod -a -G xorp root
chroot $LXCDIR/rfvmC/rootfs usermod -a -G xorp root
chroot $LXCDIR/rfvmD/rootfs usermod -a -G xorp root
3. Modify the "rftest/rftest2" shell script
SCRIPT_NAME="rftest_xorp"
...
...
echo "#!/bin/sh" > /var/lib/lxc/rfvmA/rootfs/root/run_rfclient.sh
echo "sleep 3" >> /var/lib/lxc/rfvmA/rootfs/root/run_rfclient.sh
if [ "$SCRIPT_NAME" == "rftest_xorp" ]
then
echo "sudo xorp_rtrmgr" >> /var/lib/lxc/rfvmA/rootfs/root/run_rfclient.sh
else
echo "/etc/init.d/quagga start" >> /var/lib/lxc/rfvmA/rootfs/root/run_rfclient.sh
fi
echo "/opt/rfclient/rfclient > /var/log/rfclient.log" >> /var/lib/lxc/rfvmA/rootfs/root/run_rfclient.sh
echo "#!/bin/sh" > /var/lib/lxc/rfvmB/rootfs/root/run_rfclient.sh
echo "sleep 3" >> /var/lib/lxc/rfvmB/rootfs/root/run_rfclient.sh
if [ "$SCRIPT_NAME" == "rftest_xorp" ]
then
echo "sudo xorp_rtrmgr" >> /var/lib/lxc/rfvmB/rootfs/root/run_rfclient.sh
else
echo "/etc/init.d/quagga start" >> /var/lib/lxc/rfvmB/rootfs/root/run_rfclient.sh
fi
echo "/opt/rfclient/rfclient > /var/log/rfclient.log" >> /var/lib/lxc/rfvmB/rootfs/root/run_rfclient.sh
echo "#!/bin/sh" > /var/lib/lxc/rfvmC/rootfs/root/run_rfclient.sh
echo "sleep 3" >> /var/lib/lxc/rfvmC/rootfs/root/run_rfclient.sh
if [ "$SCRIPT_NAME" == "rftest_xorp" ]
then
echo "sudo xorp_rtrmgr" >> /var/lib/lxc/rfvmC/rootfs/root/run_rfclient.sh
else
echo "/etc/init.d/quagga start" >> /var/lib/lxc/rfvmC/rootfs/root/run_rfclient.sh
fi
echo "/opt/rfclient/rfclient > /var/log/rfclient.log" >> /var/lib/lxc/rfvmC/rootfs/root/run_rfclient.sh
echo "#!/bin/sh" > /var/lib/lxc/rfvmD/rootfs/root/run_rfclient.sh
echo "sleep 3" >> /var/lib/lxc/rfvmD/rootfs/root/run_rfclient.sh
if [ "$SCRIPT_NAME" == "rftest_xorp" ]
then
echo "sudo xorp_rtrmgr" >> /var/lib/lxc/rfvmD/rootfs/root/run_rfclient.sh
else
echo "/etc/init.d/quagga start" >> /var/lib/lxc/rfvmD/rootfs/root/run_rfclient.sh
fi
echo "/opt/rfclient/rfclient > /var/log/rfclient.log" >> /var/lib/lxc/rfvmD/rootfs/root/run_rfclient.sh
5. Verify ==> for instance, rfvmD
sudo lxc-console -n rfvmD
ubuntu@rfvmD:~$ sudo xorpsh
[sudo] password for ubuntu:
Welcome to XORP on rfvmD
root@rfvmD> show ospf4 neighbor
Address Interface State ID Pri Dead
40.0.0.2 eth2/eth2 Full 2.2.2.2 128 38
20.0.0.3 eth3/eth3 Full 3.3.3.3 128 39
50.0.0.1 eth4/eth4 Full 1.1.1.1 128 39
root@rfvmD> show interfaces
eth2/eth2: Flags:<ENABLED,BROADCAST,MULTICAST> mtu 1500 speed 1 Gbps
inet 40.0.0.4 subnet 40.0.0.0/24 broadcast 40.0.0.255
physical index 161
ether 2:d2:d2:d2:d2:d2
eth3/eth3: Flags:<ENABLED,BROADCAST,MULTICAST> mtu 1500 speed 1 Gbps
inet 20.0.0.4 subnet 20.0.0.0/24 broadcast 20.0.0.255
physical index 163
ether 2:d3:d3:d3:d3:d3
eth4/eth4: Flags:<ENABLED,BROADCAST,MULTICAST> mtu 1500 speed 1 Gbps
inet 50.0.0.4 subnet 50.0.0.0/24 broadcast 50.0.0.255
physical index 165
ether 2:d4:d4:d4:d4:d4
lo/lo: Flags:<ENABLED,LOOPBACK> mtu 16436 speed unknown
inet 4.4.4.4 subnet 4.4.4.4/32
physical index 168
root@rfvmD>