diff --git a/lib/virtual-net/src/host.rs b/lib/virtual-net/src/host.rs index 0866f1a20f3..4885d81728f 100644 --- a/lib/virtual-net/src/host.rs +++ b/lib/virtual-net/src/host.rs @@ -92,7 +92,12 @@ impl VirtualNetworking for LocalNetworking { port: Option, dns_server: Option, ) -> Result> { - tokio::net::lookup_host(host) + let host_to_lookup = if host.contains(':') { + host.to_string() + } else { + format!("{}:{}", host, port.unwrap_or(0)) + }; + tokio::net::lookup_host(host_to_lookup) .await .map(|a| a.map(|a| a.ip()).collect::>()) .map_err(io_err_into_net_error)