UTM icon indicating copy to clipboard operation
UTM copied to clipboard

Unclear when to use port forwarding and what the network modes mean

Open adagioNeo opened this issue 2 years ago • 9 comments

UTM is awesome but the Guest to Host as well as Host to Guest seem to have issues when connecting, and there is no proper documentation since I am using it in my new M1 Mac

I am trying to run docker in ubuntu since I cannot run x86_64 based images on my PC. I wanted to use UTM for running docker containers in Guest OS on a specific port (Eg: 8000) and access this service from the HOST OS (viz, MacOS). Even though I got the docker container to be Up and Healthy, the services are not accessible by the Host OS, I have tried almost all configuration and don't seem to find any resolution

adagioNeo avatar Nov 26 '21 15:11 adagioNeo

If you choose "bridged" network mode, your VM will get an IP on your Mac's LAN and you will need to access your guest's services via that IP.

It you choose "emulated VLAN" network mode, the VM will get a virtual LAN and IP in the 10.0.2.X range. To access services in it you will need to use the Port Forwarding section in the Network config.

Hope this helps! Agree on lack of documentation for this.

conath avatar Nov 28 '21 16:11 conath

So I have Ubuntu 18 Server version installed in my UTM

  • when using emulated LAN, I run docker run -p 2000:xxxx image and forwarding Ports :3000(host) to :2000(Guest) throws the docker to Unhealthy status.
  • when using Bridged LAN, the VM crashes sometimes with QEMU crashed unexpectedly error when I run the docker, other times docker container just goes into Exited status

adagioNeo avatar Nov 29 '21 20:11 adagioNeo

@adagioNeo Thanks for testing the network modes.

Please create a new issue for each of the new problems, including logs from Docker, QEMU crash log (if available) and UTM Debug Log. Regarding the Bridged Mode: please include in your issue whether the crash/exited happens randomly or depending on what steps you take in the guest. Thank you!

conath avatar Nov 30 '21 01:11 conath

It you choose "emulated VLAN" network mode, the VM will get a virtual LAN and IP in the 10.0.2.X range. To access services in it you will need to use the Port Forwarding section in the Network config.

When you say "to access services in it," what does that entail? I see where IP Configuration and Port Forward is in Network Settings, but what would I change 10.02.XX to to actually connect?

ap46281 avatar Jun 06 '22 00:06 ap46281

@conath Can you describe what the difference is between "Emulated VLAN" and "Shared Network"?

unphased avatar Jun 29 '22 04:06 unphased

@unphased If you choose "bridged" network mode, your VM will get an IP on your Mac's LAN and you will need to access your guest's services via that IP.

If you choose "shared" network mode, your VM will get a private IP in a virtual subnet, but will be able to access the host and the internet. It will not be visible to other computers on the host LAN and vice versa.

It you choose "emulated VLAN" network mode (QEMU backend only), the VM will get a virtual LAN and IP in the 10.0.2.X range. To access services in it you will need to use the Port Forwarding section in the Network config.

conath avatar Jul 01 '22 06:07 conath

I am running Ubuntu 22.04 on the new Mac M1 via UTM, and when I connect to VPN via Open VPN, on my physical machine, it does not share the connection with the Ubuntu VM, any idea how this can be achieved? Cheers

martinsagat avatar Aug 23 '22 03:08 martinsagat

I am running Ubuntu 22.04 on the new Mac M1 via UTM, and when I connect to VPN via Open VPN, on my physical machine, it does not share the connection with the Ubuntu VM, any idea how this can be achieved? Cheers

Hey! Did you find any solution? I'm totally stuck with this issue. At this moment I'm trying to use emulated VLAN, but looks like it works intermittently. And another issue is I'm not able to reach my VM server from local (WiFi) network. That is drive me crazy, so I'm almost buy mini-PC for this purpose.

GeoSD avatar Jan 30 '23 05:01 GeoSD

I am running Ubuntu 22.04 on the new Mac M1 via UTM, and when I connect to VPN via Open VPN, on my physical machine, it does not share the connection with the Ubuntu VM, any idea how this can be achieved? Cheers

This is what I found on the website CLICK which works for me for ssh connection from my M1 terminal after I set up a ubuntu virtual machine through UTM

david11yf29 avatar Dec 11 '23 05:12 david11yf29