Docker deployment Ryu SDN based environment
Ryu is developed by Japan's NTT company is responsible for the design of an open source SDN controller, and USES the Apache License source protocol standard.Ryu implemented based on the Python language, users can use the Python language on its implement your own application.Ryu currently supported OpenFlow V1.0, V1.2, V1.3, at the same time support the deployment of the application on it.
The basic concept
Mirror Image (Image) : the mirror is a read-only template.Users upload to make a good image for others to download.Users can be based on the image to create the Container.
Containers (Container) : can be understood as an isolated Linux environment, used to run the application, the Namespace can help you to understand.
Warehouse (Repository) : if you will use the Git/lot, it is easy to understand, is the place to hold the mirror.
In this paper, the experimental environment is Ubuntu14.04 - amd64.Very need to note is that, at present the Docker only support 64 - bit machine.Ubuntu14.04 installation method has two kinds: 1) through the system comes installed packages and 2) through the Docker source.Recommend the second option to install a new edition.
sudo apt-get install apt-transport-https
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
sudo bash -c "echo debhttps://get.docker.io/ubuntudocker main > /etc/apt/sources.list.d/docker.list" sudo apt-get update
sudo apt-get install lxc-docker
Access to the mirror
First of all, recommend toDockerAccount, so that we can use to use Git/making Docker/Dockerhub.Registration and landing can be done through the following commands: docker
After registration, you can search by the following commands, such as search ryu: docker search ryu
Can I Star in the search results to determine the stand or fall of resources, so as to find the right images, such as muzixing/ryu.Then use the following command and pull it to the local:
docker pull muzixing/ryu
After the download is complete, can use the following command to view the existing images
Create a container
Create a container to use sample as follows, - t = tty, - I = interactive - d = debug, - p = port, -- the name may be used for naming container.Other commands can be -- help to look at it.
docker run -i -t --name
If you need to port mapping, or network configuration Settings, also need to check carefully the manual.For example, are as follows:
docker run -i -t -p
The above command to create and run a name of the container, and will be the inside of the container port port mapping to a host of a port, to complete the port mapping, allow the network access to the container.This is one of the ways in which container to communication with the outside world.If you want to permanently bound to a fixed IP address, can the Docker specified in the configuration file/etc/default/Docker DOCKER_OPTS = "- IP = IP_ADDRESS", after the restart Docker service can take effect.Set the parameters of the network access by default, the ICC = true, if, the ICC = false, the network access is prohibited.
Check the container:
docker ps [-opt]
- for a full container.
Check the print information can be achieved by:
Suspension of container:
Open to suspend container:
Restart the container:
Sometimes we opened the container, but there is no open window, run in the background, you can through the command into the container: docker attach
The deployment of SDN controller RYU
Acquire the image:
docker pull muzixing/ryu
Then create a container and the container port 6633 is bound to the host port 6633. docker run -i -t -p 0.0.0.0:6633:6633 --name ryu3.15 muzixing/ryu:SDN /bin/bash
After entering the container, run ryu.
In another run on the machine can run ping container host mininet, the diagram below:
As can be seen from the above controller IP is 172.16.192.128.The IP address of the
host network adapter information is as follows:
Can be seen from the chart, is the host of communicating with the mininet (actual case
will be a server) eth0 address.But from the following figure container information, it can be
seen running RYU address is 172.17.0.5.Why can communication?
The container information
Because do port mapping, the host of all the 6633 port address of the interface 172.17.0.5 forwarded to the container port 6633, so as to complete data communication.Its implementation principle is: Docker after launch, will create a docker0 bridge, from the picture above you can see, and then also creates veth pair.One side mounted on the bridge, pictured above vethba5f9f3, container at one end of the network card eth0, this case is 172.17.0.5 card.In fact this is with a link.Docker network communication principle diagram is as follows:
The principle diagram of the Docker network communication
In the operation of the container on a host using iptables command to see NAT rules:
The iptables see NAT
Similarly mininet, or other applications can also use container deployment, needless, readers are free to try.
Upload the image
First you need to deploy the application containers exported as tar file.You can use the docker export container > the file command.For example, are as follows: docker export ryu3.15 > ryu.tar
Then use the docker the import command import it into image:
cat ryu.tar | sudo docker import - muzixing/ryu:sdn
The above command to read ryu. Tar import it into a muzixing/ryu: image of SDN.After can see through the docker images.
Be sure, it can be pushed to the Dockerhub.
docker push muzixing/ryu
Readers can also try a better way of automatically created.