You are here: start » Linux notes » OpenWrt

OpenWrt

Introduction

In January 2006 we acquired an ASUS WL500G deluxe, which is a hardware router which also comes with a builtin 4-port ethernet switch, a wlan accesspoint and - which makes it very interesting - two USB2.0 ports. We reflashed that thing with the OpenWrt firmware, which went without any problems and turned the little device into a full sized linux box.

Quicknotes

  • Interfaces on ASUS WL500G Deluxe: LAN = vlan0, WAN = vlan0, WIFI = eth1

dnsmasq refuses to start

  • Symptom: Syntax error: network+192.168.1.100
  • Solution: dnsmasq expects the dhcp-ip-range to be given as integers, not as ip-adresses, so instead of
    nvram set dhcp_start 192.168.0.100
    nvram set dhcp_end 192.168.0.200
    nvram commit
    

    do a

    nvram set dhcp_start 100
    nvram set dhcp_end 200
    nvram commit
    

    and restart dnsmasq: /etc/init.d/S50dnsmasq

Source: OpenWrtDocs > dnsmasq

Remove bridge between wifi and lan interface

  • Add to /etc/firewall.user:
    WIFI=$(nvram get wifi_ifname)
    iptables -A FORWARD -i $WIFI -o $WAN -j ACCEPT
    iptables -A FORWARD -i $WIFI -o $LAN -j ACCEPT
    iptables -A FORWARD -i $LAN -o $WIFI -j ACCEPT
  • Set the following in nvram:
    lan_ifname=vlan0
    lan_proto=static
    lan_ipaddr=192.168.0.1
    lan_netmask=255.255.255.0
    
    wifi_ifname=eth1
    wifi_proto=static
    wifi_ipaddr=192.168.1.1
    wifi_netmask=255.255.255.0
    

    and commit it and reboot.

  • Add to /etc/dnsmasq.conf:
    dhcp-range=lan,192.168.0.100,192.168.0.199,2h
    dhcp-range=wlan,192.168.1.100,192.168.1.199,2h
    

    and do a killall -9 dnsmasq ; /etc/init.d/S50dnsmasq.

HP LaserJet 1000

  • On a standard linux box of your choice:
  • On your router:
    • Install the p910nd package according to the OpenWRT docs: ipkg install p910nd.
    • Install the kmod-usb-printer kernel modules: ipkg install kmod-usb-printer
    • Create a new file /etc/hotplug.d/usb/hplj1000:
      #!/bin/sh
       
      FIRMWARE="/data/sihp1000.img"
       
      if [ "$PRODUCT" = "3f0/517/120" ]
      then
              if [ "$ACTION" = "add" ]
              then
                      logger "Sending firmware to printer..."
                      cat $FIRMWARE > /dev/usb/lp0
                      logger "done."
              fi
      fi

      Remember to adjust the firmware location accordingly.

  • Now configure the clients from which you want to print, according to the OpenWRT docs. You're done :-)

Linkdump

linux/openwrt.txt · Last modified: 2008/03/26 12:35 (external edit)