WikiDevi.Wi-Cat.RU:DD-WRT/Default Internal Device Network

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.



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.

'''Newer router typically n-router has a slightly different vlan and port numbering scheme. To show the difference between the older and newer router generation, the following text is enclosed in square brackets and marked in bold.'''

The internal port that connects to the router is always port number 5, [port number 8].

Within the switch entity there are defined two VLANs - vlan0 and vlan1, [vlan1 and vlan2]. Vlan0, [Vlan1] is the one on which all of the numbered (1-4) RJ45 sockets on the back belong to. Vlan1, [Vlan2] 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, [port 8] 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, [port 8]). 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, [vlan1].

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, [port 8]. Vlan0, [Vlan1] 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, [port 8] connection to the switch's vlans is the eth0. When port 5, [port 8] 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, [vlan1] and eth1; rather, it employs a bridge device - who's interface is called br0 - that logically combines vlan0, [vlan1] and eth1 into a single interface.

The effect of this, given that vlan0, [vlan1] is the default one and packets from eth1 do not carry vlan tagging, is that vlan0, [vlan1] 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, [vlan1]; 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, [vlan2]). So routing and filtering *does* come into play when moving traffic between br0 (vlan0 + eth1) and vlan1 or [(vlan1 + eth1) and vlan2)].

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.
 * imq0,1 - QOS device or IMQ Device

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

In this dd-wrt forum thread, the default configuration is explained simpler:
 * Simple Default Config Explanation