Default internal device network

From DD-WRT Wiki

Revision as of 11:39, 19 June 2009 by Pbix (Talk | contribs)
Jump to: navigation, search

The DD-WRT user interface is an awesome piece of work, as it front-ends what amounts to a really quite sophisticated combination of switching and routing. This document is a concise and hopefully mostly accurate description of what the UI is actually configuring for you from the perspective of internal network devices and the data flows between them.


The image shows the default configuration of a V23-SP2 installation on a WRT54G v2. Specifics may differ slightly given different hardware.

By way of a narrative, the default configuration works like this:

The internal network switch device has 6 ports. One is the WAN RJ45 socket, four are the RJ45 sockets numbered 1-4, and one is an electrically hardwired vlan trunk interface that connects the switch to the internal router. The mapping of port numbers to physically exposed external sockets varies according to model - see this page for details. The internal port that connects to the router is always port number 5.

Within the switch entity there are defined two VLANs - vlan0 and vlan1. Vlan0 is the one on which all of the numbered (1-4) RJ45 sockets on the back belong to. Vlan1 is the one on which the WAN socket resides.

In order for it to be possible to move traffic outside the domain of any vlan, it is necessary for traffic to be manipulated by routing and filtering logic. In a DD-WRT device, you make this possible by assuring that any vlan that you've defined has port 5 as one of its member ports, thus tying the vlan to the router via trunking (note that by extension you can completely isolate a network by not including port 5). Further, you can declare that one of the vlans be the "default": when a packet flows through the router that is otherwise missing vlan tag information, it will behave as if it were a packet on the default vlan. In DD-WRT's default case, this is vlan0.

So at this point in the narrative, we have five physical ports mapped to two vlans, both of which connect to the internal router on port 5. Vlan0 is the default one.

If we go no further, we have a programmable switch that can describe as many as 5 vlans, between which we can do sophisticated routing and filtering. But that ignores the wireless part of it, which adds some extra complexity.

From the router's perspective, that special port 5 connection to the switch's vlans is the eth0. When port 5 is associated with a vlan, an additional device named vlan# becomes available to the router by virtue of vlan tagging through the eth0 device. All movement (or non-movement) of packets between the virtual lans is determined by routing logic behind those devices (which is normal linux routing, filtering, etc). The wireless device is on a separate interface called eth1. This interface, which is not part of the switch, is available to routing logic just as eth0 and the vlans are. However, DD-WRT by default does not use routing logic per se to move traffic between vlan0 and eth1; rather, it employs a bridge device - who's interface is called br0 - that logically combines vlan0 and eth1 into a single interface.

The effect of this, given that vlan0 is the default one and packets from eth1 do not carry vlan tagging, is that vlan0 and the wireless network (however that might be arranged) logically behave as a single vlan. No routing is required to get traffic from the wireless domain to vlan0; the router will act as though the wireless packets are on the wired segment.

In the default scenario, however, the "enemy" is considered to live on the WAN port (and thus vlan1). So routing and filtering *does* come into play when moving traffic between br0 (vlan0 + eth1) and vlan1.

There are a few other network device interfaces in addition to ethX, brX, and vlanX:

  • teql0 - load sharing device I believe this is used for the "Link Aggregation on Ports 3 & 4" option on the Setup/Vlans page.

DD-WRT's distribution includes command line utilities to manipulate all of these devices and mechanisms.