Devices not getting static IP

Thanks for a great forum! I am a complete newbie, so it has been really helpful to be able to read up on things.

My router with openwrt doesn’t have a SIM card slot, so I need to use another router (hereafter “main router”) for the internet connection.


  • “Main router” -
  • “openwrt router” - (main router connected via WAN port)
  • all devices connected via WiFi to “open wrt router”

I have set static IP on all devices and I’m pretty sure that worked when I had a VPN interface I forced all traffic through. But since I removed that interface and sent all traffic straight to the WAN, it seems like the devices no longer use their static IPs (192.168.2.x) but rather a dynamic IP from the “main router” (192.168.1.x).

This creates an array of issues with my home automation, so I would be very happy for any insights on how to fix it. Thanks

All devices connected to openwrt will use the wan address of openwrt since masquerading is enabled by default. It is possible to disable it but then the main router needs a static route to the network and it also has to allow traffic from that network to the Internet. Unfortunately not all home routers support such configuration.

1 Like

Okey, thanks. And the reason it worked with the VPN is because the tunnel is established between the server and the openwrt router, so the only traffic the main router sees is the encrypted tunnel?

I will in a few months get broadband, so then I won’t have the need for the “main router”. But it would be ideal to have set up everything by then so it is just to switch the WAN cable.

But basically: I have no other options than what you suggest?

I have a “Mac clone” option in the main router, but not sure what that means.


these are the available menu items in the main router

Edit 2:
Can I have the openwrt router on 192.168.1.x? I guess the devices won't ask the openwrt router for an IP then...?

I am not sure I understand. If the IP address is statically set on a device (opposed to a static lease by the server), then the device can't on its own choose to work on a different IP given by a DHCP server. It will not request an IP, and it can't even talk with the main router, as it's on a different subnet (unless you are using a subnet mask of (or something less than anyway).

1 Like

I’ve set a static lease on the openwrt router for all devices. Sorry for the confusion.

That worked when everything went to through the VPN interface.

Edit: subnet mask for is

Well, subnet mask of basically means that and are on the same network. So you have incorrect setup for your OpenWrt router, as you have both LAN and WAN interface s on the same subnet, which won't work unless you disable NAT.

1 Like

Okey. has has

What would the correct setup be?

OK, I am not sure what exactly your requirements are, if you need to have the clients of OpenWrt able to access the clients of the main router (and the otherway around) or not. Presuming that you don't need that and you are fine with letting OpenWrt make its subnet, the simple setup slyly be as follows:
1- Main router on whatever IP, subnet mask
2- OpenWrt WAN connected to main router LAN as DHCP client.
3- OpenWrt LAN is set to an IP on a different subnet.
4- OpenWrt clients are DHCP clients or have static IPs or static leases on the same subnet as OpenWrt.

That should be fine, if you have the routers connected LAN to WAN and you haven't changed anything in OpenWrt. It shouldn't matter if the clients are DHCP clients or static leases.

That's, again, presuming you didn't change something significant in OpenWrt.

If, for example, you bridged WAN and LAN then this changes everything.

Maybe you should share with us the output of the following commands on OpenWrt. Please redact MAC addresses and any passwords.

cat /etc/config/network 
cat /etc/config/dhcp

Please use the Pre-formatted text tool </> to include the code here

Maybe I should just reset the settings? I did a lot of changes when setting up the VPN, so that might be the best route forward?


I just realized I don't want to reset, since I don't have an ethernet port on my computer =) Any ideas on how to reset without resetting the wifi-networks?

root@OpenWrt:~# cat /etc/config/network 

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr ''
	option netmask ''

config globals 'globals'
	option ula_prefix 'fd10:4421:0f8a::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0.1'
	option proto 'static'
	option ipaddr ''
	option ip6assign '60'
	option netmask ''

config interface 'wan'
	option ifname 'eth1.2'
	option proto 'dhcp'

config interface 'wan6'
	option ifname 'eth1.2'
	option proto 'dhcpv6'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option vid '1'
	option ports '5t 4 3 2 1 0'

config interface 'MULLVAD_VPN'
	option ifname 'tun0'
	option proto 'none'

config interface 'NO_INTERNET'
	option proto 'dhcp'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option vid '2'
root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option localservice '1'
	option noresolv '1'
	list server ''
	list server '/'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv6 'server'
	option ra 'server'
	option ra_management '1'
	list dhcp_option '6,,'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

Then I have a bunch of entries like the below in /etc/config/dhcp:

config host
	option mac 'the-mac-address'
	option name 'name-set-by-me'
	option dns '1'
	option ip ''

Please refrain from telling the forum you've made changes until you've actually done so. We rely on the OP to tell the truth.

Anyways, and 2.0 should no longer be on the same long as you fixed the subnet mask on the upstream device too.

You are aware that this setting makes providing a static name useless for clients receiving the lease, except for your convenience when looking at the web GUI.

The only fix is to:

  • disable masquerade on the OpenWrt WAN
  • on the upstream router, make a static route for toward it's LAN (both configs below mean the same thing - I provide both because I don't know how your upstream router shows the config):
    • mask via 192.168.1.x (WAN IP of OpenWrt) on LAN; or
    • via 192.168.1.x (WAN IP of OpenWrt) on LAN
  • fix OpenWrt LAN to! (i.e. /24)
1 Like

Yeah sorry, I did a change and didn’t update.

It seems like I don’t have the possibility to set up static routes on the upstream router. I guess that is a dead end then? I read other people writing about “bridge mode” using “dmz”, but I know to little if that maps into this at all.

Thanks for your help!

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