mark-kubacki / systemd-transparent-udp-forwarderd

Transparent socket-activated UDP Proxy/Forwarder
9 stars 4 forks source link

Error binding to destination. (Address family not supported by protocol) #1

Closed chris13524 closed 6 years ago

chris13524 commented 6 years ago

I have three unit files, factorio.service, factorioproxy.service, and factorio.socket. When I go in Factorio and connect to port 34197, I get this error printed several times under the factorioproxy.service logs: "Error binding to destination. (#97 Address family not supported by protocol)"

All three services are running according to systemd, but no connections can be made and there is that error.

factorio.service

[Unit]
Description=Factorio server

[Service]
Type=simple
ExecStart=/home/chris13524/worthless/downloads/factorio/bin/x64/factorio --bind 127.0.0.1:34198 --start-server test
WorkingDirectory=/home/chris13524/worthless/downloads/factorio
ExecStartPost=/bin/sleep 1
KillSignal=SIGINT

factorioproxy.service

[Unit]
Requires=factorio.service
After=factorio.service

[Service]
ExecStart=/home/chris13524/worthless/downloads/factorio/systemd-transparent-udp-forwarderd 127.0.0.1:34198

factorioproxy.socket

[Socket]
ListenDatagram=34197
Transparent=true

[Install]
WantedBy=sockets.target
mark-kubacki commented 6 years ago

Use ListenDatagram=0.0.0.0:34197 which—due to the 0.0.0.0—will configure IPv4.

Else you most likely get IPv6 with the idiosyncratic conversion to IPv4 and would need to call systemd-transparent-udp-forwarderd [::1]:34198 and have Factorio talk IPv6 too. Which in turn will exclude all your players on IPv4-networks.


Then, I recommend swapping Requires=… with BindsTo=… to shutdown the proxy once the server (Factorio) exits, to have systemd listen for incoming packets again.

Please note that the first packets to arrive at your machine (the one running the proxy, and the server some seconds in) will be regarded as timed-out. That is, for example, I ask users of my Avorion server to click on browse within the game again if the server appears to be offline.