Docker+ovs

docker run -it --name=h1 -h h1 --privileged=true --net=none be807744496d
docker run -it -d -p 8080:80 --name h5 -h h5 -v /home/shark/website/:/usr/local/apache2/htdocs/ httpd
wget https://raw.githubusercontent.com/openvswitch/ovs/master/utilities/ovs-docker
ovs-vsctl add-br s1
./ovs-docker add-port s2 s1h1 h1 --ipaddress=192.168.1.1/24
./ovs-docker add-port s2 s1h2 h2 --ipaddress=192.168.1.2/24
./ovs-docker add-port s3 s1h3 h3 --ipaddress=192.168.1.3/24
./ovs-docker add-port s3 s1h4 h4 --ipaddress=192.168.1.4/24
./ovs-docker add-port s5 s4h5 h5 --ipaddress=192.168.3.1/24
./ovs-docker add-port s5 s4h6 h6 --ipaddress=192.168.3.2/24
./ovs-docker add-port s6 s4h7 h7 --ipaddress=192.168.3.3/24
./ovs-docker add-port s6 s4h8 h8 --ipaddress=192.168.3.4/24
docker run -it --rm --privileged --name r2 -h r2 --net=none st/myquagga:1.1
docker run -it --rm --privileged --name r3 -h r3 --net=none st/myquagga:1.1
docker run -it --rm --privileged --name r4 -h r4 --net=none st/myquagga:1.1
./ovs-docker add-port s1 s1r1 r1 --ipaddress=192.168.1.5/24
./ovs-docker add-port s4 s4r2 r2 --ipaddress=192.168.3.5/24
./ovs-docker add-port s7 s7r3 r3 --ipaddress=192.168.4.2/24
sudo python3 veth.py
sudo ip netns exec 23166 ip addr add 192.168.2.1/24 dev right_eth
sudo ip netns exec 23488 ip addr add 192.168.2.2/24 dev left_eth

s2

ovs-vsctl set-controller s2 tcp:127.0.0.1:6653
ovs-vsctl add-port s2 s2s1 -- set interface s2s1 type=patch
#ovs-vsctl set interface s2s1 type=patch
ovs-vsctl set interface s2s1 options:peer=s1s2

s1

ovs-vsctl set-controller s1 tcp:127.0.0.1:6653
ovs-vsctl add-port s1 s1s2 -- set interface s1s2 type=patch
#ovs-vsctl set interface s1s2 type=patch
ovs-vsctl set interface s1s2 options:peer=s2s1
ovs-vsctl add-port s1 s1s3 -- set interface s1s3 type=patch
#ovs-vsctl set interface s1s3 type=patch
ovs-vsctl set interface s1s3 options:peer=s3s1

s3

ovs-vsctl set-controller s3 tcp:127.0.0.1:6653
ovs-vsctl add-port s3 s3s1 -- set interface s3s1 type=patch 
#ovs-vsctl set interface s3s1 type=patch
ovs-vsctl set interface s3s1 options:peer=s1s3

s5

ovs-vsctl set-controller s5 tcp:127.0.0.1:6653
ovs-vsctl add-port s5 s5s4 -- set interface s5s4 type=patch
ovs-vsctl set interface s5s4 options:peer=s4s5

s4

ovs-vsctl set-controller s4 tcp:127.0.0.1:6653
ovs-vsctl add-port s4 s4s5 -- set interface s4s5 type=patch
ovs-vsctl set interface s4s5 options:peer=s5s4
ovs-vsctl add-port s4 s4s6 -- set interface s4s6 type=patch
ovs-vsctl set interface s4s6 options:peer=s6s4

s6

ovs-vsctl set-controller s6 tcp:127.0.0.1:6653
ovs-vsctl add-port s6 s6s4 -- set interface s6s4 type=patch
ovs-vsctl set interface s6s4 options:peer=s4s6
iperf -s
iperf -c 192.168.3.1 -t 20

你可能感兴趣的:(docker,linux)