Linking Subnets with Static Routes

From DD-WRT Wiki

Revision as of 13:57, 7 September 2009 by Phuzi0n (Talk | contribs)
Jump to: navigation, search



This guide aims to explain how to link different subnets together using static routes to forward traffic to the desired subnet of another router. I will avoid going into too much detail about subnetting in general, though I will say that there are benefits to using subnets such as reducing network traffic (less broadcast frames) and better access control between hosts. One important thing to note for those unfamiliar is that linking subnets is called routing, and the interfaces you use should be unbridged to do it correctly.

Creating the Subnets

There are many ways to create subnets within DD-WRT. By default only the WAN port is unbridged while the LAN switch (which is a hardware bridge) and wireless interfaces are software bridged together.

Ways to create additional subnets include:

  • Set the wireless interface to 'Unbridged'
  • Configure VLAN's if your switch supports them
  • Add virtual interfaces to any existing interface which is poor design but can overcome hardware limitations such as switches without vlans.
ifconfig eth0:1 [NEW SUBNET ROUTER IP] netmask [NETMASK] broadcast [BROADCAST]

Baseline Reference Example

Now let's say you have three routers connected together. Router1's WAN port is connected to the internet which makes it the gateway of your entire LAN, and Router2 and Router3 have their WAN ports connected to Router1's LAN ports. Router2 and/or Router3 could also be using Client or Repeater mode (not bridged!).


By default all of these routers will be operating in 'Gateway' routing mode which means they do Network Address Translation (NAT) which makes their LAN subnet addresses invisible on their WAN side. Because each router has an interface connected to the subnet, they all have routes to this subnet. However, Router1 doesn't have a route to or, Router2 doesn't have a route to, and Router3 doesn't have a route to

Configuring the Static Routes

For this particular topology only Router1 will need to be configured with static routes because the others have default routes that will cause them to forward traffic to Router1 for any subnet they don't explicitly have routes to.

The static routes should be configured with:

  • Destination LAN NET - The remote subnet that you are creating the route for.
  • Subnet Mask - The subnet mask of the remote subnet. Typically a Class C subnet mask of is used, which in slash notation is /24 as used in the diagram above.
  • Gateway - This must be set to the IP address of the next hop to the destination subnet which in this case is the WAN IP of Router2 and Router3. In networks with more devices the next hop may not be the device that is directly connected to the subnet.
  • Interface - This must be set to the interface that the next hop is connected to. For this example, Router2 and Router3 are connected to the LAN/WLAN (br0) interface of Router1.

Configure Router1 with the following information:



With the routes configured it is now safe to disable NAT on Router2 and Router3 by switching their Operating Mode from 'Gateway' to 'Router' on the Setup->Advanced Routing page. You may also want to disable the firewall (Security page) on Router2 and Router3 to allow full communication between subnets. You should now be able to communicate to devices throughout your network without having to rely on bridging.