-
Notifications
You must be signed in to change notification settings - Fork 661
UDP ports not forwarded to host #366
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
Comments
Yes, port forwarding is implemented via ssh tunneling, which only supports TCP. So we would need to have a way to forward UDP traffic to TCP, send it over the tunnel and convert it back to UDP. This may be complex, as we would also have to make sure UDP datagrams aren't being split into multiple packets (or if they are, we would have to re-assemble them on the other side). Maybe somebody else will come up with an easier way to do this... |
I think that is how you do it, possibly you can use |
I'm also seeing that this should be possible with
I'm not super familiar with either tool and have never done this before, but based on the first link it sounds like this is all that's needed:
|
I'm not greatly familiar with either
Specifically it boils down to The problem is reproducible through a simple test when running in
In the client side, if you mash the enter key the server eventually falls over. You can see the process ID disappearing with a An odd observation is that on When trying the 2 clients, the messages from the second client that sent the UDP message completely get ignored on the server, and not only that but it also stops getting some of the messages from the first client. This also worked fine on I tried with the Trying a similar test with I wanted to test the |
Just correcting myself slight, the issues with |
Interesting, thanks for investigating all that @jammy-d! It sounds like you've basically validated the concept, M1 Rather than The fastest and most surefire way is probably just to write some custom code that does exactly what's needed. I know offhand that it's simple to write UDP and TCP clients and servers with Node.js, and I imagine that the Go standard library would allow for the same if that were preferable. An implementation could look something like:
(Haven't tested either of those lines, but they should work as-is.) |
@jandubois Is there any obvious reason why this approach shouldn't work? I know you'd brought up reassembling UDP datagrams, but TCP and UDP have the same max packet size (64 KiB), so I think forwarding the packets agnostically should actually just work as expected. Would it be a major change to put Go equivalents to those two lines in |
Idk, I can't concentrate on this right now. You would probably have to set the MSS value in the TCP connection options to avoid fragmentation; I don't know what it defaults to when there is no link-level MTU. @AkihiroSuda what do you think?
I think that would be fine, but it looks like your example only forwards UDP from the VM to the host, but not the other way. |
The other direction actually already seems to work, in my testing. |
Just following up on what I wrote regarding the |
for additional info/workarounds.. https://superuser.com/questions/53103/udp-traffic-through-ssh-tunnel |
Are there plans to address this issue directly - versus the various workarounds that are out there? Does addressing this issue require reimplementing the entire port-forwarding feature? |
I am hitting this limitation. |
👍 for udp forwarding to the host |
Workaround: use vmnet to assign a "real" IP |
Thank you! Setting the network to "bridged" and forwarding the ports from the separate lima-* hostname on my network worked for my case. Would still enjoy having UDP forwarding to the host itself but for now this is a good workaround. |
Any updates? At the very least, would it be possible to get Docker under [co]lima to report an error if a user tries forwarding a UDP port when it's not supported? I just wasted a significant amount of time trying to debug my system before finding this ticket explaining that it's not supported and significantly complicated what was supposed to be an easy offline test environment. |
I'm glad the thought of possible issues with UDP popped into my head early on when I hit this snag. Googling it quickly led me to this issue :-) I could have seen myself spending a lot of time just like @Digicrat. FWIW, a +1 for me on out-of-the-box UDP forwarding! |
Linking the current discussion |
Hi
I'm running lima v0.7.2 and can't seem to get UDP ports to forward to the host as TCP ports are.
Is this a known issue/expected behaviour?
I'm trying to run PiHole using the following command which successfully forwards both TCP and UDP ports when run using docker-for-mac so i'm fairly confident i've got that right.
Once up and running this is what i get when checking ports on the guest and then on the host:
Any help much appreciated as this really isn't my area of expertise.
Thanks
The text was updated successfully, but these errors were encountered: