Hi,
I’m running a private UDP service (well, it’s a DNS server on UDP port 53).
I read the docs requiring it to bind to the magic fly-global-services address, but I’ve found out that when I simply bind to 0.0.0.0 the service… just works, at least over IPv4 non-shared address.
Is the documentation outdated? Did you guys figure out how to do UDP without such tricks ?
On a different note - is there a built-in way to limit the outgoing bandwidth of my app? I don’t want the server to be abused.
To limit bandwidth, you can employ tc (I haven’t used it on Fly, so you’ll need to test if it works as expected): Introduction to Linux Traffic Control
Tailscale engs mentioned that they shape traffic on their relay servers hosted on Fly, but I’m not sure what they use. May be someone at Fly does.
0.0.0.0 works sometimes, it depends entirely on the networking library.
The problem is the return path. Some libraries send UDP responses from the wrong IP when you bind 0.0.0.0. Which is silly. They use the first IP they can discover from the system for all UDP responses.
UDP only works if you reply from the fly-global-services IP. So if it works for you, it will continue to work. But it’s actually somewhat rare that libraries do the right thing.
Looks like DNSMASQ/PiHole works correctly , without fly-global-services. Nice.
On the other hand, a socat echo server (udp port 54, just as an example) doesn’t work out-of-the-box:
# Doesn't work.
# Incoming packets are from 172.19.65.179, which happens to be the 2nd address assigned to eth0
# Socat naively responds from 172.19.65.178, which is incorrect (and the 1st address of eth0).
socat -v UDP-LISTEN:54,fork,bind=0.0.0.0 exec:'/bin/cat'
# Works:
socat -v UDP-LISTEN:54,fork,bind=fly-global-services exec:'/bin/cat'
Client side:
socat - UDP:app-name.fly.dev:54
Anyhow, maybe the fact that the issue is on the return path and some libs handle it correctly is worth documenting.
If you restart your app’s instance, you should get a kernel with that module loaded in. Let us know how that goes! (I only deployed this on the server where your volume / instance lives)
Right now this also comes with a bump in kernel version (from 5.12.2 to 5.15.93, but I might as well make it 5.15.98 since that’s the latest 5.15). Previous compilations of 5.15 have been deployed to a few servers as a test, but not many.
I know I’m bumping this thread after it’s been solved, but this is just too awesome not to say an explcit thank you. I definitely didn’t expect this level of service. Appreciated.