Netfilter won't forward if tcp packets contain large payloads
I'm sending this in html format hoping the tcpdump lines won't wrap. If that's a problem for anyone, please let me know and I will resend in text only.
I'm encountering a strange issue with my firewall configuration whereas tcp packets with large payloads just disappear into the ether. I've gone over my configuration with everyone in the Netfilter User mailing list and it appears that my configuration is correct as far as I can tell for what I'm trying to do. I'm wondering if I could be encountering a bug of some sort.
To explain my network situation, I'm connecting two private subnets through an OpenVPN tunnel. My local subnet here is 10.1.2.0 and the remote private subnet is 10.1.1.0. The local subnet is behind a netfilter firewall providing DNAT/SNAT to the outside world and also providing routing through the tunnel. A abridged version of my firewall configuration looks like this:
eth0: public interface to the internet
eth1: private interface to local subnet
tun0: OpenVPN tunnel to remote private subnet
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -A FORWARD -i tap+ -j ACCEPT
iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A PREROUTING -d 129.41.69.137 -p all -j DNAT --to-destination 10.1.1.7
iptables -t nat -A POSTROUTING -s 10.1.1.7 -p tcp -j SNAT --to 129.41.69.137 iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 207.111.175.68
The firewall machine is a RH 7.3 install with kernel 2.4.18.
The problem is that for internal reasons (laptops, administration, etc.), I need all traffic headed to our public mail server (129.41.69.137) to be routed through the tunnel instead of the public interface eth0.
I've attempted handle this by DNAT'ing traffic destined for 129.41.69.137 to 10.1.1.7 which will be routed to the tunnel and then SNAT'ing the traffic back from 10.1.1.7 to 129.41.69.137 after it come back from the tunnel.
This appears to work just fine, except that certain protocols were failing. I.e. checking mail over IMAP worked fine, but sending an email would die. Getting directory listings from ftp would work fine, but uploading a file would die.
To try to discern the problem, I dumped three interfaces, the local eth1 interface where the traffic originated, the tun0 interface on the local firewall here and the tun0 interface on the remote VPN endpoint. Below is the output.
Quoted 1 line
From the data below, it's obvious that any outgoing packets with a full payload (the payload size is 1460)
i.e. 09:29:05.797718 10.1.2.10.3969 > 129.41.69.137.smtp: . 165:1625(1460) ack 125 win 64116 (DF)
never make it to the local tun0 tunnel interface. This is why incoming imap appears to work just fine, but sending mail doesn't.
Again, this seems a bit crazy as my FORWARD chain specifically allows any traffic to and from eth1 and tun0 and I'm not even aware of an easy way to tell the firewall to drop packets of varying sizes.
Is this a bug? If not, what on earth is going on?
Thank you,
Daniel Beckham
dealnews.com, Inc.
Tcpdump of an email being sent:
Local side eth1 (private network) interface:
09:29:04.986096 10.1.2.10.3969 > 129.41.69.137.smtp: S 266730469:266730469(0) win 64240 <mss 1460,nop,nop,sackOK> (DF) 09:29:05.031723 129.41.69.137.smtp > 10.1.2.10.3969: S 361700781:361700781(0) ack 266730470 win 5840 <mss 1460,nop,nop,sackOK> (DF) 09:29:05.032012 10.1.2.10.3969 > 129.41.69.137.smtp: . ack 1 win 64240 (DF)
09:29:05.070351 129.41.69.137.smtp > 10.1.2.10.3969: P 1:30(29) ack 1 win 5840 (DF)
09:29:05.071015 10.1.2.10.3969 > 129.41.69.137.smtp: P 1:15(14) ack 30 win 64211 (DF)
09:29:05.116376 129.41.69.137.smtp > 10.1.2.10.3969: . ack 15 win 5840 (DF)
09:29:05.117139 129.41.69.137.smtp > 10.1.2.10.3969: P 30:53(23) ack 15 win 5840 (DF)
09:29:05.122880 10.1.2.10.3969 > 129.41.69.137.smtp: P 15:50(35) ack 53 win 64188 (DF)
09:29:05.158861 129.41.69.137.smtp > 10.1.2.10.3969: P 53:61(8) ack 50 win 5840 (DF)
09:29:05.159354 10.1.2.10.3969 > 129.41.69.137.smtp: P 50:81(31) ack 61 win 64180 (DF)
09:29:05.199376 129.41.69.137.smtp > 10.1.2.10.3969: P 61:69(8) ack 81 win 5840 (DF)
09:29:05.217234 10.1.2.10.3969 > 129.41.69.137.smtp: P 81:87(6) ack 69 win 64172 (DF)
09:29:05.253760 129.41.69.137.smtp > 10.1.2.10.3969: P 69:82(13) ack 87 win 5840 (DF)
09:29:05.461468 10.1.2.10.3969 > 129.41.69.137.smtp: . ack 82 win 64159 (DF)
09:29:05.489124 129.41.69.137.smtp > 10.1.2.10.3969: P 69:82(13) ack 87 win 5840 (DF)
09:29:05.489289 10.1.2.10.3969 > 129.41.69.137.smtp: . ack 82 win 64159 (DF)
09:29:05.637796 10.1.2.10.3969 > 129.41.69.137.smtp: P 87:93(6) ack 82 win 64159 (DF)
09:29:05.674856 129.41.69.137.smtp > 10.1.2.10.3969: P 82:95(13) ack 93 win 5840 (DF)
09:29:05.675104 10.1.2.10.3969 > 129.41.69.137.smtp: P 93:128(35) ack 95 win 64146 (DF)
09:29:05.711681 129.41.69.137.smtp > 10.1.2.10.3969: P 95:103(8) ack 128 win 5840 (DF)
09:29:05.712122 10.1.2.10.3969 > 129.41.69.137.smtp: P 128:159(31) ack 103 win 64138 (DF)
09:29:05.760198 129.41.69.137.smtp > 10.1.2.10.3969: P 103:111(8) ack 159 win 5840 (DF)
09:29:05.760453 10.1.2.10.3969 > 129.41.69.137.smtp: P 159:165(6) ack 111 win 64130 (DF)
09:29:05.796963 129.41.69.137.smtp > 10.1.2.10.3969: P 111:125(14) ack 165 win 5840 (DF)
*** the packet size changes here once the email data is being sent to the mail server ***
09:29:05.797718 10.1.2.10.3969 > 129.41.69.137.smtp: . 165:1625(1460) ack 125 win 64116 (DF)
09:29:05.797843 10.1.2.10.3969 > 129.41.69.137.smtp: . 1625:3085(1460) ack 125 win 64116 (DF)
09:29:05.797966 10.1.2.10.3969 > 129.41.69.137.smtp: . 3085:4545(1460) ack 125 win 64116 (DF)
09:29:05.797994 10.1.2.10.3969 > 129.41.69.137.smtp: P 4545:4763(218) ack 125 win 64116 (DF)
09:29:05.798031 10.1.2.10.3969 > 129.41.69.137.smtp: P 4763:4768(5) ack 125 win 64116 (DF)
09:29:05.834387 129.41.69.137.smtp > 10.1.2.10.3969: . ack 165 win 5840 <nop,nop,sack sack 1 {4545:4763} > (DF) 09:29:05.846822 129.41.69.137.smtp > 10.1.2.10.3969: . ack 165 win 5840 <nop,nop,sack sack 1 {4545:4768} > (DF) 09:29:05.847323 10.1.2.10.3969 > 129.41.69.137.smtp: . 165:1625(1460) ack 125 win 64116 (DF)
09:29:05.847445 10.1.2.10.3969 > 129.41.69.137.smtp: . 1625:3085(1460) ack 125 win 64116 (DF)
09:29:05.847568 10.1.2.10.3969 > 129.41.69.137.smtp: . 3085:4545(1460) ack 125 win 64116 (DF)
09:29:06.555338 10.1.2.10.3969 > 129.41.69.137.smtp: . 165:1625(1460) ack 125 win 64116 (DF)
09:29:08.195721 10.1.2.10.3969 > 129.41.69.137.smtp: . 165:1625(1460) ack 125 win 64116 (DF)
09:29:11.367205 10.1.2.10.3969 > 129.41.69.137.smtp: . 165:1625(1460) ack 125 win 64116 (DF)
09:29:17.819496 10.1.2.10.3969 > 129.41.69.137.smtp: . 165:1625(1460) ack 125 win 64116 (DF)
09:29:30.614817 10.1.2.10.3969 > 129.41.69.137.smtp: . 165:1625(1460) ack 125 win 64116 (DF)
Firewall on the local side of the tunnel: (tun0)
09:29:04.986164 10.1.2.10.3969 > 10.1.1.7.smtp: S 266730469:266730469(0) win 64240 <mss 1460,nop,nop,sackOK> (DF) 09:29:05.031684 10.1.1.7.smtp > 10.1.2.10.3969: S 361700781:361700781(0) ack 266730470 win 5840 <mss 1460,nop,nop,sackOK> (DF) 09:29:05.032048 10.1.2.10.3969 > 10.1.1.7.smtp: . ack 1 win 64240 (DF)
09:29:05.070314 10.1.1.7.smtp > 10.1.2.10.3969: P 1:30(29) ack 1 win 5840 (DF)
09:29:05.071048 10.1.2.10.3969 > 10.1.1.7.smtp: P 1:15(14) ack 30 win 64211 (DF)
09:29:05.116340 10.1.1.7.smtp > 10.1.2.10.3969: . ack 15 win 5840 (DF)
09:29:05.117105 10.1.1.7.smtp > 10.1.2.10.3969: P 30:53(23) ack 15 win 5840 (DF)
09:29:05.122915 10.1.2.10.3969 > 10.1.1.7.smtp: P 15:50(35) ack 53 win 64188 (DF)
09:29:05.158822 10.1.1.7.smtp > 10.1.2.10.3969: P 53:61(8) ack 50 win 5840 (DF)
09:29:05.159389 10.1.2.10.3969 > 10.1.1.7.smtp: P 50:81(31) ack 61 win 64180 (DF)
09:29:05.199339 10.1.1.7.smtp > 10.1.2.10.3969: P 61:69(8) ack 81 win 5840 (DF)
09:29:05.217269 10.1.2.10.3969 > 10.1.1.7.smtp: P 81:87(6) ack 69 win 64172 (DF)
09:29:05.253722 10.1.1.7.smtp > 10.1.2.10.3969: P 69:82(13) ack 87 win 5840 (DF)
09:29:05.461527 10.1.2.10.3969 > 10.1.1.7.smtp: . ack 82 win 64159 (DF)
09:29:05.489089 10.1.1.7.smtp > 10.1.2.10.3969: P 69:82(13) ack 87 win 5840 (DF)
09:29:05.489324 10.1.2.10.3969 > 10.1.1.7.smtp: . ack 82 win 64159 (DF)
09:29:05.637836 10.1.2.10.3969 > 10.1.1.7.smtp: P 87:93(6) ack 82 win 64159 (DF)
09:29:05.674820 10.1.1.7.smtp > 10.1.2.10.3969: P 82:95(13) ack 93 win 5840 (DF)
09:29:05.675137 10.1.2.10.3969 > 10.1.1.7.smtp: P 93:128(35) ack 95 win 64146 (DF)
09:29:05.711645 10.1.1.7.smtp > 10.1.2.10.3969: P 95:103(8) ack 128 win 5840 (DF)
09:29:05.712153 10.1.2.10.3969 > 10.1.1.7.smtp: P 128:159(31) ack 103 win 64138 (DF)
09:29:05.760162 10.1.1.7.smtp > 10.1.2.10.3969: P 103:111(8) ack 159 win 5840 (DF)
09:29:05.760485 10.1.2.10.3969 > 10.1.1.7.smtp: P 159:165(6) ack 111 win 64130 (DF)
09:29:05.796928 10.1.1.7.smtp > 10.1.2.10.3969: P 111:125(14) ack 165 win 5840 (DF)
09:29:05.798040 10.1.2.10.3969 > 10.1.1.7.smtp: P 4545:4763(218) ack 125 win 64116 (DF)
09:29:05.798086 10.1.2.10.3969 > 10.1.1.7.smtp: P 4763:4768(5) ack 125 win 64116 (DF)
09:29:05.834350 10.1.1.7.smtp > 10.1.2.10.3969: . ack 165 win 5840 <nop,nop,sack sack 1 {4545:4763} > (DF) 09:29:05.846786 10.1.1.7.smtp > 10.1.2.10.3969: . ack 165 win 5840 <nop,nop,sack sack 1 {4545:4768} > (DF)
Remote side of the tunnel: (tun0)
12:08:10.673521 10.1.2.10.3969 > 10.1.1.7.smtp: S 266730469:266730469(0) win 64240 <mss 1460,nop,nop,sackOK> (DF) 12:08:10.674685 10.1.1.7.smtp > 10.1.2.10.3969: S 361700781:361700781(0) ack 266730470 win 5840 <mss 1460,nop,nop,sackOK> (DF) 12:08:10.718701 10.1.2.10.3969 > 10.1.1.7.smtp: . ack 1 win 64240 (DF)
12:08:10.722990 10.1.1.7.smtp > 10.1.2.10.3969: P 1:30(29) ack 1 win 5840 (DF)
12:08:10.761777 10.1.2.10.3969 > 10.1.1.7.smtp: P 1:15(14) ack 30 win 64211 (DF)
12:08:10.762026 10.1.1.7.smtp > 10.1.2.10.3969: . ack 15 win 5840 (DF)
12:08:10.762144 10.1.1.7.smtp > 10.1.2.10.3969: P 30:53(23) ack 15 win 5840 (DF)
12:08:10.809779 10.1.2.10.3969 > 10.1.1.7.smtp: P 15:50(35) ack 53 win 64188 (DF)
12:08:10.810126 10.1.1.7.smtp > 10.1.2.10.3969: P 53:61(8) ack 50 win 5840 (DF)
12:08:10.846437 10.1.2.10.3969 > 10.1.1.7.smtp: P 50:81(31) ack 61 win 64180 (DF)
12:08:10.851162 10.1.1.7.smtp > 10.1.2.10.3969: P 61:69(8) ack 81 win 5840 (DF)
12:08:10.905777 10.1.2.10.3969 > 10.1.1.7.smtp: P 81:87(6) ack 69 win 64172 (DF)
12:08:10.906068 10.1.1.7.smtp > 10.1.2.10.3969: P 69:82(13) ack 87 win 5840 (DF)
12:08:11.139331 10.1.1.7.smtp > 10.1.2.10.3969: P 69:82(13) ack 87 win 5840 (DF)
12:08:11.148104 10.1.2.10.3969 > 10.1.1.7.smtp: . ack 82 win 64159 (DF)
12:08:11.177095 10.1.2.10.3969 > 10.1.1.7.smtp: . ack 82 win 64159 (DF)
12:08:11.324853 10.1.2.10.3969 > 10.1.1.7.smtp: P 87:93(6) ack 82 win 64159 (DF)
12:08:11.325240 10.1.1.7.smtp > 10.1.2.10.3969: P 82:95(13) ack 93 win 5840 (DF)
12:08:11.363484 10.1.2.10.3969 > 10.1.1.7.smtp: P 93:128(35) ack 95 win 64146 (DF)
12:08:11.363818 10.1.1.7.smtp > 10.1.2.10.3969: P 95:103(8) ack 128 win 5840 (DF)
12:08:11.412066 10.1.2.10.3969 > 10.1.1.7.smtp: P 128:159(31) ack 103 win 64138 (DF)
12:08:11.412477 10.1.1.7.smtp > 10.1.2.10.3969: P 103:111(8) ack 159 win 5840 (DF)
12:08:11.447083 10.1.2.10.3969 > 10.1.1.7.smtp: P 159:165(6) ack 111 win 64130 (DF)
12:08:11.449412 10.1.1.7.smtp > 10.1.2.10.3969: P 111:125(14) ack 165 win 5840 (DF)
12:08:11.486836 10.1.2.10.3969 > 10.1.1.7.smtp: P 4545:4763(218) ack 125 win 64116 (DF)
I haven't seen anyone comment on this, not even a "ask the users mailing
list" response. Is this something no one can answer, or did my previous
message fail to get through?
Daniel
Quoted 3 lines · Daniel Beckham
I haven't seen anyone comment on this, not even a "ask the users mailing
list" response. Is this something no one can answer, or did my previous
message fail to get through?
Your message got through. You already mentioned that you went through your setup on the user mailing list, so you were spared that comment.
Regarding your problem, I have only a prediction to make: in the end it will have something to do with MTU mismatches. The symptoms you describe fit that guess, in any case.
Debugging of tunnel setups / MTU problems is not the strength of this mailing list, nor its purpose. Concrete fixing of already diagnosed faults in netfilter / iptables is, as well as concrete proposals and activities of improving the code.
I hope that this can explain the silence you got. I'm sorry I don't have to offer more than this explanation.
best regards
Patrick