Last active
August 14, 2017 09:38
-
-
Save LarryStanley/1b4c52abd03ed4c75e33756f35ed844c to your computer and use it in GitHub Desktop.
ryu-sdn-router.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# add bridge | |
ovs-vsctl add-br ovsbr0 | |
#add hosts | |
docker rm container1 | |
docker run --name=container1 --cap-add=NET_ADMIN --net='none' -itd busybox /bin/sh | |
docker rm container2 | |
docker run --name=container2 --cap-add=NET_ADMIN --net='none' -itd busybox /bin/sh | |
#set up hosts ip address and gateway | |
ovs-docker add-port ovsbr0 eth0 container1 --ipaddress=192.168.10.100/24 --gateway=192.168.10.254 | |
ovs-docker add-port ovsbr0 eth0 container2 --ipaddress=172.16.30.100/24 --gateway=172.16.30.254 | |
#launch ryu app with rest_router | |
ryu-manager ryu.app.rest_router | |
#set ryu controller with openvswitch | |
ovs-vsctl set-controller ovsbr0 tcp:127.0.0.1:6633 | |
#set up | |
curl -X POST -d '{"address":"192.168.10.254/24"}' http://localhost:8080/router/0000624d9c632d4e | |
curl -X POST -d '{"address":"172.16.30.254/24"}' http://localhost:8080/router/0000624d9c632d4e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment