diff --git a/test/sharness/t0101-iptb-name.sh b/test/sharness/t0101-iptb-name.sh
index b0c1bc06eb4d16bb84410d0c33aec751c39055a9..88632d0d14e07ffa5a893b8b5bd099e07ca3435a 100755
--- a/test/sharness/t0101-iptb-name.sh
+++ b/test/sharness/t0101-iptb-name.sh
@@ -10,8 +10,10 @@ test_description="Test ipfs repo operations"
 
 export IPTB_ROOT="`pwd`/.iptb"
 
+
 test_expect_success "set up an iptb cluster" '
-	iptb -n=4 -p=9000 init &&
+	IPTB_PORT=$((RANDOM % 10000 + 22000)) &&
+	iptb -n=4 "-p=$IPTB_PORT" init &&
 	iptb -wait start
 '
 
diff --git a/test/sharness/t0130-multinode.sh b/test/sharness/t0130-multinode.sh
index b193392dba4b2d21efefba6c1fdc1e630460c284..2d0cde475816fad5838bae42f9639e41585cb488 100755
--- a/test/sharness/t0130-multinode.sh
+++ b/test/sharness/t0130-multinode.sh
@@ -11,7 +11,8 @@ test_description="Test multiple ipfs nodes"
 export IPTB_ROOT="`pwd`/.iptb"
 
 test_expect_success "set up a few nodes" '
-	iptb -n=3 -p=9200 init &&
+	IPTB_PORT=$((RANDOM % 10000 + 22000)) &&
+	iptb -n=3 "-p=$IPTB_PORT" init &&
 	iptb -wait start
 '