1

I have a debian 7 server hosted by Google Cloud running a game server and a rails server.

The rails server run on port 80 and the game server on port 8000.

I want to apply a network rule that allow the game server packets to have a higher priority in order to minimize latency.

For now, I found that iptables could help me with this :

iptables -A PREROUTING -t mangle -p tcp --dport 8000:8010 -j TOS --set-tos Minimize-Delay

But when I check if my rule has been added :

iptables -L -vt nat

Chain PREROUTING (policy ACCEPT 877 packets, 100K bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain INPUT (policy ACCEPT 877 packets, 100K bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain OUTPUT (policy ACCEPT 329 packets, 20395 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain POSTROUTING (policy ACCEPT 329 packets, 20395 bytes)
 pkts bytes target     prot opt in     out     source               destination

I'm not seeing my rule. What I'm doing wrong ? And also, is this the right way to do what I want ?

  • 1
    Game servers are usually latency sensitive so you might look into tcp_low_latency which disables prequeuing. It'll increase the number of packets that get sent but it'll get the packets' payloads out the door sooner. – Bratchley Dec 14 '14 at 18:10
0
iptables -t mangle      -A PREROUTING -p tcp --dport 8000:8010 -j TOS --set-tos Minimize-Delay
iptables -t nat         -L -v

Quite obvious, if you change the parameter order. Those are your commands. Now it is quite obvious that one table (mangle) is modified and another (nat) is looked at afterwards. Thus it is far from surprising that the listing command doesn't show any change.

But I wouldn't hope for that to make a real difference. Perhaps you should investigate whether this in honoured by today's routers at all.

You could consider using traffic shaping to that packets from the rails server are delayed if there is one from the game server. But probably this system has a very fast interface so that will probably not make a big difference.

What might help you – but I don't know whether and how that is possible: The rails server (if currently running and if there is only one virtual CPU or if the game server can use more than one) should be immediately stopped by the kernel if a packet arrives for the game server. You could make this a new question here. Maybe it helps to have the game server run at real-time priority.

  • I have no idea what “quite obvious” is referring to nor what point you're trying to make with the commands above it. – Gilles Dec 14 '14 at 21:37
  • What the # stand for ? And sorry, your command doesn't work. – ClemDOT Dec 14 '14 at 21:47
  • @Gilles Those are ClemDOT's commands, just with a different order of the parameters. I consider it "quite obvious" that one table (mangle) is modified and another (nat) is looked at afterwards. Thus it is far from surprising that the listing command doesn't show any change. – Hauke Laging Dec 14 '14 at 22:45
  • You should write that in your answer. – Gilles Dec 14 '14 at 22:47
  • @ClemDOT You shouldn't execute those commands. They are yours. You should look at them in an easier to understand way in order to understand your mistake. The # was supposed to cause a graphical effect which for some reason unknown to me didn't occur. – Hauke Laging Dec 14 '14 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.