#!/bin/sh # Don't override existing settings uci -q get network.globals && exit 0 r1=$(dd if=/dev/urandom bs=1 count=1 |hexdump -e '1/1 "%02x"') r2=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"') r3=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"') uci -q batch <<-EOF >/dev/null set network.globals=globals set network.globals.ula_prefix=fd$r1:$r2:$r3::/48 set network.lan.ip6assign=60 set network.wan.ipv6=1 commit network EOF # Set wan6 interface if non-existant uci -q get network.wan6 && exit 0 uci -q batch <<-EOF >/dev/null set network.wan6=interface set network.wan6.proto=dhcpv6 set network.wan6.ifname=@wan commit network EOF