How do I setup router to be able to access two subnets?

At my home I use 192.168.0.x and at my parents' home I set their network to use 192.168.1.x so that Tailscale works properly when our networks are connected.

This means that when I'm setting up and testing devices for them at my house (like this Netgear R7800 router which I've just got for them and installed OpenWRT on), I need to be able to access both subnets.

I tried creating a new bridge device (lan34) which just has LAN ports 3 and 4 in it, and then removing those ports from the original br.lan which now contains ports 1 and 2 and the WiFi radios, then I added a new interface for lan34, set it to 192.168.0.1 (br.lan is set to 192.168.1.1), enabled DHCP, and added it to the LAN firewall zone, which br.lan is already in.

When I connect my laptop by WiFi I now get a 192.168.0.x address and can only connect to the GUI using 192.168.0.1, even though the WiFi radios are assigned to br.lan which is using the 192.168.1.1 subnet.

If I plug my laptop into ports 3 or 4 I can't access the GUI on 192.168.0.1 or 192.168.1.1 (I've set my NIC to 192.168.1.5 with the gateway 192.168.1.1), and if I plug it into port 2 the GUI works again on 192.168.0.1 but not 192.168.1.1. I also can't access a RPi that's plugged into port 1 and has been given the address 192.168.1.155 by DHCP.

I'm obviously doing something very wrong here, but I don't know what!

Why not connect the test router with its wan port to your lan , open the necessary ports so you can administer it via the wan?

I have a number of test routers each on its own subnet which I administer that way.

Of course you should not do it with internet facing routers as it is not secure and you should remove it when you take the router in production!

See:

1 Like

Thanks, I could try that but I wanted to avoid connecting additional equipment, as I was planning to test the LAN and WAN speeds with various builds using iperf, so I just wanted to connect my laptop to one port and the RPi to another, but the RPi was stuck on a different subnet to my laptop.

I think the RPi drive might have been corrupted anyway, as I couldn't login to it even when I connected it to my router, so I reflashed the drive and it's using DHCP now, so I no longer have the problem with it being on a different subnet.

I managed to brick my R7800 (again) by disabling the port3+4 interface that I created, so for whatever reason the GUI must have been attached to those ports, which explains why it was only working on 192.168.0.1 (that being the subnet I assigned to the port 3+4 interface) even though my laptop was using a static IP of 192.168.1.5. Failsafe mode and Factory reset didn't help, but I managed to fix it by flashing with tftp eventually, after discovering that I had to completely disable my WiFi interface for that to work.

For optimal iperf testing you need two PC's one attached to the LAN side and the other to the WAN, that is how I do it.

My main PC is attached to the main router and can administer all attached routers and my latop is attached to the LAN side of the router I want to test :slight_smile:

1 Like

OK thanks, I'll do the iperf testing that way.

I'd still like to be able to connect the devices using the 192.168.0.x subnet and enable them to have internet access at least, even if they can't access the devices on the 192.168.1.x subnet.

All my devices that are set to use the 192.168.0.x subnet, several of which have static IP addresses set, are connected to an unmanaged switch which plugs into the ISP supplied router/AP. At the moment, I have the R7800 plugged into the cable modem to make sure the Internet is working with it, so all my devices that are connected to the switch have no access to the internet. I'd like to plug the switch into the R7800 so that they have internet access (and ideally access to the devices on the 192.168.1.x subnet too) without having to change the static IP addresses.

I already showed you how to do remote administration of the R7800 if it is connected to your main router.

For access from your lan clients to the R7800 attached clients you need two things:

  1. set a static route on the main router to route 192.168.1.0/24 via the WAN ip address of the R7800 (192.168.0.X)
  2. Open up the firewall of the R7800 for traffic from 192.168.0.0, with a traffic rule

That way clients can access each other but note that clients can/will have their own firewall so for connection from upstream to downstream either the firewall of individual clients should be tweaked or easier you enable MASQUERADING on the LAN zone

1 Like

I want the R7800 to be the main router whilst I'm testing it, with the WAN port connected to the modem, and the unmanaged switch which the 192.168.0.x devices are plugged into connected to a LAN port on the R7800. Can't I do that and set something in OpenWRT to allow those devices to access the internet and the other devices connected to the R7800 that are using 192.168.1.x addresses?

You can setup a guest wifi on the R7800 with subnet 192.168.0.0/24 and assign some lan ports to it.
But to me what you want seems overly complicated just for testing your router.

1 Like

Thanks. I didn't know that I needed to create a WiFi network in order to assign a different subnet to some ports. That's probably why I ran into the issues that I did by just creating a bridge device for ports 3 and 4 and a new interface for that bridge.

I tried the other way you suggested and added these firewall rules

config rule
        option name 'Allow-Admin'
        list proto 'tcp'
        option src 'wan'
        option dest_port '20 80 443'
        option target 'ACCEPT'
		
config rule
        option name 'allow_forward'
        option src 'wan'
        list src_ip '192.168.0.0/16'
        list src_ip '10.0.0.0/8'
        option dest '*'
        option target 'ACCEPT'

but with the R7800 WAN port connected to the LAN port on my ISP's router I can't connect to the R7800 GUI on 192.168.1.1, even if I disable the firewall on my PC (I've included both subnets in my PC firewall's LAN rule which allows all traffic to/from those addresses).

I also tried adding a static route in my ISP router but it rejects any gateway address that I enter.

EDIT: I also can't access the Internet with any devices that are connected to the R7800 this way, so I can't test the router this way and there must be something else that I need to do.