使用docker创建并启动四个容器,–net=none可以防止docker默认网桥影响连通性测试
docker run -itd –name con1 –net=none ubuntu:14.04 /bin/bash
docker run -itd –name con2 –net=none ubuntu:14.04 /bin/bash
docker run -itd –name con3 –net=none ubuntu:14.04 /bin/bash
docker run -itd –name con4 –net=none ubuntu:14.04 /bin/bash
创建网桥
ovs-vsctl add-br br0
给容器添加网卡,并挂载到br0上
ovs-docker add-port br0 eth0 con1 –ipaddress=10.10.1.2/24
ovs-docker add-port br0 eth0 con2 –ipaddress=10.10.1.3/24
ovs-docker add-port br0 eth0 con3 –ipaddress=10.10.1.4/24
ovs-docker add-port br0 eth0 con4 –ipaddress=10.10.1.5/24
查看网桥
ovs-vsctl show
查看interface
ovs-ofctl list interface \”6c47322012c04_l\”
划分vlan
ovs-vsctl set port \”6d52446099b44_l\” tag=100
ovs-vsctl set port \”6c47322012c04_l\” tag=100
ovs-vsctl set port \”0c1ea218ff794_l\” tag=200
ovs-vsctl set port \”6de3e4f74e214_l\” tag=200
登录con1测试连通性