...
Code Block | ||
---|---|---|
| ||
sudo apt-get install software-properties-common -y sudo add-apt-repository ppa:webupd8team/java -y sudo apt-get update sudo apt-get install oracle-java8-installer oracle-java8-set-default -y |
If you would like your containers to be automatically started on boot, you'll need to add the following line to /var/lib/lxc/NAME/config
, where NAME is your container's name. By the way, on my system the /var/lib/lxc
directory is only accessible by root.
Code Block |
---|
lxc.start.auto = 1 |
Check using lxc-ls --fancy
to verify your containers are in fact started on boot.
ONOS config
This is what my cell looks like. You definitely want to verify if the ONOS_NIC
variable corresponds to your system settings, and also OCN
which points to the machine where Mininet is running. Feel free to customize the ONOS_FEATURES
to your liking.
Code Block | ||
---|---|---|
| ||
# LXC-based multi ONOS instance & LINC-OE mininet box export ONOS_NIC=10.0.3.* I=1 for CONTAINER in $( sudo lxc-ls ); do IP=`sudo lxc-ls --fancy -F ipv4 $CONTAINER | tail -1` export OC${I}=${IP} let I=I+1 done export OCI=$OC1 export OCN="192.168.56.9" export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-app-fwd,onos-app-optical,onos-gui,onos-rest,onos-app-proxyarp" export ONOS_USER=ubuntu export ONOS_GROUP=ubuntu |
Additional Steps
Linux Bridge Configuration
I ran into the weird problem that the ONOS instances weren't discovering each other. This process is driven by Hazelcast and relies on IP multicast. It turned out that LXC uses Linux bridge for connectivity among the containers, and the bridge by default does not forward multicast traffic! This is easily solved by checking the Linux bridge documentation; here's an excerpt
...
sudo echo 2 > /sys/devices/virtual/net/lxcbr0/bridge/multicast_router
Development cycle
...
Start Containers on Boot
If you would like your containers to be automatically started on boot, you'll need to add the following line to /var/lib/lxc/NAME/config
, where NAME is your container's name. By the way, on my system the /var/lib/lxc
directory is only accessible by root.
Code Block |
---|
lxc.start.auto = 1 |
Check using lxc-ls --fancy
to verify your containers are in fact started on boot.
Port Forwarding
If you want to access the ONOS GUI from a browse on the host machine, you need to set up port forwarding on the VM. The following command forwards traffic on port 8181 to the first ONOS container ($OC1
).
Code Block | ||
---|---|---|
| ||
sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 8181 -j DNAT --to $OC1:8181 |