diff --git a/README.md b/README.md index 1f00d615..a9a6ab60 100644 --- a/README.md +++ b/README.md @@ -92,10 +92,11 @@ We repeat similar steps on `$HOST2`... The only difference, apart from the choice of IP address for the application container, is that we tell our weave that it should peer -with the weave on `$HOST1` (specified as the IP address or hostname, and -optional `:port`, by which `$HOST2` can reach it). NB: if there is a -firewall between `$HOST1` and `$HOST2`, you must open port 6783 for TCP -and UDP. +with the weave on `$HOST1` (specified as the IP address or hostname, +and optional `:port`, by which `$HOST2` can reach it). NB: if there is +a firewall between `$HOST1` and `$HOST2`, you must open the weave port +(6783 by default; this can be overriden by setting `WEAVE_PORT`) for +TCP and UDP. Note that we could instead have told the weave on `$HOST1` to connect to `$HOST2`, or told both about each other. Order does not matter here; diff --git a/site/features.md b/site/features.md index de64420f..cf96f48f 100644 --- a/site/features.md +++ b/site/features.md @@ -316,7 +316,10 @@ data centres. So, for example, one could run an application consisting of containers on GCE, EC2 and in local data centres. To enable this, the network must be configured to permit TCP and UDP -connections to port 6783 of the docker hosts. +connections to the weave port of the docker hosts. The weave port +defaults to 6783. This can be overriden by setting `WEAVE_PORT`, but +it is highly recommended that all peers in a weave network are given +the same port setting. ### Multi-hop routing diff --git a/weave b/weave index d3b6d339..cb54e436 100755 --- a/weave +++ b/weave @@ -59,6 +59,7 @@ exec_remote() { -e WEAVE_DOCKER_ARGS \ -e WEAVEDNS_DOCKER_ARGS \ -e WEAVE_PASSWORD \ + -e WEAVE_PORT \ -e WEAVE_CONTAINER_NAME \ -e DOCKER_BRIDGE \ -e PROCFS=/hostproc --privileged --net=host \ @@ -86,7 +87,7 @@ DNS_CONTAINER_NAME=weavedns BRIDGE=weave CONTAINER_IFNAME=ethwe MTU=65535 -PORT=6783 +PORT=${WEAVE_PORT:-6783} HTTP_PORT=6784 DNS_HTTP_PORT=6785 @@ -610,6 +611,7 @@ case "$COMMAND" in shift 1 fi NICKNAME=$(hostname) + CONTAINER_PORT=$PORT while true; do case "$1" in -password) @@ -623,6 +625,11 @@ case "$COMMAND" in NICKNAME="$2" shift 2 ;; + -port) + [ $# -gt 1 ] || usage + CONTAINER_PORT="$2" + shift 2 + ;; *) break ;; @@ -632,8 +639,8 @@ case "$COMMAND" in # additional parameters, such as resource limits, to docker # when launching the weave container. CONTAINER=$(docker run --privileged -d --name=$CONTAINER_NAME \ - -p $PORT:$PORT/tcp -p $PORT:$PORT/udp -e WEAVE_PASSWORD \ - $WEAVE_DOCKER_ARGS $IMAGE -iface $CONTAINER_IFNAME -name $MACADDR -nickname "$NICKNAME" "$@") + -p $PORT:$CONTAINER_PORT/tcp -p $PORT:$CONTAINER_PORT/udp -e WEAVE_PASSWORD \ + $WEAVE_DOCKER_ARGS $IMAGE -iface $CONTAINER_IFNAME -port $CONTAINER_PORT -name $MACADDR -nickname "$NICKNAME" "$@") with_container_netns $CONTAINER launch >/dev/null wait_for_status $CONTAINER_NAME $HTTP_PORT echo $CONTAINER