A few months ago started a turn of the WNR3500L, this route known as open source and third-party firmware support is very attractive to me, the first start of the first brush the DD-WRT and then changed to TOMATO, after switching to TOMATO, you can connect to the route through ssh. ifconfig shows a lot of interfaces. Besides the well-known eth0, eht1, and br0, there are also vlan0, vlan1, and so on, after running brctl show br0, we found that vlan0 and eth1 were bound to br0. This made me very interested in its network structure. After searching for a large amount of information, I learned the following:
Www.2cto.com
First, WNR3500L uses the BCM4718 + BCM53115 Combination Scheme. Compare the analysis of rb1_g in the previous article, refer to the following picture, we can see that BCM4718 has only one RGMII channel, therefore, BCM53115 can only be connected through a single port (although BCM53115 supports dual RGMII, see ).
This RGMII port is called eth0 in the system. The other Wireless AP is eth1 in the system, so eth0 and eth1 are two "hard" interfaces, which correspond to actual physical lines, there are only two ports connected to the cpu hardware. Other intefaces are derived from the "virtual" interfaces on the two "hard" interfaces.
Since br0 is composed of vlan0 and eth1, let's end with a look at the two VLANs. The switch chip BCM53115 is capable of vlan division, which is also the basic condition for its application in this solution. Let's start with it. In BCM53115, as shown above, there are 7 GMAC and 5 GWs. The combination of 5 GMAC and GPHY corresponds to 5 physical ports, but one of the other two GMAC is useless, another network channel is directly connected through RGMII and RGMII on BCM4718.
Www.2cto.com
So from the logic view, it can be equivalent to a 6portsr switch, where port5 is associated with the eth0 of BCM4718, and other port0-4 is a physical port. In vlan division, port0 + prot5 is divided into vlan1, port1-4 + port5 is divided into vlan0. The six ports are divided into two groups. Among them, port5 is shared to the cpu. From the vlan perspective, it can be regarded as a TRUNK port (please search for related concepts by yourself, here, you only need to know that both VLANs can pass through it ). Vlan0 corresponds to four LAN ports, and vlan1 corresponds to a separate WAN port.
After Dividing VLANs in BCM53115, the system must have corresponding interfaces. Because tomato is based on linux, vconfig add eth0 x is generally used to create application interfaces, x indicates the vlan id. Here, tomato creates vlan0 and vlan1 Interfaces Based on eth0, which correspond to vlan0 and vlan1. Then return to eth1. Because the wireless AP can be regarded as a wireless switch, the wired lan and wireless lan must be in the same lan. Therefore, the bridge is used and br0 is created using brctl, add eth1 (wireless device group) and vlan0 (wired device group.
Finally, the system only needs to allocate ip addresses to vlan1 and br0 and adopt routing rules. Because the data exchange between machines in a wired lan is carried out in vlan0, the data exchange in a wireless lan is carried out in the ap, and the data exchange in a wired and wireless lan is carried out in br0. Of course, if pppoe is used for dial-up, the actual network interface provided is ppp0, which is equivalent to vlan1.
You can refer to the figure below (although it is for wrt54g, but it also applies to 3500L) to understand the above section:
For details about the logic view, refer to the following:
The eth0 does not exist. Because the eth0 interface is not used, the system directly uses vlan0, vlan1, and ifconfig derived from eth0. Of course, vlan0 and eth1 are also used in the form of br0. The lan ip address we allocate in the route is actually allocated to br0. If pppoe is used for dial-up, the interface is vlan1, and vlan1 is in the same situation as eth0, because the system uses the ppp0 generated when the dial is successful to connect to the network. Ppp0 uses the public IP provided by the ISP.
Www.2cto.com
The default solution is to bind four lan ports to one vlan. In fact, you can set the switch parameter to divide more VLANs, form a multi-Wan port route to connect different subnets or to multiple ports. A total of five ports can be configured with a maximum of 4 Wan + 1 LAN. Of course, this is theoretical. The specific situation depends on the degree of support of the router firmware. The switch configuration method varies with the firmware. You can search for it.
I have always thought that at least two ports are needed on the machine for routing. However, from the analysis of 3500L, a single-port linux machine works with a vlan-based switch, the routing function is also available.