Page 1 of 1

[Kovarex] [14.9] Server stutters on player disconnect with NAT

Posted: Sat Sep 24, 2016 6:48 pm
by Yehn
When a player disconnects from a multiplayer session with a server behind NAT implemented with iptables, all players still in game will momentarily see the 'Server is not responding' progress bar. The exact time before the server starts responding again varies, can be less than a second or several seconds.

NAT rules in play:

Code: Select all

iptables -t nat -A PREROUTING -p udp -d 104.255.169.247 --dport 34197 -j REDIRECT --to-port 35001
iptables -t nat -A POSTROUTING -p udp -s localhost --sport 35001 -j SNAT --to-source 104.255.169.247:34197
iptables -t nat -A POSTROUTING -p udp -s 104.255.169.246 --sport 35001 -j SNAT --to-source 104.255.169.247:34197

iptables -t nat -A PREROUTING -p udp -d 104.255.169.246 --dport 34197 -j REDIRECT --to-port 35000
iptables -t nat -A POSTROUTING -p udp -s localhost --sport 35000 -j SNAT --to-source 104.255.169.246:34197
iptables -t nat -A POSTROUTING -p udp -s 104.255.169.246 --sport 35000 -j SNAT --to-source 104.255.169.246:34197
As implied by the rules, dual server instances are running on ports 35000 and 35001.

Re: [14.9] Server stutters on player disconnect with NAT

Posted: Sat Sep 24, 2016 11:47 pm
by Oarc
I also see this occasionally on some disconnects. If I look at my task manager upload monitor, it's 0kbps (from factorio) until the issue resolves.
I don't have any special routing. (I'm just behind a typical home internet connection, using a dedicated server).

Re: [Kovarex] [14.9] Server stutters on player disconnect with NAT

Posted: Sun Sep 25, 2016 4:36 am
by Yehn
Ok. I haven't seen it on my mono-server (a small VM with only 1 factorio instance, only 1 IP and no special routing), which is why I thought maybe factorio was acting funny with NAT. But I'm definitely seeing it now.

Re: [Kovarex] [14.9] Server stutters on player disconnect with NAT

Posted: Mon Sep 26, 2016 10:32 am
by kovarex
Yehn wrote:When a player disconnects from a multiplayer session with a server behind NAT implemented with iptables, all players still in game will momentarily see the 'Server is not responding' progress bar. The exact time before the server starts responding again varies, can be less than a second or several seconds.

NAT rules in play:

Code: Select all

iptables -t nat -A PREROUTING -p udp -d 104.255.169.247 --dport 34197 -j REDIRECT --to-port 35001
iptables -t nat -A POSTROUTING -p udp -s localhost --sport 35001 -j SNAT --to-source 104.255.169.247:34197
iptables -t nat -A POSTROUTING -p udp -s 104.255.169.246 --sport 35001 -j SNAT --to-source 104.255.169.247:34197

iptables -t nat -A PREROUTING -p udp -d 104.255.169.246 --dport 34197 -j REDIRECT --to-port 35000
iptables -t nat -A POSTROUTING -p udp -s localhost --sport 35000 -j SNAT --to-source 104.255.169.246:34197
iptables -t nat -A POSTROUTING -p udp -s 104.255.169.246 --sport 35000 -j SNAT --to-source 104.255.169.246:34197
As implied by the rules, dual server instances are running on ports 35000 and 35001.
Does it happen when you run only 1 Factorio?
Does it happen when you don't use iptables?