colima icon indicating copy to clipboard operation
colima copied to clipboard

Can't ping host machine from VM

Open Atemu opened this issue 3 years ago • 7 comments

Description

I've got a stupidly architected container app that can't separate concerns properly that tries to do internal API calls over the same address external ones go through.

This is incredibly stupid of course but it should still work. With colima however, it doesn't: I'm unable to reach my host via its external IP address which also means the app can't. I get internal API calls working or external ones and I need internal ones to be working for external ones to make sense.

Version

Colima Version: 0.4.4 Lima Version: 11.1 Qemu Version: 7.0.0

colima version 0.4.4 git commit: 8bb1101

runtime: docker arch: aarch64 client: v20.10.17 server: v20.10.11

Operating System

  • [ ] macOS Intel
  • [X] macOS M1
  • [ ] Linux

Reproduction Steps

  1. colima ssh
  2. ping <ip of host> (i.e. 192.168.178.116)

Expected behaviour

It should respond to pings and other network traffic.

Additional context

No response

Atemu avatar Aug 05 '22 17:08 Atemu

The Lima VM is on its own subnet, iirc something like 192.168.0.5. I wouldn't be surprised if there is no route to your 192.168 1.xxx IP.

You should be able to add such route either with the ip command or through the Lima configuration files (this isn't a Colima problem as you might have guessed, but a Lima misconfiguration on your side).

SuperFola avatar Aug 06 '22 09:08 SuperFola

How would I go about doing that?

Atemu avatar Aug 06 '22 13:08 Atemu

I'm unable to reach my host via its external IP address

What do you mean by external IP of the host? Within the LAN or publicly reachable over the internet?

abiosoft avatar Aug 06 '22 13:08 abiosoft

Within the LAN; the host's interface's address.

Atemu avatar Aug 06 '22 15:08 Atemu

The host is available at fixed IP address 192.168.5.2 and both host.lima.internal and host.docker.internal hostnames.

Is there a way you can configure that? The VM is totally oblivious of the host IP address.

abiosoft avatar Aug 07 '22 22:08 abiosoft

Neither of those are going to work both in the VM and the host.

I need to be able to access the same address from my browser, another device and from inside the VM.

Atemu avatar Aug 09 '22 12:08 Atemu

It might be doable, but it will require the user to specify specific IP address(es) that basically maps to the host IP.

abiosoft avatar Aug 11 '22 16:08 abiosoft