This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

analysing intermittent problems with DNS forwarder m0n0wall

0

Hi, i've setup a 'private subnet' in my home network. I have a 'server' which has two nic's eth0 is connected to the ADSL modem/router and eth1 is connected to a switch connecting all pc's on the subnet.

The server runs vmware server and runs 3 VM's: - ubuntu bridged to eth0 - ubuntu bridged to eth1 - m0n0wall which acts as the firewall/gateway/dhcp server for the subnet. the "WAN" interface is bridged to eth0 and the "LAN" interface to eth1

At this stage only the dhcp server is enabled and dns forwarding so that machines on the subnet can access the internet.

The setup works DNS names are resolved and 'most' websites work fine. ping to various hosts returns the same values via the m0n0wall as directly through the modem/router gateway.

However, some sites take ages to load, or don't load at all. But not always. www.bbc.co.uk is one example.

I'm using wireshark to get to the bottom of the problem but so far i've only found that the times the request fails the server (bbc) sends an window-update as a response to the packet with the GET request. After that the client retransmits two more times and the server finally responds with 'bad tcp'.

What i'm trying to find out is whether i've got a config problem in the m0n0wall or whether its more fundamental e.g packets getting mangled etc.

any pointers would be appreciated.

cheers, Michael

asked 10 Aug '11, 14:13

mmalaprop's gravatar image

mmalaprop
6112
accept rate: 0%


2 Answers:

0

If some sites work directly, but not over the m0n0wall firewall, then I would make traces on both sides of the m0n0wall and compare them. Look at the TCP options for things like:

  • Window scale adjustments (or deletion)
  • SACK option deletion
  • Incorrect SACK translations

What exactly do you mean with "the server responds with 'bad tcp'"? Is that an HTTP message? Or is it wireshark reporting a packet as bad tcp?

answered 11 Aug '11, 00:08

SYN-bit's gravatar image

SYN-bit ♦♦
17.1k957245
accept rate: 20%

thanks for your response.

"bad tcp" was what wireshark called the packet. the way i saw it was the server sent a window-update and that was marked by wireshark as a bad tcp and coloured red. also, the two subsequent retrnasmitts were marked red (bad tcp). the final packet was an RST - reset. i guess that was the end of the communication.

the successfull transmitts also had some retransmits and window-update just a lot less.

(11 Aug '11, 08:11) mmalaprop

0

I used tcpdump to monitor both physical interfaces. and imported the results into wireshark. There i used "follow tcp stream".

On the eth0 side there are more packets being sent, i was kind of expecting them to be one-to-one. I looked at the packets (not all ) and they don't seem to be corrupted or have their options reset.

eth1:

No.     Time        Source                Destination           Protocol Length Info
      7 6.001700    192.168.2.2           212.58.244.66         TCP      78     dyna-lm > http [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=2 TSval=0 TSecr=0 SACK_PERM=1
      8 6.048679    212.58.244.66         192.168.2.2           TCP      66     http > dyna-lm [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460 SACK_PERM=1 WS=128
      9 6.048698    212.58.244.66         192.168.2.2           TCP      66     http > dyna-lm [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460 SACK_PERM=1 WS=128
     10 6.049136    192.168.2.2           212.58.244.66         TCP      60     dyna-lm > http [ACK] Seq=1 Ack=1 Win=128000 Len=0
     11 6.049460    192.168.2.2           212.58.244.66         TCP      1514   [TCP segment of a reassembled PDU]
     12 6.049483    192.168.2.2           212.58.244.66         HTTP     70     GET / HTTP/1.1 
     13 6.095471    212.58.244.66         192.168.2.2           TCP      66     [TCP Window Update] http > dyna-lm [ACK] Seq=1 Ack=1 Win=5888 Len=0 SLE=1461 SRE=1477
     14 6.095490    212.58.244.66         192.168.2.2           TCP      66     [TCP Dup ACK 13#1] http > dyna-lm [ACK] Seq=1 Ack=1 Win=5888 Len=0 SLE=1461 SRE=1477
     15 8.952247    192.168.2.2           212.58.244.66         TCP      1514   [TCP Retransmission] dyna-lm > http [ACK] Seq=1 Ack=1 Win=128000 Len=1460
     16 14.987273   192.168.2.2           212.58.244.66         TCP      1514   [TCP Retransmission] dyna-lm > http [ACK] Seq=1 Ack=1 Win=128000 Len=1460
     17 17.573181   212.58.244.66         192.168.2.2           TCP      66     http > dyna-lm [FIN, ACK] Seq=1 Ack=1 Win=5888 Len=0 SLE=1461 SRE=1477
     18 17.573203   212.58.244.66         192.168.2.2           TCP      66     http > dyna-lm [FIN, ACK] Seq=1 Ack=1 Win=5888 Len=0 SLE=1461 SRE=1477
     19 17.573729   192.168.2.2           212.58.244.66         TCP      60     dyna-lm > http [ACK] Seq=1461 Ack=2 Win=128000 Len=0
     20 17.573833   192.168.2.2           212.58.244.66         TCP      70     [TCP Retransmission] [TCP segment of a reassembled PDU]
     21 17.619934   212.58.244.66         192.168.2.2           TCP      60     http > dyna-lm [RST] Seq=2 Win=0 Len=0
     22 17.619952   212.58.244.66         192.168.2.2           TCP      60     http > dyna-lm [RST] Seq=2 Win=0 Len=0

eth0:

No.     Time        Source                Destination           Protocol Length Info
     19 2.887053    192.168.1.95          212.58.244.66         TCP      78     11277 > http [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=2 TSval=0 TSecr=0 SACK_PERM=1
     20 2.887073    192.168.1.95          212.58.244.66         TCP      78     11277 > http [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=2 TSval=0 TSecr=0 SACK_PERM=1
     21 2.933395    212.58.244.66         192.168.1.95          TCP      66     http > 11277 [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460 SACK_PERM=1 WS=128
     22 2.934360    192.168.1.95          212.58.244.66         TCP      60     11277 > http [ACK] Seq=1 Ack=1 Win=128000 Len=0
     23 2.934376    192.168.1.95          212.58.244.66         TCP      60     [TCP Dup ACK 22#1] 11277 > http [ACK] Seq=1 Ack=1 Win=128000 Len=0
     24 2.934717    192.168.1.95          212.58.244.66         TCP      1514   [TCP segment of a reassembled PDU]
     25 2.934731    192.168.1.95          212.58.244.66         TCP      1514   [TCP Retransmission] 11277 > http [ACK] Seq=1 Ack=1 Win=128000 Len=1460
     26 2.934798    192.168.1.95          212.58.244.66         HTTP     70     GET / HTTP/1.1 
     27 2.934805    192.168.1.95          212.58.244.66         TCP      70     [TCP Retransmission] [TCP segment of a reassembled PDU]
     28 2.935617    192.168.1.1           192.168.1.95          ICMP     590    Destination unreachable (Fragmentation needed)
     29 2.980166    212.58.244.66         192.168.1.95          TCP      66     [TCP Window Update] http > 11277 [ACK] Seq=1 Ack=1 Win=5888 Len=0 SLE=1461 SRE=1477
     48 5.837664    192.168.1.95          212.58.244.66         TCP      1514   [TCP Retransmission] 11277 > http [ACK] Seq=1 Ack=1 Win=128000 Len=1460
     49 5.837685    192.168.1.95          212.58.244.66         TCP      1514   [TCP Retransmission] 11277 > http [ACK] Seq=1 Ack=1 Win=128000 Len=1460
     50 5.838493    192.168.1.1           192.168.1.95          ICMP     590    Destination unreachable (Fragmentation needed)
     87 11.872608   192.168.1.95          212.58.244.66         TCP      1514   [TCP Retransmission] 11277 > http [ACK] Seq=1 Ack=1 Win=128000 Len=1460
     88 11.872630   192.168.1.95          212.58.244.66         TCP      1514   [TCP Retransmission] 11277 > http [ACK] Seq=1 Ack=1 Win=128000 Len=1460
     89 11.873432   192.168.1.1           192.168.1.95          ICMP     590    Destination unreachable (Fragmentation needed)
    108 14.457945   212.58.244.66         192.168.1.95          TCP      66     http > 11277 [FIN, ACK] Seq=1 Ack=1 Win=5888 Len=0 SLE=1461 SRE=1477
    109 14.459048   192.168.1.95          212.58.244.66         TCP      60     11277 > http [ACK] Seq=1461 Ack=2 Win=128000 Len=0
    110 14.459062   192.168.1.95          212.58.244.66         TCP      60     11277 > http [ACK] Seq=1461 Ack=2 Win=128000 Len=0
    111 14.459128   192.168.1.95          212.58.244.66         TCP      70     [TCP Retransmission] [TCP segment of a reassembled PDU]
    112 14.459139   192.168.1.95          212.58.244.66         TCP      70     [TCP Out-Of-Order] [TCP segment of a reassembled PDU]
    113 14.504728   212.58.244.66         192.168.1.95          TCP      60     http > 11277 [RST] Seq=2 Win=0 Len=0

thanks, michael

answered 11 Aug '11, 12:13

mmalaprop's gravatar image

mmalaprop
6112
accept rate: 0%

3

Ah... these traces explain things. Your ADSL modem/router (192.168.1.1) it telling your client (192.168.1.95 after nat, 192.168.2.2 before nat) that it needs to fragment the IP datagram to forward it (see frames 28, 50, 89). However the m0n0wall does not seem to forward these ICMP packets. So your client does not learn that it needs to send smaller packets.

You can solve this by looking at the ICMP packet in frame 28 and extract the MTU of the next hop. You can then change the MTU size on both sides of the m0n0wall FW accordingly.

(11 Aug '11, 12:29) SYN-bit ♦♦

That did it! thanks. Just so this is clear in my head... the client (192.168.1.95) sent a packet (frame 24 say, 1514 bytes). this had the DF flag set and the router dropped that packet and sent a 'this is to big for me to forward - please fragment'.

what i don't quite understand:

  1. why wasn't the monowall passing the ICMP packet back as its only 590bytes. . . i only changed the mtu on the client winXP side to match the router...
  2. why was a 1514 size packet generated the default on windows is 1500
(11 Aug '11, 15:51) mmalaprop
1

Actually, to be precies, the meaning of the ICMP paket is:

"You want me to forward a IP packet without fragmenting, however, it is too big for the link towards the next hop. I can only send IP datagrams of size XXX, so I dropped the packet"

Then it's up to the sending host to determine what to do. In TCP, the sending host will just start to use smaller segments so that they will fit.

(11 Aug '11, 23:23) SYN-bit ♦♦
1

I would have expected the m0n0wall to forward the ICMP messages, so you might want to report this as a bug (or feature request, depending how you look at it).

A 1500 byte MTU means that a 1500 byte datagram can be transported over the link, which on ethernet means there will be a 6 byte destination, a 6 byte source and a 2 byte ethertype prepended and a 4 byte FCS appended to the datagram. In total 1518 (although you usually see 1514 in Wireshark because the FCS is already stripped before Wireshark gets to see the packet).

(11 Aug '11, 23:25) SYN-bit ♦♦

I think m0n0wall drops all incoming communications, including ICMP (which is sort of belonging to the TCP session but has no entry in its firewall state table since it's a new communication flow). I would advise to configure m0n0wall to drop all ICMP packets except "fragmentation needed" (if that's possible).

(12 Aug '11, 05:59) Jasper ♦♦

@Jasper, just letting the "ICMP fragmentation needed" packets through is not enough, these packets need to be properly natted (at the IP layer as well as at the IP layer inside the ICMP payload).

m0n0wall needs to bind these ICMP packets to the outgoing TCP flow to be able to do so. I have seen this being a problem with loadbalancers in the past as well.

(12 Aug '11, 06:28) SYN-bit ♦♦

the m0n0wall comes with a setting 'block private networks' on its WAN interface. i did disable that earlier and assumed it would include ICMP packet. it didn't. i allowed ICMP traffic to pass through but still the 'fragmentation needed' packets didn't pass. i'll see if the m0n0wall folks know anything more.

(13 Aug '11, 14:49) mmalaprop

Just one more thing on this issue:-) the IP 192.168.1.95 is that of the m0n0wall, which must NAT that to 192.168.2.2 (the client is in the subnet). But that makes sense right? the m0n0wall is acting as a gateway from the .1.0 network to the .2.0 network.

(14 Aug '11, 11:54) mmalaprop
showing 5 of 8 show 3 more comments