diff --git a/gtests/net/packetdrill/net_utils.c b/gtests/net/packetdrill/net_utils.c
index 86ed4caf1205144781866aa26af378149f1750c9..ca2dd3872d27ba25d3b93a42aa379acc030a553f 100644
--- a/gtests/net/packetdrill/net_utils.c
+++ b/gtests/net/packetdrill/net_utils.c
@@ -56,7 +56,7 @@ static void net_add_ipv4_address(const char *dev_name,
 
 #ifdef linux
 	asprintf(&command, "ip addr add %s/%d dev %s > /dev/null 2>&1",
-		 ip_string, prefix_len, dev_name);
+		 local_ip_string, prefix_len, dev_name);
 #endif
 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
 	asprintf(&command, "/sbin/ifconfig %s %s/%d alias",
@@ -82,7 +82,7 @@ static void net_add_ipv6_address(const char *dev_name,
 
 #ifdef linux
 	asprintf(&command, "ip addr add %s/%d dev %s > /dev/null 2>&1",
-		 ip_string, prefix_len, dev_name);
+		 local_ip_string, prefix_len, dev_name);
 #else
 	asprintf(&command, "/sbin/ifconfig %s inet6 %s/%d",
 		 dev_name, local_ip_string, prefix_len);