# Preventing double NAT

**URL:** <https://forum.openwrt.org/t/preventing-double-nat/138726>\
**Category:** Network and Wireless Configuration\
**Created:** [October 4, 2022, 3:27pm UTC](https://forum.openwrt.org/t/preventing-double-nat/138726 "2022-10-04T15:27:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![techmol](https://forum.openwrt.org/letter_avatar/techmol/32/5_5575768a8748004e209b776fc1b2916d.png) [@techmol](https://forum.openwrt.org/u/techmol)\
**Post date:** [October 4, 2022, 3:27pm UTC](https://forum.openwrt.org/t/preventing-double-nat/138726/1 "2022-10-04T15:27:17Z")

</div>

I've set up my OpenWrt router behind WAN router.

I think as it is there is the issue of double NAT.

I think I have to setup a static route in the WAN router. But the last time I tried I had to factory reset the WAN router because nothing was working anymore.

How should the static routing look and how can I check if indeed double NAT is occuring in my network?

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/5_5575768a8748004e209b776fc1b2916d.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [October 4, 2022, 3:35pm UTC](https://forum.openwrt.org/t/preventing-double-nat/138726/2 "2022-10-04T15:35:24Z")

</div>

> [@techmol](#):
>
> How should the static routing look and how can I check if indeed double NAT is occuring in my network?

On ISP router:

`ip route add 192.168.1.0/24 via 192.168.x.y dev <OpenWrt_WAN_IP_on_ISP_deviceLAN>`

192.168.1.0/24 == default OpenWrt Network addressing != ISP router's LAN network

- After this, you'll then need to disable masquerade on the OpenWrt's WAN firewall zone.

---

<div class="post-metadata">

**Author:** ![mk24](https://forum.openwrt.org/letter_avatar/mk24/32/5_5575768a8748004e209b776fc1b2916d.png) [@mk24](https://forum.openwrt.org/u/mk24)\
**Post date:** [October 4, 2022, 3:37pm UTC](https://forum.openwrt.org/t/preventing-double-nat/138726/3 "2022-10-04T15:37:04Z")

</div>

For this example the WAN router's LAN is 192.168.0.1/24 and the OpenWrt router's LAN is 192.168.1.1/24.

In the WAN router first create a DHCP reservation so that the OpenWrt router has a consistent IP address such as 192.168.0.20.  
If you chose an IP different from the existing leased IP, restart the OpenWrt router or at least restart the network so it picks up the new IP.  
Then add a route for the second LAN (192.168.1.0/24) via 192.168.0.20 which is the reserved IP of the OpenWrt router on the first router's LAN.  
These changes should not otherwise affect the operation of the WAN router at all even if the OpenWrt router is not connected.  
Then go to the OpenWrt router firewall setting and uncheck "masquerade" on the WAN and restart the firewall. No more double NAT.

---

<div class="post-metadata">

**Author:** ![frollic](https://forum.openwrt.org/user_avatar/forum.openwrt.org/frollic/32/30113_2.png) [@frollic](https://forum.openwrt.org/u/frollic)\
**Post date:** [October 4, 2022, 3:37pm UTC](https://forum.openwrt.org/t/preventing-double-nat/138726/4 "2022-10-04T15:37:28Z")

</div>

> [@](#):
>
> how can I check if indeed double NAT is occuring in my network?

Your WAN subnet is in the 192, 172 or 10 IP ranges.

> **[Private network](https://en.m.wikipedia.org/wiki/Private_network)**
>
> In Internet networking, a private network is a computer network that uses a private address space of IP addresses. These addresses are commonly used for local area networks (LANs) in residential, office, and enterprise environments. Both the IPv4 and the IPv6 specifications define private IP address ranges. 
> Private network addresses are not allocated to any specific organization. Anyone may use these addresses without approval from regional or local Internet registries. Private IP address space...

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/5_5575768a8748004e209b776fc1b2916d.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [October 5, 2022, 7:45pm UTC](https://forum.openwrt.org/t/preventing-double-nat/138726/5 "2022-10-05T19:45:39Z")

</div>

> [@lleachii](#):
>
> On ISP router:
> 
> `ip route add 192.168.1.0/24 via 192.168.x.y dev <OpenWrt_WAN_IP_on_ISP_deviceLAN>`

I forgot to note this: some ISP devices will handle static routes - but then oddly will only NAT to the Internet for the subnet on its LAN. Hopefully you don't have this issue.

---

<div class="post-metadata">

**Author:** ![system](https://forum.openwrt.org/uploads/default/original/3X/7/4/740520c71f00039bbf001045c682f0ecb25e905a.png) [@system](https://forum.openwrt.org/u/system)\
**Post date:** [October 15, 2022, 7:45pm UTC](https://forum.openwrt.org/t/preventing-double-nat/138726/6 "2022-10-15T19:45:51Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
