OpenWRT

  • domain name for lan: lan.felixhummel.de

  • when setting up a new box, e.g. foo-box, it should resolve at foo-box.lan.felixhummel.de

  • DHCP should tell clients to search lan.felixhummel.de by default (see /etc/resolv.conf)

  • It should be possible to set wildcard DNS names for hosts, e.g. www.enterprise and also foo.bar.enterprise

UCI

UCI is the Unified Configuration Interface of OpenWRT.

uci --help

Set LAN Subnet to 10.1.1.0/24

10.1.1.X is just so much nicer to type than 192.168.1.X.

uci show network.lan
uci set network.lan.ipaddr=10.1.1.1
network.lan.netmask=255.255.255.0
uci changes
uci commit
/etc/init.d/network reload
# fetch new IP on client

Set wrt as the default gateway

uci add_list dhcp.lan.dhcp_option=option:router,10.1.1.1
uci commit dhcp

Set Domain

Sorry, just a quick note. You have to find out how to set this:

# uci show dhcp  | grep felix
dhcp.@dnsmasq[0].local='/lan.felixhummel.de/'
dhcp.@dnsmasq[0].domain='lan.felixhummel.de'

Wildcard Subdomains

  1. Set a static lease

  2. Set address

Static lease via LuCI:

  • Network > DHCP and DNS > Static Leases

  • name, ip

  • Save & Apply

Set address:

echo 'address=/enterprise/10.1.1.123' >> /etc/dnsmasq.conf
/etc/init.d/dnsmasq restart

Validate on another box:

dig @wrt +short enterprise
dig @wrt +short foo.enterprise
dig @wrt +short foo.bar.enterprise

Upgrade to Chaos Calmer

https://wiki.openwrt.org/de/doc/howto/generic.sysupgrade

on think (because wget on wrt does not like https):

mkdir /tmp/openwrt
cd /tmp/openwrt
wget https://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/openwrt-15.05-mpc85xx-generic-tl-wdr4900-v1-squashfs-sysupgrade.bin
wget https://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/openwrt-15.05-mpc85xx-generic-tl-wdr4900-v1-squashfs-sysupgrade.bin
grep openwrt-15.05-mpc85xx-generic-tl-wdr4900-v1-squashfs-sysupgrade.bin md5sums | md5sum -c -
scp openwrt-15.05-mpc85xx-generic-tl-wdr4900-v1-squashfs-sysupgrade.bin md5sums wrt:/tmp/

on wrt:

grep openwrt-15.05-mpc85xx-generic-tl-wdr4900-v1-squashfs-sysupgrade.bin md5sums | md5sum -c -
sysupgrade -v /tmp/openwrt-15.05-mpc85xx-generic-tl-wdr4900-v1-squashfs-sysupgrade.bin

Packages via SSL

Bemerkung

This uses chaos_calmer snapshot packages (https://dev.openwrt.org/ticket/19893)

/etc/opkg.conf:

src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/base
src/gz chaos_calmer_luci http://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/luci
src/gz chaos_calmer_management http://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/management
src/gz chaos_calmer_packages http://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/packages
src/gz chaos_calmer_routing http://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/routing
src/gz chaos_calmer_telephony http://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/telephony
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay

then

opkg install ca-certificates libopenssl wget

wget: can't load library 'libc.so':

cd /lib/
ln -s libc.so.0 libc.so

/etc/opkg.conf:

src/gz chaos_calmer_base https://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/base
src/gz chaos_calmer_luci https://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/luci
src/gz chaos_calmer_management https://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/management
src/gz chaos_calmer_packages https://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/packages
src/gz chaos_calmer_routing https://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/routing
src/gz chaos_calmer_telephony https://downloads.openwrt.org/chaos_calmer/15.05/mpc85xx/generic/packages/telephony
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay

finally:

opkg update

dnsmasq

Options known to dnsmasq:

dnsmasq --help dhcp

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