Locked History Actions

FFThemediumway

Installing openwrt on the router for the first time

Go to the openwrt firmware selector. Select your device. Download the "factory" firmware and install it to your router as described on its openwrt wiki page. (e.g. https://openwrt.org/toh/ubiquiti/edgerouter_x_er-x_ka)

Generating the funkfeuer firmware image

  1. Go to the openwrt firmware selector.

  2. Select your device.
  3. Click on "Customize installed packages and/or first boot script".
  4. Add the following packages to the list

curl mtr iperf3 tcpdump olsrd olsrd-mod-jsoninfo luci-app-olsr ethtool ipip kmod-ipip
  1. Copy the following script and paste it to "Script to run on first boot (uci-defaults)" on the image builder website
  2. Replace xxx in the first line with your location's name
  3. (optional) change LAN_IP and LAN_NET

The script contains some default values that make configuration easier.

#openwrt config script for funkfeuer graz
#written by gabor
export FF_HOSTNAME="xxx.graz.funkfeuer.at"
export LAN_IP="192.168.10.1/24"
export LAN_NET="192.168.10.0/24"

#check if already configured. prevents overwriting settings when upgrading openwrt
[ "$(uci -q get system.@system[0].hostname)" = "$FF_HOSTNAME" ] && exit 0

#disable olsrd6 (not used in ffgraz)
/etc/init.d/olsrd6 stop
/etc/init.d/olsrd6 disable

# /etc/config/dhcp
uci del dhcp.@dnsmasq[0].server
uci del dhcp.@dnsmasq[0].address
uci del dhcp.@dnsmasq[0].filterwin2k
uci del dhcp.@dnsmasq[0].nonegcache
uci del dhcp.@dnsmasq[0].nonwildcard
uci del dhcp.@dnsmasq[0].filter_aaaa
uci del dhcp.@dnsmasq[0].filter_a

#set dns resolver to 10.12.0.10
uci add_list dhcp.@dnsmasq[0].server='10.12.0.10'

#enable reverse dns lookup for 10.12.xxx.xxx addresses
uci add_list dhcp.@dnsmasq[0].address='/.12.10.in-addr.arpa/10.12.0.10'
uci set dhcp.@dnsmasq[0].boguspriv='0'

uci del dhcp.free

uci set dhcp.free=dhcp
uci set dhcp.free.interface='free'
uci set dhcp.free.start='10'
uci set dhcp.free.limit='254'
uci set dhcp.free.leasetime='1h'
uci add_list dhcp.free.dhcp_option='6,10.12.0.10'

# /etc/config/firewall
while uci -q delete firewall.@zone[0]; do :; done
while uci -q delete firewall.@forwarding[0]; do :; done
while uci -q delete firewall.@nat[0]; do :; done
while uci -q delete firewall.@rule[0]; do :; done
uci set firewall.cfg01e63d.synflood_protect='1'
uci add firewall zone # =cfg0edc81
uci set firewall.@zone[-1].name='ff'
uci set firewall.@zone[-1].input='DROP'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='ACCEPT'
uci add_list firewall.@zone[-1].network='ffeth'
uci add_list firewall.@zone[-1].network='ffwifimesh'

uci add firewall zone
uci set firewall.@zone[-1].name='lan'
uci set firewall.@zone[-1].input='ACCEPT'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='DROP'
uci add_list firewall.@zone[-1].network='lan'

uci add firewall rule # =cfg0f92bd
uci set firewall.@rule[-1].name='ssh'
uci add_list firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].src='ff'
uci set firewall.@rule[-1].dest_port='22'
uci set firewall.@rule[-1].target='ACCEPT'
uci set firewall.@rule[-1].name='ssh ff'

uci add firewall rule # =cfg1092bd
uci set firewall.@rule[-1].name='olsrd'
uci add_list firewall.@rule[-1].proto='udp'
uci set firewall.@rule[-1].src='ff'
uci set firewall.@rule[-1].dest_port='698'
uci set firewall.@rule[-1].target='ACCEPT'
uci set firewall.@rule[-1].name='olsrd ff'

uci add firewall zone # =cfg11dc81
uci set firewall.@zone[-1].name='free'
uci set firewall.@zone[-1].input='DROP'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='DROP'
uci add_list firewall.@zone[-1].network='free'

uci add firewall forwarding # =cfg13ad58
uci set firewall.@forwarding[-1].src='lan'
uci set firewall.@forwarding[-1].dest='ff'

uci add firewall forwarding # =cfg12ad58
uci set firewall.@forwarding[-1].src='free'
uci set firewall.@forwarding[-1].dest='ff'

uci add firewall nat # =cfg1393c8
uci set firewall.@nat[-1].name='nat free wifi to ff'
uci add_list firewall.@nat[-1].proto='all'
uci set firewall.@nat[-1].src='ff'
uci set firewall.@nat[-1].src_ip='10.14.0.0/24'
uci set firewall.@nat[-1].target='MASQUERADE'

uci add firewall nat # =cfg1393c8
uci set firewall.@nat[-1].name='nat lan to ff'
uci add_list firewall.@nat[-1].proto='all'
uci set firewall.@nat[-1].src='ff'
uci set firewall.@nat[-1].src_ip="$LAN_NET"
uci set firewall.@nat[-1].target='MASQUERADE'

uci add firewall rule # =cfg1492bd
uci set firewall.@rule[-1].name='web'
uci add_list firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].src='ff'
uci set firewall.@rule[-1].dest_port='80'
uci set firewall.@rule[-1].target='ACCEPT'
uci set firewall.@rule[-1].name='web ff'


uci add firewall rule # =cfg1592bd
uci set firewall.@rule[-1].name='ssh free'
uci add_list firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].src='free'
uci set firewall.@rule[-1].dest_port='22'
uci set firewall.@rule[-1].target='ACCEPT'


uci add firewall rule # =cfg1692bd
uci set firewall.@rule[-1].name='icmp ff'
uci add_list firewall.@rule[-1].proto='icmp'
uci set firewall.@rule[-1].src='ff'
uci set firewall.@rule[-1].target='ACCEPT'

uci add firewall rule # =cfg1792bd
uci set firewall.@rule[-1].name='icmp free'
uci add_list firewall.@rule[-1].proto='icmp'
uci set firewall.@rule[-1].src='free'
uci set firewall.@rule[-1].target='ACCEPT'

uci add firewall rule # =cfg0c92bd
uci set firewall.@rule[-1].name='dhcp free'
uci add_list firewall.@rule[-1].proto='udp'
uci set firewall.@rule[-1].src='free'
uci set firewall.@rule[-1].src_port='68'
uci set firewall.@rule[-1].dest_port='67'
uci set firewall.@rule[-1].target='ACCEPT'

# /etc/config/network
uci del network.wan
uci del network.wan6

uci del network.lan.netmask
uci del network.lan.ipaddr
uci add_list network.lan.ipaddr="$LAN_IP"

uci del network.globals.ula_prefix
uci set network.globals.packet_steering='1'

uci add network device # =cfg080f15
uci set network.@device[-1].type='bridge'
uci set network.@device[-1].name='br-free'
uci set network.@device[-1].bridge_empty='1'

uci del network.free
uci set network.free=interface
uci set network.free.device='br-free'
uci set network.free.proto='static'
uci add_list network.free.ipaddr='10.14.0.1/24'

# /etc/config/wireless
i=0
while uci -q get "wireless.radio$i"
do
 uci set wireless.wifinetfree$i=wifi-iface
 uci set wireless.wifinetfree$i.device=radio$i
 uci set wireless.wifinetfree$i.mode='ap'
 uci set wireless.wifinetfree$i.ssid='Free WiFi - graz.funkfeuer.at'
 uci set wireless.wifinetfree$i.encryption='none'
 uci set wireless.wifinetfree$i.network='free'
 uci set wireless.wifinetfree$i.disabled='1'
 i=$(( $i + 1 ))
done

# /etc/config/system
uci del system.ntp.enabled
uci del system.ntp.enable_server
uci set system.cfg01e48a.hostname=$FF_HOSTNAME
uci set system.cfg01e48a.zonename='Europe/Vienna'
uci set system.cfg01e48a.timezone='CET-1CEST,M3.5.0,M10.5.0/3'
uci set system.cfg01e48a.log_proto='udp'
uci set system.cfg01e48a.conloglevel='8'
uci set system.cfg01e48a.cronloglevel='5'
# /etc/config/wireless

while uci -q delete olsrd.@Interface[0]; do :; done

uci set olsrd.@LoadPlugin[-1].ignore='0'
uci set olsrd.@LoadPlugin[-1].library='olsrd_jsoninfo'

while uci -q delete olsrd.@InterfaceDefaults[0]; do :; done
uci add olsrd InterfaceDefaults
uci set olsrd.@InterfaceDefaults[-1].Mode='ether'
uci set olsrd.@InterfaceDefaults[-1].Ip4Broadcast='255.255.255.255'

  1. Click on "Request Build" and wait for the build to complete.
  2. Download the newly built custom sysupgrade image
  3. Log in to your router using the web interface (http://192.168.1.1)

  4. Go to "System->Backup/Flash Firmware"

  5. Click on "Flash image" and select your newly downloaded sysupgrade image.
  6. Untick the box "Keep settings and retain the current configuration"
  7. Click "Continue"

Accessing the router

After the installation has completed the router should be reachable by connecting to it LAN port using the configured LAN_IP (192.168.10.1 as default).

TODO: add interfaces for olsrd, setup olsrd, setup wifi, setup free wifi