# Problem with DNS or  NAT or... (?)



## oliwiak82 (Sep 1, 2015)

Hi,
I have found strange problem and can't track what could be possible wrong.

My system is:

```
FreeBSD forteca.no-ip.org 10.1-RELEASE-p15 FreeBSD 10.1-RELEASE-p15 #6: Tue Jul 28 00:26:57 CEST 2015  root@forteca.no-ip.org:/usr/obj/usr/src/sys/FORTECA  amd64
```


I have most usual setup:
Internet --- [(wan-ip)em0 --- ipnat --- (10.10.10.1/24) re0] --- switch ---- (10.10.10.20)pc-behind-nat

As you could see from the below I can't reach some hosts in the internet and some can. I don't block any traffic in IPFW so this is not the case. Ping to same hosts from FreeBSD does not have problems at all.

```
C:\Users\Mama>ping abc.com

Badanie abc.com [199.181.132.250] z 32 bajtami danych:
Odpowiedź z 10.10.10.1: Host docelowy jest nieosiągalny.
Odpowiedź z 10.10.10.1: Host docelowy jest nieosiągalny.

Statystyka badania ping dla 199.181.132.250:
  Pakiety: Wysłane = 2, Odebrane = 2, Utracone = 0
  (0% straty),
Control-C
^C
C:\Users\Mama>ping onet.pl

Badanie onet.pl [213.180.141.140] z 32 bajtami danych:
Odpowiedź z 213.180.141.140: bajtów=32 czas=15ms TTL=57
Odpowiedź z 213.180.141.140: bajtów=32 czas=15ms TTL=57
Odpowiedź z 213.180.141.140: bajtów=32 czas=14ms TTL=57
Odpowiedź z 213.180.141.140: bajtów=32 czas=14ms TTL=57

Statystyka badania ping dla 213.180.141.140:
  Pakiety: Wysłane = 4, Odebrane = 4, Utracone = 0
  (0% straty),
Szacunkowy czas błądzenia pakietów w millisekundach:
  Minimum = 14 ms, Maksimum = 15 ms, Czas średni = 14 ms
```

The strange thing is that when I reboot FreeBSD which is gateway for pc-behind-nat for several hours I can ping all hosts and problem does not exist.

I use google dns 8.8.8.8 and 8.8.4.4 in dhcpd configuration.

Some tcpdump(1) output...

```
[root@forteca ~]# tcpdump -vv -i re0 host 10.10.10.20 and port not 443
tcpdump: listening on re0, link-type EN10MB (Ethernet), capture size 65535 bytes
16:57:34.702277 IP (tos 0x0, ttl 128, id 31404, offset 0, flags [none], proto ICMP (1), length 60)
  10.10.10.20 > m.disneyaulani.com: ICMP echo request, id 1, seq 147, length 40
16:57:34.702307 IP (tos 0x0, ttl 64, id 2038, offset 0, flags [none], proto ICMP (1), length 56, bad cksum 0 (->4aa7)!)
  forteca.no-ip.org > 10.10.10.20: ICMP host m.disneyaulani.com unreachable, length 36
  IP (tos 0x0, ttl 128, id 31404, offset 0, flags [none], proto ICMP (1), length 60)
  10.10.10.20 > m.disneyaulani.com: ICMP echo request, id 1, seq 147, length 40
16:57:35.705177 IP (tos 0x0, ttl 128, id 31414, offset 0, flags [none], proto ICMP (1), length 60)
  10.10.10.20 > m.disneyaulani.com: ICMP echo request, id 1, seq 148, length 40
16:57:35.705203 IP (tos 0x0, ttl 64, id 2047, offset 0, flags [none], proto ICMP (1), length 56, bad cksum 0 (->4a9e)!)
  forteca.no-ip.org > 10.10.10.20: ICMP host m.disneyaulani.com unreachable, length 36
  IP (tos 0x0, ttl 128, id 31414, offset 0, flags [none], proto ICMP (1), length 60)
  10.10.10.20 > m.disneyaulani.com: ICMP echo request, id 1, seq 148, length 40
16:57:36.719187 IP (tos 0x0, ttl 128, id 31424, offset 0, flags [none], proto ICMP (1), length 60)
  10.10.10.20 > m.disneyaulani.com: ICMP echo request, id 1, seq 149, length 40
16:57:36.719211 IP (tos 0x0, ttl 64, id 2059, offset 0, flags [none], proto ICMP (1), length 56, bad cksum 0 (->4a92)!)
  forteca.no-ip.org > 10.10.10.20: ICMP host m.disneyaulani.com unreachable, length 36
  IP (tos 0x0, ttl 128, id 31424, offset 0, flags [none], proto ICMP (1), length 60)
  10.10.10.20 > m.disneyaulani.com: ICMP echo request, id 1, seq 149, length 40
16:57:37.733253 IP (tos 0x0, ttl 128, id 31431, offset 0, flags [none], proto ICMP (1), length 60)
  10.10.10.20 > m.disneyaulani.com: ICMP echo request, id 1, seq 150, length 40
16:57:37.733292 IP (tos 0x0, ttl 64, id 2076, offset 0, flags [none], proto ICMP (1), length 56, bad cksum 0 (->4a81)!)
  forteca.no-ip.org > 10.10.10.20: ICMP host m.disneyaulani.com unreachable, length 36
  IP (tos 0x0, ttl 128, id 31431, offset 0, flags [none], proto ICMP (1), length 60)
  10.10.10.20 > m.disneyaulani.com: ICMP echo request, id 1, seq 150, length 40
16:57:43.068294 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has forteca.no-ip.org (00:e0:4c:00:85:20 (oui Unknown)) tell 10.10.10.20, length 46
16:57:43.068304 ARP, Ethernet (len 6), IPv4 (len 4), Reply forteca.no-ip.org is-at 00:e0:4c:00:85:20 (oui Unknown), length 28
16:57:54.893446 IP (tos 0x0, ttl 1, id 31555, offset 0, flags [none], proto UDP (17), length 513)
  10.10.10.20.1900 > 239.255.255.250.1900: [udp sum ok] UDP, length 485
16:57:54.893702 IP (tos 0x0, ttl 1, id 31556, offset 0, flags [none], proto UDP (17), length 461)
```
Could somebody please provide me the way how I can trace/track the root cause..(?)


----------



## `Orum (Sep 7, 2015)

How are you performing NAT for your network?


----------



## oliwiak82 (Sep 8, 2015)

```
[root@forteca ~]# ipnat  -l
List of active MAP/Redirect filters:
map em0 10.10.10.0/24 -> 89.68.55.175/32
map em0 192.168.1.0/24 -> 89.68.55.175/32
map em0 192.168.100.0/24 -> 89.68.55.175/32
rdr em0 0/0 port 2223 -> 192.168.1.111/32 port 22 tcp/udp
rdr em0 0/0 port 10052 -> 192.168.1.111/32 port 10050 tcp/udp
rdr em0 0/0 port 2222 -> 10.10.10.21/32 port 22 tcp/udp
rdr em0 0/0 port 80 -> 10.10.10.21/32 port 80 tcp/udp

List of active sessions:
MAP 10.10.10.21  54839 <- -> 89.68.55.175  54839 [50.31.164.164 443]
MAP 10.10.10.21  52639 <- -> 89.68.55.175  52639 [8.8.8.8 53]
MAP 10.10.10.21  54984 <- -> 89.68.55.175  54984 [8.8.8.8 53]
MAP 10.10.10.21  39501 <- -> 89.68.55.175  39501 [8.8.8.8 53]
```


----------



## oliwiak82 (Sep 10, 2015)

It looks like I'm not the 1st who experience this problem:

https://forums.freebsd.org/threads/ipnat-error-with-freebsd-10-1.52525/
https://forums.freebsd.org/threads/ipnat-goes-slow-on-freebsd-10-1-release-p5.50432/
https://forums.freebsd.org/threads/...lems-getting-worse-as-uptime-increases.50618/

Finally I've switched to PF… for now, and testing if that helped.


----------



## oliwiak82 (Oct 24, 2015)

oliwiak82 said:


> It looks like I'm not the 1st who experience this problem:
> 
> https://forums.freebsd.org/threads/ipnat-error-with-freebsd-10-1.52525/
> https://forums.freebsd.org/threads/ipnat-goes-slow-on-freebsd-10-1-release-p5.50432/
> ...


...Well it did help.


----------

