Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to ping VM from host with vzNAT network, lima0 has no IPv4 address #3100

Closed
jrajahalme opened this issue Jan 9, 2025 Discussed in #3094 · 2 comments
Closed

Unable to ping VM from host with vzNAT network, lima0 has no IPv4 address #3100

jrajahalme opened this issue Jan 9, 2025 Discussed in #3094 · 2 comments

Comments

@jrajahalme
Copy link

Discussed in #3094

Originally posted by jrajahalme January 6, 2025

Description

limactl version 1.0.3
macOS 14.7.2 / Macbook Pro M3

According to the docs (https://lima-vm.io/docs/config/network/) vzNAT network should be able to "Connect to the VM IP from Host". I have a Ubuntu 22.04 VM running with the vz driver and vzNAT network.

In the VM, the only IP address that looks like it could be routable (locally) is on eth0 (no IPv4 address on lima0):

$ ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:55:55:a9:bf:8d brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.15/24 metric 200 brd 192.168.5.255 scope global dynamic eth0
       valid_lft 3529sec preferred_lft 3529sec
    inet6 fe80::5055:55ff:fea9:bf8d/64 scope link
       valid_lft forever preferred_lft forever

$ ip addr show dev lima0
3: lima0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:55:55:b9:10:e0 brd ff:ff:ff:ff:ff:ff
    inet6 fd2c:49b2:7e20:a3c8:5055:55ff:feb9:10e0/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 2591944sec preferred_lft 604744sec
    inet6 fe80::5055:55ff:feb9:10e0/64 scope link
       valid_lft forever preferred_lft forever

On the host:

 % ping 192.168.5.15
PING 192.168.5.15 (192.168.5.15): 56 data bytes
92 bytes from internetbox.home (192.168.1.1): Destination Net Unreachable
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  5  00 5400 5533   0 0000  40  01 9dac 192.168.1.106  192.168.5.15
 
 % ifconfig | grep 192.168.
        inet 192.168.1.106 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.106.1 netmask 0xffffff00 broadcast 192.168.106.255

So there is no network device on 192.168.5 in the host.

@nirs
Copy link
Member

nirs commented Jan 13, 2025

In the VM, the only IP address that looks like it could be routable (locally) is on eth0 (no IPv4 address on lima0):

$ ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:55:55:a9:bf:8d brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.15/24 metric 200 brd 192.168.5.255 scope global dynamic eth0
...
$ ip addr show dev lima0
3: lima0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:55:55:b9:10:e0 brd ff:ff:ff:ff:ff:ff
    inet6 fd2c:49b2:7e20:a3c8:5055:55ff:feb9:10e0/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 2591944sec preferred_lft 604744sec
    inet6 fe80::5055:55ff:feb9:10e0/64 scope link
       valid_lft forever preferred_lft forever

eth0 is the special user networking 192.168.5.15 which is not accessible from the host. This is used for accessing the lima builtin dhcp server.

On the host:

 % ping 192.168.5.15
PING 192.168.5.15 (192.168.5.15): 56 data bytes
92 bytes from internetbox.home (192.168.1.1): Destination Net Unreachable
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  5  00 5400 5533   0 0000  40  01 9dac 192.168.1.106  192.168.5.15
 
 % ifconfig | grep 192.168.
        inet 192.168.1.106 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.106.1 netmask 0xffffff00 broadcast 192.168.106.255

So there is no network device on 192.168.5 in the host.

Yes, this is expected.

The issue is the vzNAT - you should have an ip address in the guest on lima0.

This is how it works on macOS 15.2:

% limactl start --plain --network vzNAT template://default 
...
% limactl shell default ip a
...
3: lima0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:55:55:a0:24:94 brd ff:ff:ff:ff:ff:ff
    inet 192.168.106.5/24 metric 100 brd 192.168.106.255 scope global dynamic lima0
       valid_lft 494sec preferred_lft 494sec
    inet6 fd5c:e2dd:16f9:7b85:5055:55ff:fea0:2494/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 2591913sec preferred_lft 604713sec
    inet6 fe80::5055:55ff:fea0:2494/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever

% ping 192.168.106.5
PING 192.168.106.5 (192.168.106.5): 56 data bytes
64 bytes from 192.168.106.5: icmp_seq=0 ttl=64 time=0.490 ms
64 bytes from 192.168.106.5: icmp_seq=1 ttl=64 time=0.814 ms
^C
--- 192.168.106.5 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.490/0.652/0.814/0.162 ms

This worked also on 14.7 with lima 1.0 and earlier.

@jrajahalme
Copy link
Author

@nirs Thanks, your example worked for me on macOS 14.7.2 as well. And now it works for my other VM as well. Maybe re-starting the VM fixed it, now lima0 has the IPv4 address and I can ping it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants