# ONOS ## Course - What's different between Control plane vs management plant? - Can controller route the overlay network? ## Lab 1 Start ONOS Server in localhost ```shell cd $ONOS_ROOT bazel run onos-local -- clean debug # option 'clean' to delete all previous running status # option 'debug' to enable remote debugging (port 5005) ``` ONOS CLI ```shell cd $ONOS_ROOT tools/test/bin/onos localhost ``` ONOS GUI http://localhost:8181/onos/ui/ onos/rocks ```shell apps -a -s # Show activated apps only app activate org.onosproject.openflow app activate org.onosproject.fwd app activate org.onosproject.proxyarp # app activate org.onosproject.drivers.ovsdb app deactivate <name> # deactivate onos app ``` Create linear topology ```shell sudo mn -c #clean and exit sudo mn --topo=linear,3 --controller=remote,127.0.0.1:6653 sudo mn --topo=linear,3 --switch=ovs,protocols=OpenFlow13 --controller=remote,127.0.0.1:6653 ``` ```shell pingall dump ``` Custom Topology ```python from mininet.topo import Topo class MyTopo( Topo ): def __init__( self ): Topo.__init__( self ) # Add hosts h1 = self.addHost( 'h1' ) h2 = self.addHost( 'h2' ) # Add switches s1 = self.addSwitch( 's1' ) # Add links self.addLink( h1, s1 ) self.addLink( h2, s1 ) topos = { 'mytopo': MyTopo } ``` ```shell sudo mn --custom=sample.py --topo=mytopo --controller=remote,ip=127.0.0.1,port=6653 ``` 1. When activating "org.onosproject.openflow", what are the APPs which also be activated? https://wiki.onosproject.org/display/ONOS/Managing+ONOS+applications 2. Can H1 ping H2 successfully? Why or why not? ```shell app activate org.onosproject.fwd # H1 ping H2 ping successful app dectivate org.onosproject.fwd # H1 ping H2 ping failed ``` 3. Which TCP Port the controller listens for the Openflow connection request from the switch? 4. In question 3, which App enables the control to listen on the TCP port? https://wiki.onosproject.org/display/ONOS/Requirements ``` ONOS requires the following ports to be open, in order to make the corresponding functionalities available: 8181 for REST API and GUI 8101 to access the ONOS CLI 9876 for intra-cluster communication (communication between target machines) 6653 optional, for OpenFlow 6640 optional, for OVSDB ``` ## Lab 2 ```shell sudo apt update sudo apt install wireshark sudo wireshark # choosing the loopback interface ``` ![](https://i.imgur.com/i5SxmcO.png) ```shell sudo mn --controller=remote,127.0.0.1:6653 > h1 ping h2 -c 5 ``` part2 ```json # flow1.json { "priority": 50000, "timeout": 0, "isPermanent": true, "deviceId": "of:0000000000000001", "treatment": { "instructions": [ { "type": "OUTPUT", "port": "2" } ] }, "selector": { "criteria": [ { "type": "IN_PORT", "port": "1" } ] } } ``` ARP 一個 priority 只能設定一個 arp protocol rule 一個 priority 只能設定一個 arp protocol rule ```shell { "priority": 50000, "timeout": 0, "isPermanent": true, "deviceId": "of:0000000000000001", "treatment": { "instructions": [ { "type": "OUTPUT", "port": "1" }, { "type": "OUTPUT", "port": "2" } ] }, "selector": { "criteria": [ { "type":"ETH_TYPE", "ethType":"0x806" } ] } } ``` ```shell curl -u onos:rocks \ -X POST \ -H 'Content-Type: application/json' \ -d @flows_s1-1_309551012.json \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001' curl -v -u onos:rocks \ -X POST \ -H 'Content-Type: application/json' \ -d @flows_s1-2_309551012.json \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001' curl -u onos:rocks \ -X POST \ -H 'Content-Type: application/json' \ -d @flows_s1-3_309551012.json \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001' curl -v -u onos:rocks \ -X POST \ -H 'Content-Type: application/json' \ -d @flows_s1-4_309551012.json \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001' ``` show ```shell curl -u onos:rocks \ -X GET -H 'Accept: application/json' \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001' | grep 50000 ``` delete ```shell curl -u onos:rocks \ -X DELETE \ -H 'Accept: application/json' \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001/54043197764220949' curl -u onos:rocks \ -X DELETE \ -H 'Accept: application/json' \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001/54043197764220949' ``` part3 ```shell curl -u onos:rocks \ -X POST \ -H 'Content-Type: application/json' \ -d @flows1.json \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001' curl -v -u onos:rocks \ -X POST \ -H 'Content-Type: application/json' \ -d @flows2.json \ 'http://localhost:8181/onos/v1/flows/of:0000000000000001' ``` ./tools/add part3/flows_s1-1_309551012.json part3/flows_s1-2_309551012.json part3/flows_s2-1_309551012.json part3/flows_s2-2_309551012.json part3/flows_s3-1_309551012.json part3/flows_s3-2_309551012.json ./tools/add part3/flows_s2-1_309551012.json part3/flows_s2-2_309551012.json part3/flows_s3-1_309551012.json part3/flows_s3-2_309551012.json ## Lab 3 install oracle jdk: https://www.oracle.com/java/technologies/javase-jdk11-downloads.html ```shell sudo tar -zxf ./jdk-11.0.8_linux-x64_bin.tar.gz -C /opt sudo update-alternatives --install /usr/bin/java java /opt/jdk-11.0.8/bin/java 2000 sudo update-alternatives --install /usr/bin/javac javac /opt/jdk-11.0.8/bin/javac 2000 java -version javac -version ``` install Maven: ```shell sudo apt install maven export ONOS_POM_VERSION=2.2.0 echo "export ONOS_POM_VERSION=2.2.0" >> ~/.bash_profile export | grep ONOS cd $ONOS_ROOT/tools/package/archetypes mvn clean install -DskipTests ``` ```shell onos-create-app {app|bundle|ui|ui2|uitab|uitopo|cli|api} groupId artifactId version package mvn-options onos-create-app app nctu.winlab bridge-app 1.0-SNAPSHOT nctu.winlab.bridge onos-create-app cli nctu.winlab bridge-app 1.0-SNAPSHOT nctu.winlab.bridge ``` uninstall ```shell onos localhost app deactivate nctu.winlab.bridge onos-app localhost uninstall nctu.winlab.bridge ``` ```xml # pom.xml - <onos.app.name>org.foo.app</onos.app.name> - <onos.app.title>Foo App</onos.app.title> - <onos.app.origin>Foo, Inc.</onos.app.origin> + <onos.app.name>nctu.winlab.bridge</onos.app.name> + <onos.app.title>Learning Bridge App</onos.app.title> + <onos.app.origin>Winlab, NCTU</onos.app.origin> ``` ```shell # run onos bazel run onos-local -- clean debug # compile or recompile mvn clean install -DskipTests # install, !: activate after install onos-app localhost install! target/bridge-app-1.0-SNAPSHOT.oar # reinstall onos-app localhost reinstall! nctu.winlab.bridge target/bridge-app-1.0-SNAPSHOT.oar ``` ```shell sudo mn --controller=remote,127.0.0.1:6653 --topo=tree,depth=2 ``` ## Lab 4 ### example: echoconfig ```shell onos-netcfg localhost config.json ``` ```shell mvn clean install -DskipTests onos-app localhost install! target/echoconfig-1.0-SNAPSHOT.oar onos-app localhost reinstall! winlab.nctu.echoconfig target/echoconfig-1.0-SNAPSHOT.oar ``` ### unicastdhcp ```shell app deactivate org.onosproject.fwd ``` To use dhcpd inside mininet host properly, you should modify AppArmor settings (only need to be done for the first time) ```shell sudo apt update && sudo apt install -y isc-dhcp-server # server sudo ln -s /etc/apparmor.d/usr.sbin.dhcpd /etc/apparmor.d/disable/ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.dhcpd # client sudo /etc/init.d/apparmor stop sudo sed -i '30i /var/lib/dhcp{,3}/dhcpclient* lrw,' /etc/apparmor.d/sbin.dhclient sudo /etc/init.d/apparmor start ``` 1. Configure a DHCP server location 2. Install flow rules to Packet-in DHCP packets 3. Compute path between a DHCP client and the DHCP application 4. Install flow rules to forward DHCP packets via unicast ```shell # up to 30 min # https://stackoverflow.com/questions/17524148/generating-project-in-interactive-mode-taking-lot-of-time onos-create-app app nctu.winlab unicastdhcp 1.0-SNAPSHOT nctu.winlab.unicastdhcp cd unicastdhcp touch unicastdhcp.json ``` ```json { "apps": { "nctu.winlab.unicastdhcp": { "server": { "name": "of:0000000000000003/2" } } } } ``` ```shell onos-netcfg localhost unicastdhcp.json mvn clean install -DskipTests onos-app localhost install! target/unicastdhcp-1.0-SNAPSHOT.oar onos localhost app deactivate nctu.winlab.unicastdhcp onos-app localhost uninstall nctu.winlab.bridge mvn clean install -DskipTests onos-app localhost reinstall! nctu.winlab.unicastdhcp target/unicastdhcp-1.0-SNAPSHOT.oar ``` run mininet ```shell sudo python topo.py ``` ```shell # get dchp ipv4 h1 dhclient -v h1-eth0 # release dchp ipv4 h1 dhclient -r h1-eth0 ``` ```shell - PathService - Set<Path> getPath(src, dst) - Path - cost - weight - List<Link> links() - Link - ConnectPoint src() - ConnectPoint dst() - DeviceId deviceId() - PortNumber port() - HostId hostId() ``` ## Lab 5 mininet ```shell sudo mn --controller=remote,127.0.0.1:6653 --topo=tree,depth=2 ``` onos ```shell # onos create app up to 30 min onos-create-app app nctu.winlab ProxyArp 1.0-SNAPSHOT nctu.winlab.ProxyArp cd ProxyArp ``` ```shell mvn clean install -DskipTests onos-app localhost install! target/ProxyArp-1.0-SNAPSHOT.oar onos-app localhost uninstall nctu.winlab.ProxyArp onos-app localhost reinstall! nctu.winlab.ProxyArp target/ProxyArp-1.0-SNAPSHOT.oar ``` ## Lab 6 ```shell akiicat@akiicat-VirtualBox:~/Desktop/Lab6$ python script.py # *** add host *** docker run --privileged --cap-add NET_ADMIN --cap-add NET_BROADCAST -d -ti --name h1 ubuntu:16.04 docker run --privileged --cap-add NET_ADMIN --cap-add NET_BROADCAST -d -ti --name h2 ubuntu:16.04 docker run --privileged --cap-add NET_ADMIN --cap-add NET_BROADCAST -d -ti --name h3 ubuntu:16.04 docker run --privileged --cap-add NET_ADMIN --cap-add NET_BROADCAST -d -ti --name h4 ubuntu:16.04 # *** add router *** docker run --privileged --cap-add NET_ADMIN --cap-add NET_BROADCAST -d -ti --name R1 ubuntu:16.04 docker run --privileged --cap-add NET_ADMIN --cap-add NET_BROADCAST -d -ti --name R2 ubuntu:16.04 docker run --privileged --cap-add NET_ADMIN --cap-add NET_BROADCAST -d -ti --name R3 ubuntu:16.04 docker run --privileged --cap-add NET_ADMIN --cap-add NET_BROADCAST -d -ti --name R4 ubuntu:16.04 # *** create network *** docker network create R1R2br --subnet 172.31.0.0/16 docker network connect R1R2br R1 --ip 172.31.0.2 docker network connect R1R2br R2 --ip 172.31.0.3 docker network create R2R3br --subnet 172.32.0.0/16 docker network connect R2R3br R2 --ip 172.32.0.2 docker network connect R2R3br R3 --ip 172.32.0.3 docker network create R3R4br --subnet 172.33.0.0/16 docker network connect R3R4br R3 --ip 172.33.0.2 docker network connect R3R4br R4 --ip 172.33.0.3 docker network create R4R1br --subnet 172.34.0.0/16 docker network connect R4R1br R4 --ip 172.34.0.2 docker network connect R4R1br R1 --ip 172.34.0.3 docker network create R1h1br --subnet 172.21.0.0/16 docker network connect R1h1br R1 --ip 172.21.0.2 docker network connect R1h1br h1 --ip 172.21.0.3 docker network create R2h2br --subnet 172.22.0.0/16 docker network connect R2h2br R2 --ip 172.22.0.2 docker network connect R2h2br h2 --ip 172.22.0.3 docker network create R3h3br --subnet 172.23.0.0/16 docker network connect R3h3br R3 --ip 172.23.0.2 docker network connect R3h3br h3 --ip 172.23.0.3 docker network create R4h4br --subnet 172.24.0.0/16 docker network connect R4h4br R4 --ip 172.24.0.2 docker network connect R4h4br h4 --ip 172.24.0.3 # *** get ip *** docker inspect h1 | jq -r '.[].NetworkSettings.Networks | to_entries[] | [.key, .value.IPAddress] | @tsv' docker inspect h2 | jq -r '.[].NetworkSettings.Networks | to_entries[] | [.key, .value.IPAddress] | @tsv' docker inspect h3 | jq -r '.[].NetworkSettings.Networks | to_entries[] | [.key, .value.IPAddress] | @tsv' docker inspect h4 | jq -r '.[].NetworkSettings.Networks | to_entries[] | [.key, .value.IPAddress] | @tsv' docker inspect R1 | jq -r '.[].NetworkSettings.Networks | to_entries[] | [.key, .value.IPAddress] | @tsv' docker inspect R2 | jq -r '.[].NetworkSettings.Networks | to_entries[] | [.key, .value.IPAddress] | @tsv' docker inspect R3 | jq -r '.[].NetworkSettings.Networks | to_entries[] | [.key, .value.IPAddress] | @tsv' docker inspect R4 | jq -r '.[].NetworkSettings.Networks | to_entries[] | [.key, .value.IPAddress] | @tsv' # *** host install *** docker exec h1 bash -c "apt-get update" docker exec h2 bash -c "apt-get update" docker exec h3 bash -c "apt-get update" docker exec h4 bash -c "apt-get update" docker exec h1 bash -c "apt-get install -y net-tools iproute2" docker exec h2 bash -c "apt-get install -y net-tools iproute2" docker exec h3 bash -c "apt-get install -y net-tools iproute2" docker exec h4 bash -c "apt-get install -y net-tools iproute2" docker exec h1 bash -c "ip route del default" docker exec h2 bash -c "ip route del default" docker exec h3 bash -c "ip route del default" docker exec h4 bash -c "ip route del default" docker exec h1 bash -c "ip route add default via 172.21.0.2" docker exec h2 bash -c "ip route add default via 172.22.0.2" docker exec h3 bash -c "ip route add default via 172.23.0.2" docker exec h4 bash -c "ip route add default via 172.24.0.2" docker exec h1 bash -c "route" docker exec h2 bash -c "route" docker exec h3 bash -c "route" docker exec h4 bash -c "route" # *** router install *** docker exec R1 bash -c "apt-get update" docker exec R2 bash -c "apt-get update" docker exec R3 bash -c "apt-get update" docker exec R4 bash -c "apt-get update" docker exec R1 bash -c "apt-get install -y vim quagga telnet net-tools" docker exec R2 bash -c "apt-get install -y vim quagga telnet net-tools" docker exec R3 bash -c "apt-get install -y vim quagga telnet net-tools" docker exec R4 bash -c "apt-get install -y vim quagga telnet net-tools" docker exec R1 bash -c "sysctl -w net.ipv4.ip_forward=1" docker exec R2 bash -c "sysctl -w net.ipv4.ip_forward=1" docker exec R3 bash -c "sysctl -w net.ipv4.ip_forward=1" docker exec R4 bash -c "sysctl -w net.ipv4.ip_forward=1" docker exec R1 bash -c "sed -i 's/^zebra=.*/zebra=yes/g' /etc/quagga/daemons" docker exec R2 bash -c "sed -i 's/^zebra=.*/zebra=yes/g' /etc/quagga/daemons" docker exec R3 bash -c "sed -i 's/^zebra=.*/zebra=yes/g' /etc/quagga/daemons" docker exec R4 bash -c "sed -i 's/^zebra=.*/zebra=yes/g' /etc/quagga/daemons" docker exec R1 bash -c "sed -i 's/^bgdp=.*/bgpd=yes/g' /etc/quagga/daemons" docker exec R1 bash -c "sed -i 's/^bgpd=.*/bgpd=yes/g' /etc/quagga/daemons" docker exec R2 bash -c "sed -i 's/^bgdp=.*/bgpd=yes/g' /etc/quagga/daemons" docker exec R2 bash -c "sed -i 's/^bgpd=.*/bgpd=yes/g' /etc/quagga/daemons" docker exec R3 bash -c "sed -i 's/^bgdp=.*/bgpd=yes/g' /etc/quagga/daemons" docker exec R3 bash -c "sed -i 's/^bgpd=.*/bgpd=yes/g' /etc/quagga/daemons" docker exec R4 bash -c "sed -i 's/^bgdp=.*/bgpd=yes/g' /etc/quagga/daemons" docker exec R4 bash -c "sed -i 's/^bgpd=.*/bgpd=yes/g' /etc/quagga/daemons" docker exec R1 bash -c "cat /etc/quagga/daemons" docker exec R2 bash -c "cat /etc/quagga/daemons" docker exec R3 bash -c "cat /etc/quagga/daemons" docker exec R4 bash -c "cat /etc/quagga/daemons" docker exec R1 bash -c "echo 'hostname R1zebra' > /etc/quagga/zebra.conf" docker exec R2 bash -c "echo 'hostname R2zebra' > /etc/quagga/zebra.conf" docker exec R3 bash -c "echo 'hostname R3zebra' > /etc/quagga/zebra.conf" docker exec R4 bash -c "echo 'hostname R4zebra' > /etc/quagga/zebra.conf" docker exec R1 bash -c "echo 'password vRouter' >> /etc/quagga/zebra.conf" docker exec R2 bash -c "echo 'password vRouter' >> /etc/quagga/zebra.conf" docker exec R3 bash -c "echo 'password vRouter' >> /etc/quagga/zebra.conf" docker exec R4 bash -c "echo 'password vRouter' >> /etc/quagga/zebra.conf" docker exec R1 bash -c "echo 'log stdout' >> /etc/quagga/zebra.conf" docker exec R2 bash -c "echo 'log stdout' >> /etc/quagga/zebra.conf" docker exec R3 bash -c "echo 'log stdout' >> /etc/quagga/zebra.conf" docker exec R4 bash -c "echo 'log stdout' >> /etc/quagga/zebra.conf" docker exec R1 bash -c "cat /etc/quagga/zebra.conf" docker exec R2 bash -c "cat /etc/quagga/zebra.conf" docker exec R3 bash -c "cat /etc/quagga/zebra.conf" docker exec R4 bash -c "cat /etc/quagga/zebra.conf" docker exec R1 bash -c "echo -e '\041 BGP configuration for R1' > /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo -e '\041 BGP configuration for R2' > /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo -e '\041 BGP configuration for R3' > /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo -e '\041 BGP configuration for R4' > /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo 'hostname R1bgp' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo 'hostname R2bgp' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo 'hostname R3bgp' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo 'hostname R4bgp' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo 'password vRouter' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo 'password vRouter' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo 'password vRouter' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo 'password vRouter' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo 'router bgp 65001' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo 'router bgp 65002' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo 'router bgp 65003' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo 'router bgp 65004' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' bgp router-id 172.31.0.2' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' bgp router-id 172.32.0.2' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' bgp router-id 172.33.0.2' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' bgp router-id 172.34.0.2' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' bgp router-id 172.34.0.3' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' bgp router-id 172.31.0.3' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' bgp router-id 172.32.0.3' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' bgp router-id 172.33.0.3' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' timers bgp 3 9' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' timers bgp 3 9' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' timers bgp 3 9' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' timers bgp 3 9' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' neighbor 172.31.0.3 remote-as 65002' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' neighbor 172.32.0.3 remote-as 65003' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' neighbor 172.33.0.3 remote-as 65004' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' neighbor 172.34.0.3 remote-as 65001' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' neighbor 172.31.0.3 ebgp-multihop' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' neighbor 172.32.0.3 ebgp-multihop' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' neighbor 172.33.0.3 ebgp-multihop' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' neighbor 172.34.0.3 ebgp-multihop' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' neighbor 172.31.0.3 timers connect 5' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' neighbor 172.32.0.3 timers connect 5' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' neighbor 172.33.0.3 timers connect 5' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' neighbor 172.34.0.3 timers connect 5' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' neighbor 172.31.0.3 advertisement-interval 5' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' neighbor 172.32.0.3 advertisement-interval 5' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' neighbor 172.33.0.3 advertisement-interval 5' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' neighbor 172.34.0.3 advertisement-interval 5' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' neighbor 172.34.0.2 remote-as 65004' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' neighbor 172.31.0.2 remote-as 65001' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' neighbor 172.32.0.2 remote-as 65002' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' neighbor 172.33.0.2 remote-as 65003' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' neighbor 172.34.0.2 ebgp-multihop' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' neighbor 172.31.0.2 ebgp-multihop' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' neighbor 172.32.0.2 ebgp-multihop' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' neighbor 172.33.0.2 ebgp-multihop' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' neighbor 172.34.0.2 timers connect 5' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' neighbor 172.31.0.2 timers connect 5' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' neighbor 172.32.0.2 timers connect 5' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' neighbor 172.33.0.2 timers connect 5' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' neighbor 172.34.0.2 advertisement-interval 5' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' neighbor 172.31.0.2 advertisement-interval 5' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' neighbor 172.32.0.2 advertisement-interval 5' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' neighbor 172.33.0.2 advertisement-interval 5' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo ' network 172.21.0.0/16' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo ' network 172.22.0.0/16' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo ' network 172.23.0.0/16' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo ' network 172.24.0.0/16' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo -e '\041' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "echo 'log stdout' >> /etc/quagga/bgpd.conf" docker exec R2 bash -c "echo 'log stdout' >> /etc/quagga/bgpd.conf" docker exec R3 bash -c "echo 'log stdout' >> /etc/quagga/bgpd.conf" docker exec R4 bash -c "echo 'log stdout' >> /etc/quagga/bgpd.conf" docker exec R1 bash -c "cat /etc/quagga/bgpd.conf" docker exec R2 bash -c "cat /etc/quagga/bgpd.conf" docker exec R3 bash -c "cat /etc/quagga/bgpd.conf" docker exec R4 bash -c "cat /etc/quagga/bgpd.conf" docker exec R1 bash -c "/etc/init.d/quagga restart" docker exec R2 bash -c "/etc/init.d/quagga restart" docker exec R3 bash -c "/etc/init.d/quagga restart" docker exec R4 bash -c "/etc/init.d/quagga restart" docker exec R1 bash -c "route" docker exec R2 bash -c "route" docker exec R3 bash -c "route" docker exec R4 bash -c "route" ! BGP configuration for R1 ! hostname R1bgp password vRouter ! router bgp 65001 bgp router-id 172.31.0.2 bgp router-id 172.34.0.3 timers bgp 3 9 neighbor 172.31.0.3 remote-as 65002 neighbor 172.31.0.3 ebgp-multihop neighbor 172.31.0.3 timers connect 5 neighbor 172.31.0.3 advertisement-interval 5 neighbor 172.34.0.2 remote-as 65004 neighbor 172.34.0.2 ebgp-multihop neighbor 172.34.0.2 timers connect 5 neighbor 172.34.0.2 advertisement-interval 5 network 172.21.0.0/16 ! log stdout ``` ## Final mininet ```conf # dhcpd.conf default-lease-time 600; max-lease-time 7200; ddns-update-style none; subnet 10.0.2.0 netmask 255.255.0.0 { range 10.0.2.100 10.0.2.200; } ``` ```shell sudo python topo.py ``` onos ```shell # onos create app up to 30 min onos-create-app app nctu.winlab vlanbasedsr 1.0-SNAPSHOT nctu.winlab.vlanbasedsr cd vlanbasedsr ``` ```shell mvn clean install -DskipTests onos-app localhost install! target/vlanbasedsr-1.0-SNAPSHOT.oar onos-app localhost uninstall nctu.winlab.vlanbasedsr onos-app localhost reinstall! nctu.winlab.vlanbasedsr target/vlanbasedsr-1.0-SNAPSHOT.oar ``` ```shell= # [0] [mininet] clean sudo mn -c # [1] [onos-app] set project path # [1] [mininet] set project path export LAB="/home/akiicat/Desktop/Final" # [2] [onos] run cd $ONOS_ROOT bazel run onos-local -- clean debug # [3] [mininet] topoloy cd $LAB/mininetTopology cat dhcpd.conf sudo python topo.py # [4] [onos-app] install unicast dhcp cd $LAB/unicastdhcp ./rebuild.sh # [5] [mininet] h5 dhclient -v h5-eth0 h5 ping -c 1 h4 # failed: packet in # [6] [onos-app] install proxy arp cd $LAB/ProxyArp ./rebuild.sh # [7] [onos-app] install vlanbasedsr cd $LAB/vlanbasedsr ./rebuild.sh # [8] [mininet] testing h5 ping -c 4 h3 h1 h5 ping -c 4 h1 ```