WRT54GL Linksys Routers

From HeadBackup
Jump to navigationJump to search

Introduction

Things I have done with a WRT54GL router running ddwrt custom firmware:

  • Single router with 2 subnets each with seperate vlan, IP block, DHCP server, and firewall rules.
  • VLAN trunking
  • QoS traffic prioritization based on IP address
  • WPA encrypted wireless point to multipoint bridging

Things I may implement in the future:

  • Multiple wireless networks on the same router with different SSIDs and different vlan tags

Useful Links

WRT54GL port diagram

http://garycourt.com/wp-content/images/WRT54_sw2_internal_architecture.png

WRT54GL ports in a table

http://nuwiki.openwrt.org/toh/linksys/wrt54gl#switch.ports.for.vlans

802.1q trunking instructions

http://www.geek-pages.com/articles/latest/802.1q_trunking_on_the_linksys_wrt54g/s/l_with_dd-wrt.html

Additional DNSmasq notes (for setting default gateway, etc)

http://www.dd-wrt.com/wiki/index.php/DNSMasq_as_DHCP_server
http://osdir.com/ml/network.dns.dnsmasq.general/2005-08/msg00046.html


Details

Configure an AP running DDWRT to do trunking

These steps assume you want to split out the wireless and the wired ports. Wired will be on vlan2 and wireless will be on vlan3 with both vlans trunked via the WAN port to a vlan aware switch. This router already has DHCP disabled and is not acting as a firewall, only an AP.

nvram set vlan0ports=
nvram set vlan2ports="0 1 2 3 4t"
nvram set vlan3ports="4t 5t"
nvram set vlan3hwname=et0
nvram commit
reboot

The last step is to configure your vlans in the web interface as follows:

Ddwrt ap vlans.jpg
The end result is that you can use the same router to connect wired and wireless devices while keeping them on separate vlans.

Adding a third vlan and network

These steps assume you already have two other vlans configured and you only want to trunk the new vlan up to another switch. Also, there are additional steps required if you wanted to enable DHCP service on the new network.

Add ports to the new vlan

nvram set vlan4ports="0t 5t"
nvram commit

Create a startup script to load firewall rules and configure the interface

echo '
#!/bin/ash
PATH="/sbin:/usr/sbin:/bin:/usr/bin:${PATH}"
iptables -I FORWARD -i br0 -o vlan4 -j ACCEPT
iptables -I FORWARD -i vlan4 -o br0 -j ACCEPT
iptables -I FORWARD -i vlan4 -o vlan1 -j ACCEPT 
iptables -I INPUT -i vlan4 -j ACCEPT  
ip addr add 10.7.1.7/24 brd + dev vlan4 
ifconfig vlan4 up
' > /jffs/etc/config/vlan4.startup  
chmod 750 /jffs/etc/config/vlan4.startup 

Add the new vlan to the trunk port

In the web based DDWRT GUI add the additional vlan to your trunk port.