Skip to content

Commit

Permalink
ovs-docker: Ability to set the default gateway.
Browse files Browse the repository at this point in the history
ovs-docker currently lets one add the ability to set the
IP address on an OVS interface. Ability to set the default
gateway too can be an useful addition. (orchestrators
who plan to use OVS interfaces can do this from a single
utility instead of multiple utilities)

Requested-by: Marvin Pascual <[email protected]>
Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Thomas Graf <[email protected]>
  • Loading branch information
shettyg committed Dec 15, 2014
1 parent 7894385 commit a14bf25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ Luca Falavigna [email protected]
Luiz Henrique Ozaki [email protected]
Marco d'Itri [email protected]
Martin Vizvary [email protected]
Marvin Pascual [email protected]
Maxime Brun [email protected]
Michael A. Collins [email protected]
Michael Hu [email protected]
Expand Down
13 changes: 10 additions & 3 deletions utilities/ovs-docker
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ add_port () {
INTERFACE="$2"
CONTAINER="$3"
ADDRESS="$4"
GATEWAY="$5"

if [ "$#" -lt 3 ]; then
usage
Expand Down Expand Up @@ -90,6 +91,10 @@ add_port () {
if [ -n "$ADDRESS" ]; then
ip netns exec "$PID" ip addr add "$ADDRESS" dev "$INTERFACE"
fi

if [ -n "$GATEWAY" ]; then
ip netns exec "$PID" ip route add default via "$GATEWAY"
fi
}

del_port () {
Expand Down Expand Up @@ -142,12 +147,14 @@ ${UTIL}: Performs integration of Open vSwitch with Docker.
usage: ${UTIL} COMMAND
Commands:
add-port BRIDGE INTERFACE CONTAINER [ADDRESS]
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 include a '/' to represent network
prefix length. e.g.:
${UTIL} add-port br-int eth1 c474a0e2830e 192.168.1.2/24
prefix length. Along with ADDRESS, optionally set the
default gateway for the container. e.g.:
${UTIL} add-port br-int eth1 c474a0e2830e 192.168.1.2/24 \
192.168.1.1
del-port BRIDGE INTERFACE CONTAINER
Deletes INTERFACE inside CONTAINER and removes its
connection to Open vSwitch BRIDGE. e.g.:
Expand Down

0 comments on commit a14bf25

Please sign in to comment.