diff --git a/test/README.md b/test/README.md
index 99e91bb8..9d7cbdc7 100644
--- a/test/README.md
+++ b/test/README.md
@@ -33,8 +33,8 @@ to run everything named `*_test.sh`.
By default the tests assume the Vagrant VMs are used.
-To use other VMs, set the environment variables HOST1 and
-HOST2 to the IP addresses of two docker hosts, and set the
+To use other VMs, set the environment variable HOSTS to the
+space-separated list of IP addresses of the docker hosts, and set the
environment variable SSH to a command that will log into
either (which may just be `ssh`).
diff --git a/test/config.sh b/test/config.sh
index 7acba9ec..9bd15125 100644
--- a/test/config.sh
+++ b/test/config.sh
@@ -7,15 +7,16 @@ N_MACHINES=${N_MACHINES:-2}
IP_PREFIX=${IP_PREFIX:-192.168.48}
IP_SUFFIX_BASE=${IP_SUFFIX_BASE:-10}
-HOSTS=
-for i in $(seq 1 $N_MACHINES); do
- IP="${IP_PREFIX}.$((${IP_SUFFIX_BASE}+$i))"
- HOSTS="$HOSTS $IP"
-done
+if [ -z "$HOSTS" ] ; then
+ for i in $(seq 1 $N_MACHINES); do
+ IP="${IP_PREFIX}.$((${IP_SUFFIX_BASE}+$i))"
+ HOSTS="$HOSTS $IP"
+ done
+fi
# these are used by the tests
-HOST1="${IP_PREFIX}.$((${IP_SUFFIX_BASE}+1))"
-HOST2="${IP_PREFIX}.$((${IP_SUFFIX_BASE}+2))"
+HOST1=$(echo $HOSTS | cut -f 1 -d ' ')
+HOST2=$(echo $HOSTS | cut -f 2 -d ' ')
. ./assert.sh