OpenWRT

  • domain name for lan: lan.felixhummel.de
  • when setting up a new box, e.g. ubuntu-box, it should be reachable at ubuntu-box.lan.felixhummel.de
  • DHCP should tell clients to search lan.felixhummel.de by default (see /etc/resolv.conf)
  • should be possible to add subdomains (see Subdomains with Dnsmasq)

WRT54GL

Reset

  • remove power cable
  • hold reset button
  • insert power cable
  • when DMZ led up: release reset button
  • telnet 192.168.1.1

White Russian to Backfire

scp openwrt-brcm47xx-squashfs.trx md5sums root@192.168.1.1:
ssh root@192.168.1.1
md5sum -c md5sums
mtd -r write openwrt-brcm47xx-squashfs.trx linux

wait for it...

ping -i 2 192.168.1.1

Configure DHCP

Note

outdated

  • DSL-Router at 192.168.1.1
  • wrt = DHCP Server = 192.168.1.2
  • Network > Interfaces > LAN: for now: lease time 2m – TODO: up to 72h
  • default gateway (wiki)

/etc/config/dhcp:

config 'dhcp' 'lan'
        [...]
        list 'dhcp_option' '3,192.168.1.2'

Subdomains with Dnsmasq

Note

outdated

After setting a domain name, everything else falls into place. This is called “Zone delegation”. See Set Domain.

Effectively foo.enterprise becomes foo.enterprise.lan.felixhummel.de , because search lan.felixhummel.de is set in /etc/resolv.conf via DHCP.

Just make sure web servers listen on both names, e.g.:

server {
  server_name foo.enterprise foo.enterprise.lan.felixhummel.de;
  listen 443 default_server ssl http2;
  [...]

Thanks, Santiago!

Mission: Subdomains for enterprise (192.168.1.3), e.g. mail.enterprise.lan or www.enterprise.lan ...

vim /etc/dnsmasq.conf

For enterprise.lan, add the line:

address=/enterprise.lan/192.168.1.3

Reload dnsmasq and try it (either locally or on another box):

/etc/init.d/dnsmasq reload
nslookup www.enterprise.lan

Options known to dnsmasq:

root@wrt:~# dnsmasq --help dhcp
Known DHCP options:
  1 netmask
  2 time-offset
  3 router
  6 dns-server
  7 log-server
  9 lpr-server
 13 boot-file-size
 15 domain-name
 16 swap-server
 17 root-path
 18 extension-path
 19 ip-forward-enable
 20 non-local-source-routing
 21 policy-filter
 22 max-datagram-reassembly
 23 default-ttl
 26 mtu
 27 all-subnets-local
 31 router-discovery
 32 router-solicitation
 33 static-route
 34 trailer-encapsulation
 35 arp-timeout
 36 ethernet-encap
 37 tcp-ttl
 38 tcp-keepalive
 40 nis-domain
 41 nis-server
 42 ntp-server
 44 netbios-ns
 45 netbios-dd
 46 netbios-nodetype
 47 netbios-scope
 48 x-windows-fs
 49 x-windows-dm
 60 vendor-class
 64 nis+-domain
 65 nis+-server
 66 tftp-server
 67 bootfile-name
 68 mobile-ip-home
 69 smtp-server
 70 pop3-server
 71 nntp-server
 74 irc-server
 77 user-class
 93 client-arch
 94 client-interface-id
 97 client-machine-id
119 domain-search
120 sip-server
121 classless-static-route
125 vendor-id-encap
255 server-ip-address

Prometheus Exporter

https://github.com/jschornick/openwrt_exporter

opkg install luasocket
wget https://raw.githubusercontent.com/jschornick/openwrt_exporter/master/metrics.lua
./metrics.lua --port 9001