0

Linux kernel is 4.9.17-8.31

I am opening up many external ports that map onto a single internal port. The reason is that each customer group gets there own port, this allows upstream accounting with tc.

Rules look something like this: iptables -t nat -A PREROUTING -i eth0 -p tcp --match multiport --dports 3000,3032,3064,3096,3128,3160,3192,3224,3256,3288 -j REDIRECT --to-port 54321 iptables -t nat -A PREROUTING -i eth0 -p tcp --match multiport --dports 3330,3352,3384,3416,3448,3480,3512,3544,3576,3608 -j REDIRECT --to-port 54321 iptables -t nat -A PREROUTING -i eth0 -p tcp --match multiport --dports 3640,3672,3704,3736,3768,3800,3832,3864,3896,3928 -j REDIRECT --to-port 54321 iptables -t nat -A PREROUTING -i eth0 -p tcp --match multiport --dports 3960,3992,3024,3056,3088,3113,3152,3184,3216,3248 -j REDIRECT --to-port 54321

If I test 400 connections hitting one of these rules all the connections happen cleanly.

If I test 100 connections hitting each of the 4 rule lines I see timeouts and re-transmissions of the TCP SYN packets, I can tcpdump capture the TCP SYN is arriving, but not responded to, no TCP SYN ACK response.

I cannot find a drop or error point and all connections hitting one rule is very solid. In my test scenarios all 400 connections are from a single host, unsure if problem exists in a more real world scenario where connections will be coming from multiple hosts.

For testing purposes I have de-configured tc and can reproduce errors with iptables alone.

Interested to see if this behavior has been observed in the past.

8
  • I understand that the rules are not an exact copy of the ones you use, but you should provide a functional sample. These are invalid iptables rules. May 19, 2017 at 2:33
  • Hi Julie thank you for looking at this. Here is the same rules mapping to port 22: iptables -t nat -A PREROUTING -i eth0 -p tcp --match multiport --dports 3000,3032,<snip> -j REDIRECT --to-port 22 Now test by ssh to port 3000 you can see the single stat increment in the rule containing port 3000 iptables -t nat -n -v -L Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 1 52 REDIRECT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 multiport dports 3000,<snip> redir ports 22
    – Ken Barr
    May 20, 2017 at 3:28
  • When you say connections hitting those four rules, do you mean that they get evaluated and ignored or they match? There can only be a single match as it will return after. May 20, 2017 at 3:55
  • I an testing w/ 400 connections. All 400 connections match 1 rule and connection performance is good. 4x100 connections each matching 1 of the 4 rules. connection performance degrades. Nothing else changes other then the dest port.
    – Ken Barr
    May 21, 2017 at 17:50
  • Can you lay out a simple but complete test plan so that someone like me could blindly test it? I'm also curious to know why you don't simply DNAT to the right port and if it does the same thing. May 22, 2017 at 4:34

0

You must log in to answer this question.

Browse other questions tagged .