Skip to content

Commit

Permalink
ovs-docker: Ability to set the MTU of the container interface.
Browse files Browse the repository at this point in the history
When containers are connected to a OVS bridge and tunnels
are created, it makese sense to reduce the MTU of the interafce.

Reported-by: Aurélien Poulai <[email protected]>
Signed-off-by: Gurucharan Shetty <[email protected]>
  • Loading branch information
shettyg committed May 27, 2015
1 parent 05444f0 commit 6dd3cc3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ Anuprem Chalvadi [email protected]
Ariel Tubaltsev [email protected]
Arkajit Ghosh [email protected]
Atzm Watanabe [email protected]
Aurélien Poulain [email protected]
Bastian Blank [email protected]
Ben Basler [email protected]
Bob Ball [email protected]
Expand Down
6 changes: 3 additions & 3 deletions INSTALL.Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ and then attaches it to the Open vSwitch bridge 'br-int'. This is done by
creating a veth pair. One end of the interface becomes 'eth1' inside the
container and the other end attaches to 'br-int'.

The script also lets one to add IP address, MAC address and Gateway address to
the interface. e.g.:
The script also lets one to add IP address, MAC address, Gateway address and
MTU for the interface. e.g.:

```
% ovs-docker add-port br-int eth1 $CONTAINER_ID --ipaddress=192.168.1.2/24 \
--macaddress=a2:c3:0d:49:7f:f8 --gateway=192.168.1.1
--macaddress=a2:c3:0d:49:7f:f8 --gateway=192.168.1.1 --mtu=1450
```

* A previously added network interface can be deleted. e.g.:
Expand Down
15 changes: 12 additions & 3 deletions utilities/ovs-docker
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ add_port () {
GATEWAY=`expr X"$1" : 'X[^=]*=\(.*\)'`
shift
;;
--mtu=*)
MTU=`expr X"$1" : 'X[^=]*=\(.*\)'`
shift
;;
*)
echo >&2 "$UTIL add-port: unknown option \"$1\""
exit 1
Expand Down Expand Up @@ -137,6 +141,10 @@ add_port () {
ip netns exec "$PID" ip link set dev "${PORTNAME}_c" name "$INTERFACE"
ip netns exec "$PID" ip link set "$INTERFACE" up

if [ -n "$MTU" ]; then
ip netns exec "$PID" ip link set dev "$INTERFACE" mtu "$MTU"
fi

if [ -n "$ADDRESS" ]; then
ip netns exec "$PID" ip addr add "$ADDRESS" dev "$INTERFACE"
fi
Expand Down Expand Up @@ -216,14 +224,15 @@ usage: ${UTIL} COMMAND
Commands:
add-port BRIDGE INTERFACE CONTAINER [--ipaddress="ADDRESS"]
[--gateway=GATEWAY] [--macaddress="MACADDRESS"]
[--mtu=MTU]
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. Optionally, sets a GATEWAY and a MACADDRESS.
e.g.:
prefix length. Optionally, sets a GATEWAY, MACADDRESS
and MTU. e.g.:
${UTIL} add-port br-int eth1 c474a0e2830e
--ipaddress=192.168.1.2/24 --gateway=192.168.1.1
--macaddress="a2:c3:0d:49:7f:f8"
--macaddress="a2:c3:0d:49:7f:f8" --mtu=1450
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 6dd3cc3

Please sign in to comment.