Internal Layout
This article is supposed to describe the "connection scheme" of an embedded router, similar to Flash Layout. It's based on an example, the D-Link DIR-825. This particular hardware has 2 PHYs units, represented by the physical network interfaces eth0 and eth1, whereas most emebedded devices have only one: eth0. It further has two PHYs units for the IEEE 802.11 protocol, represented by wlan0 and wlan1.
| iface | Port |
|---|---|
| eth0 | 5 port Gigabit Switch 1) |
| eth1 | WAN port Connected to PHY4 of rtl8366 |
| wlan0 | radio0 |
| wlan1 | radio1 |
| usb | Bluetooth/3G/etc. |
Additional information on the rtl8366s switch. Switch 1: rtl8366s(RTL8366S), ports: 6 (cpu @ 5), vlans: 16 (4096 starting with 10.03.1-rc4)
| switch port id | Label on the back | |
|---|---|---|
| port:0 | LAN4 | |
| port:1 | LAN3 | |
| port:2 | LAN2 | |
| port:3 | LAN1 | |
| port:4 | Not Connected to the switch chip, the PHY goes straight to eth1 on CPU | |
| port:5 | no RJ45 connector (Ethernet port) | |
The default config provided looks something like below:
config interface loopback
option ifname lo
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0
config interface lan
option ifname eth0
option type bridge
option proto static
option ipaddr 192.168.1.1
option netmask 255.255.255.0
config interface wan
option ifname eth1
option proto dhcp
config switch rtl8366s
option enable 1
option reset 1
option enable_vlan 1
config switch_vlan
option device rtl8366s
option vlan 0
option ports "0 1 2 3 5"
Going through this, step by step gives us the following information. Firstly there's the loopback device. This is of course needed at all times.
Secondly, eth0 is in a bridged configuration, with only itself in the configuration. eth0 does not need to be in a bridge. A common configuration however is to add wlan0 and wlan1 to that bridge to make all ports (the switched ports and wifi links) appear to be on one network component.
Thirdly, eth1 is the WAN port and setup as a normal NIC requesting DHCP from the ISP. It is not connected to the switch but does use a PHY on it. )).
Fourthly the switch is actually very interesting. Setting the option 'enable' to '0' will disable the switch and thus eth0 will not be able to communicate to the outside world. Setting the option 'enable_vlan' to either '0' or '1' will actually either enable or disable the vlan tagging functionality. Disabling vlan tagging makes the switch work like a simple 'dumb' switch. The name of the switch has to correspond to the name of the chip. Filling in a random name makes swconfig not able to find and configure the switch.
Lastly there is one vlan with id 0 created by default containing all 5 connected ports.
*Note:* For the switch to be useful at all, it needs to be enabled. Furthermore, even with an enabled switch, if vlan's are enabled but not defined, the ports on the back will not connect to eth0. When messing with these things, it may be an idea to temporarily setup the WAN port with a static ip, that accepts ssh connection and login from there, so one would not get shut out. If seriously exploring the switch make sure wireless access works because even the WAN port goes through the switch chip to get to PHY4 and there is a mux you could (admittedly hard to do) accidentally reconfigure, breaking the link between the CPU and the WAN port.
Since WAN port is separated from the actual switch logic and the other LAN ports, the only way to combine it is to bridge vlan0 with eth1. The mux mentioned above doesn't appear to include an option to directly connect PHY4 to the switch.
doc/techref/internal.layout.txt · Last modified: 2011/10/08 16:38 by orca
