Hi all, [ MY ENVIRONMENT ]
$ uname -r 3.13.0-40-generic $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.1 LTS Release: 14.04 Codename: trusty $ dpkg -l | grep -i 'openvswitch\|docker' | awk -F " " '{ print $2 " " $3 }' lxc-docker 1.3.2 lxc-docker-1.3.2 1.3.2 openvswitch-common 2.0.2-0ubuntu0.14.04.1 openvswitch-controller 2.0.2-0ubuntu0.14.04.1 openvswitch-pki 2.0.2-0ubuntu0.14.04.1 openvswitch-switch 2.0.2-0ubuntu0.14.04.1 $ ovs-vsctl -V ovs-vsctl (Open vSwitch) 2.0.2 Compiled Aug 15 2014 14:31:02 $ docker version Client version: 1.3.2 Client API version: 1.15 Go version (client): go1.3.3 Git commit (client): 39fa2fa OS/Arch (client): linux/amd64 Server version: 1.3.2 Server API version: 1.15 Go version (server): go1.3.3 Git commit (server): 39fa2fa $ grep -v ^# /etc/default/docker DOCKER_OPTS="--bridge=br0 --dns 8.8.8.8 --dns 208.67.222.222" $ sudo ovs-vsctl show bff165bb-05af-4fb2-a045-fd6208beaf6a Bridge "br0" Port "br0" Interface "br0" type: internal Port "eth0" Interface "eth0" ovs_version: "2.0.2" $ cat /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet manual pre-up ifconfig $IFACE up post-down ifconfig $IFACE down auto br0 iface br0 inet static address 172.16.114.130 netmask 255.255.255.0 gateway 172.16.114.2 $ hostname -I 172.16.114.130 $ ip route show default via 172.16.114.2 dev br0 172.16.114.0/24 dev br0 proto kernel scope link src 172.16.114.130 $ docker images | grep bintut bintut/trusty 0.1 71a5c11bdd60 2 days ago 429.3 MB $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $ docker run --net=none -t -i bintut/trusty:0.1 /sbin/my_init -- bash -l *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh... *** Running /etc/rc.local... *** Booting runit daemon... *** Runit started as PID 12 *** Running bash -l... $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 45ebe83a614b bintut/trusty:0.1 "/sbin/my_init -- ba About a minute ago Up About a minute naughty_bohr $ docker attach 45ebe83a614b root@45ebe83a614b:/# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) [ MY TEST ] $ sudo ./ovs-docker ovs-docker: Performs integration of Open vSwitch with Docker. usage: ovs-docker COMMAND Commands: add-port BRIDGE INTERFACE CONTAINER [ADDRESS] [GATEWAY] Adds INTERFACE inside CONTAINER and connects it as a port in Open vSwitch BRIDGE. Optionally, sets ADDRESS on INTERFACE. ADDRESS can be in CIDR notation which include a '/' to represent network prefix length. GATEWAY is the default gateway IP address of the given ADDRESS. e.g.: ovs-docker add-port br-int eth1 c474a0e2830e 192.168.1.2/24 del-port BRIDGE INTERFACE CONTAINER Deletes INTERFACE inside CONTAINER and removes its connection to Open vSwitch BRIDGE. e.g.: ovs-docker del-port br-int eth1 c474a0e2830e del-ports BRIDGE CONTAINER Removes all Open vSwitch interfaces from CONTAINER. e.g.: ovs-docker del-ports br-int c474a0e2830e Options: -h, --help display this help message. $ sudo ./ovs-docker add-port br0 eth0 45ebe83a614b 172.16.114.140/24 172.16.114.2 $ sudo ovs-vsctl show bff165bb-05af-4fb2-a045-fd6208beaf6a Bridge "br0" Port "58e77188bcba4_l" Interface "58e77188bcba4_l" Port "br0" Interface "br0" type: internal Port "eth0" Interface "eth0" ovs_version: "2.0.2" $ docker attach 45ebe83a614b root@45ebe83a614b:/# ifconfig eth0 Link encap:Ethernet HWaddr de:33:af:81:57:dc inet addr:172.16.114.140 Bcast:0.0.0.0 Mask:255.255.255.0 inet6 addr: fe80::dc33:afff:fe81:57dc/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:648 (648.0 B) TX bytes:648 (648.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) root@45ebe83a614b:/# ip route show default via 172.16.114.2 dev eth0 172.16.114.0/24 dev eth0 proto kernel scope link src 172.16.114.140 root@45ebe83a614b:/# ping -c 3 www.google.com PING www.google.com (74.125.68.103) 56(84) bytes of data. 64 bytes from 74.125.68.103: icmp_seq=1 ttl=128 time=4.83 ms 64 bytes from 74.125.68.103: icmp_seq=2 ttl=128 time=6.12 ms 64 bytes from 74.125.68.103: icmp_seq=3 ttl=128 time=5.28 ms --- www.google.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2004ms rtt min/avg/max/mdev = 4.831/5.414/6.125/0.535 ms [ MY PATCH ] 49a50 > GATEWAY="$5" 92a94,97 > > if [ -n "$GATEWAY" ]; then > ip netns exec "$PID" ip route add default via "$GATEWAY" > fi 145c150 < add-port BRIDGE INTERFACE CONTAINER [ADDRESS] --- > add-port BRIDGE INTERFACE CONTAINER [ADDRESS] [GATEWAY] 148,149c153,155 < INTERFACE. ADDRESS can include a '/' to represent network < prefix length. e.g.: --- > INTERFACE. ADDRESS can be in CIDR notation which include a > '/' to represent network prefix length. GATEWAY is the > default gateway IP address of the given ADDRESS. e.g.:
_______________________________________________ discuss mailing list discuss@openvswitch.org http://openvswitch.org/mailman/listinfo/discuss