Routing between 2 subnet on the same router

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Advanced Networking
Author Message
megavolts
DD-WRT Novice


Joined: 02 May 2019
Posts: 1

PostPosted: Thu May 02, 2019 7:13    Post subject: Routing between 2 subnet on the same router Reply with quote
Hi all,

I set up my router with 2 wireless subnets on my router following https://wiki.dd-wrt.com/wiki/index.php/Multiple_WLANs:
* 192.168.1.0/24 for my data server, laptop, subnet connected to LAN and WAN.
* 192.168.2.0/24 for a bunch of sensors platform using RaspberryPi or similar

I want to have my second subnet 192.168.2.0 connected to LAN and the first WLAN subnet 192.168.1.0, in order to access directly to the sensor (for example at 192.168.2.142) from my laptop (192.168.1.13).

I tried to bridge the interface without success (often I ended up to lose the separate subnet, or have the subnet gaining access to internet.

I tried to create a route in between the two subnets with:
* Destination LAN NET: 192.168.2.0
* Subnet Mask: 255:255:255:0
* Gateway: 192.168.1.1
Without success. When Pinging I got the following error "Redirect Host(New nexthop: 192.168.2.141)"

Here is a schematic:
Code:
SUBNET2---------------SUBNET1---------(NAT)---Internet (WAN)
(192.168.2.0/24)   (192.168.1.0/24)
           |                     |
   Sensor                Laptop
(192.168.2.141/24) (192.168.1.13/24)


I supposed it was as easy as:
* tell Laptop that SUBNET1 is his default gateway (normally done through dhcp)
* tell Sensor that SUBNET2 is his default gateway (normally done through dhcp)
* tell SUBNET1 that "WAN"-router is his default gateway.
* tell SUBNET1 that requests to 192.168.2./24 will be routed through SUBNET2 (static route)
* tell SUBNET2 that SUBNET1 is his default gateway (via routing)

I am open to any suggestion to make this works, and if this is a stupid idea, just let me know.

Router: Linksys WRT1900AC
Firmware Version: v3.0-r39572 std (04/19/19)

[edit 05/02/19: add Router+Firmware]


Last edited by megavolts on Thu May 02, 2019 15:19; edited 1 time in total
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 3654
Location: Netherlands

PostPosted: Thu May 02, 2019 7:52    Post subject: Reply with quote
The VAP is not isolated from the main network unless you tick Net isolation on the GUI or put in firewall rules yourself

So if you just tick Disable on Net isolation and delete any firewall rules you added yourself you should be fine and the VAP and main network are connected.

Routing has nothing to do with these kind of setups, you have to use firewall rules to isolate or connect

I use the modern method to setup a VAP see my notes

BTW: ALWAYS state your router model and firmware build number and build date

_________________
Routers:Netgear R7800, Netgear R6400v1, Netgear R6400v2, Linksys EA6900 (XvortexCFE), Linksys E2000 (converted WRT320N), WRT54GS v1.
Install guide Linksys EA6900: http://www.dd-wrt.com/phpBB2/viewtopic.php?t=291230
Simple PBR (Policy Based Routing) script: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=318662
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
OpenVPN server setup guide:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=318795
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 8034

PostPosted: Thu May 02, 2019 15:13    Post subject: Reply with quote
Let's clarify a few things here before even getting into how to achieve your goals.

It makes no sense to bridge the primary and VAP networks. Once the two networks are assigned to the same bridge, any configuration you applied to the VAP becomes irrelevant. A bridge subsumes all the network interfaces assigned to it. The only thing configurable at that point is the bridge itself. IOW, it's the bridge that gets assigned an IP network, a DHCP server, etc. So we can put the whole notion of bridging these networks aside for the moment, since it makes no sense.

As far as adding a route, since the router is hosting all the IP networks being discussed, the router already knows how to route between them. You only need to add a route when the router does NOT know how to find a given network (e.g., it's being hosted on some other device (probably a router/gateway)). So adding routes is irrelevant in this case too.

When you created that second VAP and gave it an IP network (192.168.2.x), it then became possible to route between that VAP and the existing network (192.168.1.x). By default, there are no restrictions placed between those networks as to who can access whom. For that to happen, you need to use firewall rules. I prefer the old school method of just writing your own, if only because it gives you more flexibility. But the GUI does provide an all or nothing option via the Net Isolation option.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum