Can I set up two LANs with identical IP ranges and still port forward?

I've been tasked with setting up a rather unorthodox network structure and I'd like to know if it's possible and, if so, how to configure it properly. The requirements are as such:

  • There must be two LANs: one for computer base stations and one for several robotic components that make up a single robot.
  • These two LANs must use the same IP range: a.k.a
  • These LANs are to be set up using Nanopi R4S Mini Portable Travel Routers, which will be mounted on the robot.
  • A computer base station should not be able to directly communicate to a robotic component, it should have to use the defined port-forwarding scheme.
  • Multiple robots must be able to be active at one time (a.k.a. multiple routers with these two LAN definitions must be active, only difference being the router's IP on the base station LAN)

Here is a diagram of the desired setup:

I've attempted simply setting up two LAN's (base station LAN IP:, Robot LAN IP:, with one physical port assigned to each, but I am unable to ping any robotic components while ssh'd into the router, unless I assign a different netmask to each of the LANs.

Why do they have to be the same?

Those routers are not routers, as they are not between two different networks. Your ping fails because the 'router' doesn't know which interface to use, 'wan' or lan.


Unless you don't use the WAN ports, or attached them to LAN.

The only mistake you seem to have made is to put the "base station" and the WAN interfaces of the router in the same IP network ( as the two LANs. Put them in some other (private) IP network entirely, like

Then use NAT (masquerding) as per the default OpenWrt setup on the two routers to translate addresses.

If the base station is capable to act as a DHCP server, you could make it hand out the WAN interface IP addresses to the routers based on the MAC addresses of the routers.

When you have set up the port forwards (which I assume will be identical on every router) you base that on the zone of the incoming traffic (WAN) rather than on the WAN IP address (which will be different on each router) - this is the completely ordinary way to do it in OpenWrt.

Given this setup I believe you can build your own images with just a few customizations (IP range of the LAN, port forwards, maybe turn off or customize the IP range of the DHCP server on the LAN) and use identical images on each router. Adding a new robot would just be hooking up the hardware and map the MAC of the new router to a router WAN IP address (10.10.0.x) in the DHCP server of the base station.

Your setup is not much different than what any ISP would do for their customers. The customers would use identical routers with identical IP networks internally. The only thing that matters in your case is what robot get which router IP, which is why the DHCP server in the base station would be convenient for you.

It's for backwards compatibility. I've got everything working just fine when they are different, but the boss wants them the same.

Thanks for the help. That would be ideal and how I would like to go about doing this. Unfortunately, the base station and the robotics are all custom and set up to use and the boss does not want to have to change any of that. I've had total success when they use different subnets, but unfortunately that didn't cut it.

Then yyou need to add a third router between base and and other routers on different subnet and manage it that way. It will be a mess

1 Like

I assume you could also put each of your two lan bridge interfaces in a separate namespace, and create a veth interface to connect each namespace with the main namespace. Don't know if UCI supports that but could be done with the ip-full package.

1 Like