Saturday, October 03, 2009

Exploring D-Link DIR-320 networks with Oleg's firmware or what are vlan0, vlan1, eth0, eth1, br0?

What is the device?

It's a D-Link wireless router (4MB flash, 32MB RAM and processor Broadcom 240 MHz) with almost the same configuration as ASUS WL500g Premium (8MB flash, 32MB RAM and processor Broadcom 266MHz), but costs much lower.

Fig. 1. The front of D-Link DIR-320

Fig. 2. The of D-Link DIR-320

Why do I need this wireless router?

Because I want to build a wireless home network with Internet connection (PPPoE) for laptop, netbook (HP 2133) and a telephone (Nokia E63), which supports Wi-Fi. I need the USB port for printing, and in the future ---scanning, USB harddisks, networked web camera, 3G or WiM modems etc.


What is the Oleg's firmware?

It's Linux-based custom firmware for ASUS WL-500gx/WL-550gE/WL-500gp/WL-500W/WL-320gE/WL-320gP/WL-330gE/WL-500gp V2/WL-520gU. There isn't much thing to do with the manufacture's firmware. Instruction of installation (flashing) of the Oleg's firmware on DIR-320 can be found in my blog (in English) or wl500g.info (in Russia).


What are there inside the router with Oleg's firmware?
 

After flashing the device with Oleg's firmware, you can configure Internet connection, Wireless, etc by web brower interface. Don't forget to turn on SSH server (dropbear). After that login and explore:

$ ifconfig
br0 Link encap:Ethernet HWaddr 00:90:4C:C0:00:00
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1122700 errors:0 dropped:0 overruns:0 frame:0
TX packets:1113191 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:367622803 (350.5 MiB) TX bytes:586264798 (559.1 MiB)

eth0 Link encap:Ethernet HWaddr 00:90:4C:C0:00:00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1393411 errors:0 dropped:0 overruns:0 frame:0
TX packets:1113648 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:935119976 (891.7 MiB) TX bytes:655661617 (625.2 MiB)
Interrupt:4 Base address:0x1000

eth1 Link encap:Ethernet HWaddr 00:90:4C:C1:00:00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:619887 errors:0 dropped:0 overruns:0 frame:19671
TX packets:683607 errors:122 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:44888939 (42.8 MiB) TX bytes:305171776 (291.0 MiB)
Interrupt:13 Base address:0x5000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU:16436 Metric:1
RX packets:40152 errors:0 dropped:0 overruns:0 frame:0
TX packets:40152 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3718052 (3.5 MiB) TX bytes:3718052 (3.5 MiB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:93.88.141.40 P-t-P:93.88.128.253 Mask:255.255.255.255
UP POINTOPOINT RUNNING MULTICAST MTU:1492 Metric:1
RX packets:647631 errors:0 dropped:0 overruns:0 frame:0
TX packets:661658 errors:0 dropped:44 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:545701887 (520.4 MiB) TX bytes:346044024 (330.0 MiB)

vlan0 Link encap:Ethernet HWaddr 00:90:4C:C0:00:00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:504058 errors:0 dropped:0 overruns:0 frame:0
TX packets:443975 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:334078103 (318.6 MiB) TX bytes:292107592 (278.5 MiB)

vlan1 Link encap:Ethernet HWaddr 00:90:4C:C0:00:00
inet addr:10.13.5.65 Bcast:10.13.5.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:889353 errors:0 dropped:0 overruns:0 frame:0
TX packets:669673 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:575960475 (549.2 MiB) TX bytes:363554025 (346.7 MiB)

Physically the wireless router D-Link DIR-320 has a 2-port router and a 6-port switch. One port of the switch is connected to the router, another one is the WAN port. The other 4 ports of the switch are the LAN ports on the back of DIR-320. The remaining port of the router is connected to the WLAN adapter.

Inside the switch exist two Virtual LANs (VLans) --- vlan0 and vlan1. vlan0 contains ports 4 LAN ports (ports 1--4) and one router port (port 6). vlan1 contains WAN port (port 0 or "Internet Port" written on the back) and router port (port 6).

There is a bridge (br0) bridging eth1 (WLAN) and eth0 (switch port 0). This bridge allows WLAN and LAN to share the same IP address. When the router needs to send information to clients, it broadcasts out br0 (to eth1 and vlan0). When we need to send information to Internet (WAN), router send directly to vlan1. 

$ brctl showmacs br0
port no    mac addr        is local?    ageing timer
  2    00:1b:9e:7f:96:38    no           0.77
  2    00:21:00:62:c1:86    no           0.00
  2    00:23:b4:ce:cd:4e    no          36.52
  1    00:90:4c:c0:00:00    yes           0.00
  2    00:90:4c:c1:00:00    yes           0.00

  2    02:90:4c:c1:00:00    no          29.23


4 comments:

ohmygod said...

The next most useful feature that I absolutely love about those firmwares is the ability to connect via PPPoE directly so that I can make the ADSL modem a bridge. The performance is much better for bittorrent.

wSuFF said...

have you tried network scanning with this device? any luck?

Phan Vinh Thinh said...

@ohmygod: I love the freedom they give.
@wSuFF: Yes, I've tried network scanning by sane-backends without any successes. xinetd doesn't want to execute from my USB stick.

wSuFF said...

I've tried same thing myself without also any luck, so wanted to know if anyone succeed..