-
Notifications
You must be signed in to change notification settings - Fork 660
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
Port forwarding #309
Comments
Possible w/
Notes:
|
Can I also request another feature?
|
@JonTheNiceGuy that would be #118 - remember we need to be able to support the features across all of the hypervisors, not everywhere it is as easy as this :) |
Fair comment :) |
The ssh command posted above has slightly changed:
Resulting in:
|
In addition to using the SSH tools, I've found it to be very helpful for server use cases to use nginx as well, for the use case of hosting multipass VM's from a headless ubuntu server. e.g. I'm running a rails webserver in a multipass VM on port 3000, and will link that with ssh onto port 9000 on my host, and be able to connect to my host from anywhere at 1. Link multipass to host
2. Enable access to multipass externally from hostNow using nginx, I'm going to connect to port 9000 using the host's IP and expose that on port 8080 for external connections.
|
@ktemby if you have |
@Saviq no, this doesn't work for me. I think this is the point of multipass port forwarding being a limitation. While I can hit an IP, I can't tunnel to the port the server runs on without SSH.
It's easiest to repro the use case by running multipass VM's on a remote machine, then trying to view the webservers. This is how I imagine i'll use multipass for a home server cluster. |
More likely your rails webserver only listens on |
Could be the case - but this is the vanilla rails config. I also can't curl port 80 from nginx running on the multipass VM either. As a non-expert, I like it when the tools just work without too much config... which is why I generally have been excited to find multipass! |
Since |
@icokk sure, that's the rough approach we're likely to take, we just never got to it yet. |
When I try this it asks for the password. Even after setting a password for user ubuntu and using that it fails to log in. |
@mikeubell it's best to import your own SSH key, no need to reach for the Multipass one. Password SSH is disabled by default. You can enable it manually or set it all up through cloud-init: https://cloudinit.readthedocs.io/en/latest/topics/modules.html#set-passwords |
@Saviq Thanks. I found a simpler solution: |
@mikeubell but how does it give you access to the services inside the instance? The line you wrote SSH's into your own host? If you have access to the instance directly, why do you need to do port forwarding? |
I am running a web server in the instance that I need to access from outside the host. The ssh line forwards the port on that host to the port on the instance.
… On Nov 2, 2021, at 4:09 AM, Michał Sawicz ***@***.***> wrote:
@mikeubell but how does it give you access to the services inside the instance? The line you wrote SSH's into your own host? If you have access to the instance directly, why do you need to do port forwarding?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Seriously? I don't understand that why everyone else is just talking about the SSH tunneling. That is just a temporary solution to open the port, for a quick dev or testing environment. Isn't doing a port forward for VM is a super common use case? |
@kycfeel outside of VirtualBox you get direct IP access to the instance. And even with that you can use |
Hello. So is there any deadline or approximative time frame when this will be finished? As an alternative I was just trying to understand the
|
Ok, now I'm starting to get it. There's a local network created just for this, it's not a bridge that allows the VM to connect to your network - that's why I think this is rather ambiguous and it should be made clear in my opinion. Any way I can assign a static IP to the virtual machine? |
Hi @lethargosapatheia, when you provide a If you want it to have a static IP, you need to configure that yourself on your network (e.g. you could configure your router to always provide the same IP to the right MAC address). You can specify a MAC address in your
Have a look here for more info. Hope this helps. |
FYI, VS Code does dynamic port forwarding, recognizing all the remote ports being used via ssh and automatically forwarding these back to local. There is probably an ssh setting that can do this in .ssh/config on your local. |
That would be just ssh tunnelling. I guess the consequence is the same, but it's still not port forwarding in the classical sense. @ricab You mean to say, there's a dhcp server running inside the virtual machine, so inside Ubuntu? How is that called? I thought the dhcp ran somehow on the host's side. |
@lethargosapatheia no no, I meant the client side of it. With BTW, if you want to parse, you can use the |
Indeed. It would be reverse tunneling with socks proxy. NAT would give similar behavior in passing traffic through host to take advantage of network access. But a nice feature of vscode dynamic port forwarding and even wsl2 is WebApps appear on localhost. No need to edit url for the current IP of multipass vm to get it to work. I came across this thread because I was looking for ways to make multipass act a little more like wsl2. I'd like to use this with cloud-init to give a day zero dev box to software engineers or data scientists who are scared of Linux. |
You don't need port forwarding by yourself VScode can do it for you if you login by using vscode-remote: |
been monkeying with this stuff for days and the way @ricab explained it made more sense to me than the docs... so I used here's the ARP I'm seeing externally
|
Thank you @NickFranceschina, that's interesting, I also have just a basic internet-provider router, but it reports the instance's MAC address (even knows its name). That's with a bridge created by Multipass via NetworkManager... |
Hi @NickFranceschina, I guess you're using the I tried what you described and, when passing a wifi interface to |
Let me just add that bridging over WiFi is generally problematic, because of how packets are routed over the wireless link. Simplifying, the access point doesn't expect packets from a different MAC on the link (there are no WiFi switches like there are for Ethernet). The fact that it works at all suggests macOS is doing some translation (think masquerade) under the hood - but that is going to be hit and miss on the other side. Wonder if the IPs are actually/also sitting on the WiFi interface in some way… |
Thanks guys... @Saviq yes I should actually have this box plugged into the ethernet instead, but at the moment I only have one port in the router (already used) and no extra switches laying around, so I tried with the wifi. @ricab I'm trying to do everything as "vanilla" as possible with multipass, falling back to the defaults that I'm sure have been thoroughly considered (so yeah I'm using the qemu driver). I don't want to dig into any specialty settings on OSX networking stuff as I tried that before and ended up in a corner where I had to re-install the OS to be sane again. So when I get a chance I will try this again with the ethernet adapter and see if the mac addresses work as expected. until then I've opted to configure static IPs (which makes sense anyways since these services don't need DHCP) and it all appears to be working for now. I thank you for your feedback! |
OK, glad you got it working for you @NickFranceschina. I am curious, how did you configure the static IP? Did you use |
@ricab yeah so again I haven't spent much of my life in Linux so I'm doing things as best I can figure out... I originally created the VM with just I think that's what I did anyways :) I should def try to break it all and see if I can fix it to make sure I really understand |
You're welcome, thanks for sharing your experience! |
How does it supposed to work with exposing instances with MULTIPASS_SERVER_ADDRESS parameter ? Described here. |
Forwarding instance ports out onto multipassd's listening address(es):
Where it's possible / makes sense, use hypervisor for this, otherwise have multipassd listen.
The text was updated successfully, but these errors were encountered: