Start service on boot

OpenWrt does not have update-rc.d or chkconfig. To start a service called service-name on boot, run:

   1 /etc/init.d/service-name enable

Enable SSH from WAN

Place into /etc/firewall.user:

   1 iptables --append input_wan --protocol tcp --dport 22 --jump ACCEPT

When SSH from WAN is enabled, it's probably a good idea to disable password logins via SSH (only public key authentication will be allowed):

   1 sed -i -e "s/'on'/'off'/"  /etc/config/dropbear

will set PasswordAuth option to "off", making /etc/config/dropbear look like:

config dropbear
        option PasswordAuth 'off'
        option Port         '22'

Unlock root data partition

OpenWrt sometimes does not unlock the data partition. I've particularly noticed this on the WRT54GL and OpenWrt 10.03.

mtd unlock rootfs_data

Use custom DNS server

Create /etc/resolv.local containing nameserver entries. Add resolv-file to dnsmasq.conf:

echo resolv-file=/etc/resolv.local >> /etc/dnsmasq.conf

and restart dnsmasq:

/etc/init.d/dnsmasq restart

Useful packages

Package

Use

miniupnpd luci-app-upnp

Enable UPnP so ports in firewall can automatically be opened

umdns

Lightweight Avahi/mDNS server

IPv6

opkg install iputils-traceroute6 # IPv6 traceroute

Statistcs and collectd

   1 # Install luci statistics app, collectd, and some useful collectd modules
   2 opkg update
   3 opkg install luci-app-statistics
   4 opkg install collectd-mod-interface collectd-mod-memory collectd-mod-ping collectd-mod-rrdtool collectd-mod-wireless collectd-mod-conntrack collectd-mod-cpu collectd-mod-iptables collectd-mod-uptime
   5 
   6 uci get luci_statistics.collectd_interface.Interfaces
   7 uci set luci_statistics.collectd_interface.Interfaces='br-lan 6in4-henet'
   8 # wan interfaces only
   9 uci set luci_statistics.collectd_interface.Interfaces='eth1 6in4-henet'
  10 
  11 # set wireless interfaces
  12 uci get luci_statistics.collectd_iwinfo.Interfaces
  13 uci add_list luci_statistics.collectd_iwinfo.Interfaces='wlan0'
  14 uci add_list luci_statistics.collectd_iwinfo.Interfaces='wlan1'
  15 
  16 uci set luci_statistics.collectd.Interval=60
  17 uci commit luci_statistics
  18 
  19 /etc/init.d/luci_statistics enable
  20 /etc/init.d/collectd enable

Useful reads

Setting up NAT64 and DNS64 on OpenWRT, for IPv6-only networks.

My complete OpenWrt setup guide. Comprehensive, from-scratch setup guide.


CategoryCheatSheet