# Matt Kemner's guide to turning the Linksys WRT54G / WRT54GS # into an AP-client + routing node on WaFreeNet and similar networks. # Copyright 2004 Matt Kemner # Much thanks to Shane Short for contributing to, and proof reading this document. # I take no responsibility if following the steps in this document # damages your router. Caveat Emptor. # Flash router with firmware (see http://www.openwrt.org/OpenWrtDocs/Installing) # I strongly recommend setting boot_wait as described # After reflashing the router will automatically reboot and then will run # a script called "firstboot" that creates the partitions, which takes some time # DO NOT reboot the router while it is doing this. # Wait until you are able to telnet in AND the DMZ light is off # partitions should look something like this: # root@OpenWrt:/# df # Filesystem 1k-blocks Used Available Use% Mounted on # /dev/root 896 896 0 100% /rom # /dev/mtdblock/4 6272 672 5600 11% / # Initially you will want to plug into one of the LAN ports. # Default IP address is 192.168.1.1 # use "telnet" to connect to that IP address. # First, remove the firewall, since it will only get in the way # A custom firewall can be configured later if required rm /etc/init.d/S45firewall ################# # Configuration # ################# # It is probably best to do these one interface at a time, to avoid # locking yourself out. # All wireless settings etc are stored in the nvram, and are configured # with the "nvram" utility # to show current settings: nvram show # you can search for specific settings with grep: # show all keys containing "wan_" nvram show | grep wan_ # show all keys containing "lan_" nvram show | grep lan_ # you change a key with: nvram set key=value # After setting the nvram values you need to commit them to memory with nvram commit # and then reboot. # see available nvram settings at http://openwrt.org/OpenWrtNVRAM ##################################### # I would do this first: # configure WAN (vlan1) IP address nvram set wan_proto=static nvram set wan_ipaddr=x.x.x.x nvram set wan_netmask=255.255.255.x # set a default gateway nvram set wan_gateway=x.x.x.x # and specify a DNS server nvram set wan_dns=x.x.x.x nvram commit # then reboot, and plug yourself into the WAN port # and telnet into the IP address you just configured. # When you have that working you can move onto the next step # That way if you mess up, you can still get back in to fix it. # remove bridge, set lan_ifname to vlan0 (lan ports) instead of br0: nvram set lan_ifname=vlan0 nvram unset lan_ifnames # configure LAN (vlan0) IP address: nvram set lan_proto=static nvram set lan_ipaddr=x.x.x.x nvram set lan_netmask=255.255.255.x # configure wireless (eth1) IP address nvram set wifi_ifname=eth1 # NOTE this may be different on older WRT54G nvram set wifi_proto=static nvram set wifi_ipaddr=10.60.30.34 nvram set wifi_netmask=255.255.255.252 # Switch off antenna diversity (only use main antenna, next to power socket) nvram set wl0_antdiv=0 # Set to station (client) mode nvram set wl0_mode=sta # use mode=ap if you want this to be an AP # Connect to this ESSID nvram set wl0_ssid=NEFreenet2 # To enable WEP do this: nvram set wl0_wep=on nvram set wl0_key1=DEADBEEF12 # WEP key in hex or ascii # repeat for wl0_key2 -> wl0_key4 # 5 or 13 ascii chars OR 10 or 26 hex chars nvram commit # Now reboot again and test both the LAN and WiFi interfaces # You might also want to set a hostname nvram set wan_hostname=mylinksys ##################################### # you will want to download some tools # so make sure your router can get to the internet. ipkg update ipkg install quagga-bgpd quagga-zebra ip tcpdump dropbear # it should download and install quagga and a couple of other # handy tools including the dropbear ssh server. # quagga configuration is beyond the scope of this document # If you are on WaFreeNet and are a routing node, ask me # (zombie @ wafreenet.org) for sample quagga config. # Once dropbear is installed, it will ask you set a root password. # reboot, check ssh works, then remove /etc/init.d/S50telnet rm /etc/init.d/S50telnet # You will probably also want this handy wireless config tool: ipkg install http://wrt54g.free.fr/openwrt/b4/ipkg/wl_1.0_mipsel.ipk # then you can do nifty things like: wl scan ; sleep 1 ; wl scanresults ################### # Optional extras # ################### # Set the timezone # see http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html#tag_08_02 for info echo WST-8 > /etc/TZ # West Australian Standard Time # for NSW, Vic etc, you would use something like: # AEST-10AEDT,M10.5.0,M3.5.0/03:00:00 # (DST starts last Sunday of Oct, ends last Sun of Mar 3am) # http://alldownunder.com/oz-k/date/australian-daylight-savings.htm # set the clock rdate 10.60.0.102 # specify a server supporting time (37/tcp) protocol # which can be enabled in inetd on any linux box # for NFS client: ipkg install kmod-nfs ; insmod sunrpc; insmod lockd; insmod nfs then to mount: mount -t nfs -o nolock remote:/path /local/path # for frottle: # Unlink the ipkg.conf so it can be edited rm /etc/ipkg.conf cp /rom/etc/ipkg.conf /etc/ipkg.conf # edit ipkg.conf (vi /etc/ipkg.conf) and add this line: src frottle http://www.penguincare.com.au/frottle/ # crash course in vi: type "i" to go into "insert" mode, "esc" to escape # so scroll to the next line, type "i", paste that line, push "esc" # then type "ZZ" (shift-z-z) to save and exit # or if you mess up, hit escape then type ":q!" # then type: ipkg update ipkg install frottle # You will also want to grab this kernel module from the openwrt-kmodules.tar.bz2 file # modules/2.4.20/kernel/net/ipv4/netfilter/ip_queue.o # and copy it to the linksys under /lib/modules/2.4.20/ # frottle configuration is also beyond the scope of this document # frottle info at http://frottle.sf.net/ ####################### # How to set up cron: # ####################### # Create /etc/crontabs and /etc/crontabs/root mkdir /etc/crontabs vi /etc/crontabs/root # eg add a line that says: 0 * * * * rdate 10.60.0.102 # # Then create /etc/init.d/S60crond containing: #!/bin/sh /bin/mkdir -p /var/spool/cron /bin/ln -s /etc/crontabs /var/spool/cron/crontabs /usr/sbin/crond ########################################################################## # how to put port1 on its own IP address, and leave port2-4 as LAN ports # ########################################################################## # Create a new vlan based on et0 (which is what the linksys calls eth0) nvram set vlan2hwname=et0 # vlan0 (LAN) ports are now 2 3 and 4 (5 is connected to the internal NIC) nvram set vlan0ports="2 3 4 5*" # vlan2 is now only port1 (and the internal port 5) nvram set vlan2ports="1 5" # create another interface name (I used "port1") and configure as usual: nvram set port1_ifname=vlan2 nvram set port1_hwaddr=00:0F:66:C5:2C:04 nvram set port1_proto=static nvram set port1_ipaddr=192.168.61.1 nvram set port1_netmask=255.255.255.252 nvram set port1_mtu=1500 # Create an init script, or add to an existing one this line: ifup port1 # or whatever you chose