Skip to content

Instantly share code, notes, and snippets.

@brianonn
Created September 15, 2024 06:24
Show Gist options
  • Save brianonn/1e8fe38957bafbcbac78732fef01ad63 to your computer and use it in GitHub Desktop.
Save brianonn/1e8fe38957bafbcbac78732fef01ad63 to your computer and use it in GitHub Desktop.
#!/bin/sh
# test -f /root/wakeup.sh && exit 0
uci batch <<EOF
set system.@system[0].hostname='WR703N'
set system.@system[0].conloglevel=8
set system.@system[0].cronloglevel=8
set system.@system[0].timezone=HKT-8
set system.@system[0].zonename='Asia/Hong Kong'
delete system.ntp.server
add_list system.ntp.server='0.asia.pool.ntp.org'
add_list system.ntp.server='time.asia.apple.com'
add_list system.ntp.server='time.windows.com'
commit system
EOF
uci batch <<EOF
# set dropbear.@dropbear[0].Interface=lan
set dropbear.@dropbear[0].Port=22
set dropbear.@dropbear[0].PasswordAuth=off
set dropbear.@dropbear[0].RootPasswordAuth=off
set dropbear.@dropbear[0].GatewayPorts=on
commit dropbear
EOF
uci batch <<EOF
add firewall rule
set firewall.@rule[-1].name='Allow-SSH'
set firewall.@rule[-1].src=wan
set firewall.@rule[-1].target=ACCEPT
set firewall.@rule[-1].proto=tcp
set firewall.@rule[-1].dest_port=22
commit firewall
EOF
uci batch <<EOF
set wireless.radio0.disabled=0
set wireless.radio0.channel=6
set wireless.radio0.hwmode=11g
set wireless.radio0.htmode=HT20
set wireless.radio0.txpower=20
set wireless.radio0.country=HK
set wireless.@wifi-iface[0].disabled=0
set wireless.@wifi-iface[0].network=lan
set wireless.@wifi-iface[0].mode=ap
set wireless.@wifi-iface[0].ssid=myssid
set wireless.@wifi-iface[0].encryption='psk2+ccmp'
set wireless.@wifi-iface[0].key='mypassword'
# set wireless.@wifi-iface[0].macfilter=allow
# add_list wireless.@wifi-iface[0].maclist=AA:BB:CC:DD:EE:FF
# set wireless.@wifi-iface[0].hidden=1
commit wireless
EOF
uci batch <<EOF
set dhcp.lan.leasetime=12h
set dhcp.lan.start=101
set dhcp.lan.limit=99
set dhcp.lan.ra_management=1
add dhcp host
set dhcp.@host[0]=host
set dhcp.@host[0].name=Evan-PC
set dhcp.@host[0].mac=11:11:11:11:11:11
set dhcp.@host[0].ip=192.168.128.2
add dhcp host
set dhcp.@host[1]=host
set dhcp.@host[1].name=Evan-phone
set dhcp.@host[1].mac=22:22:22:22:22:22
set dhcp.@host[1].ip=192.168.128.3
commit dhcp
EOF
uci batch <<EOF
delete network.globals
set network.lan=interface
delete network.lan.ifname
delete network.lan.type
set network.lan.proto=static
set network.lan.ipaddr=192.168.128.1
set network.lan.netmask=255.255.255.0
set network.wan=interface
set network.wan.ifname=eth0
set network.wan.proto=dhcp
set network.wan.macaddr=01:23:45:67:89:AB
set network.wan6=interface
set network.wan6.proto=6to4
commit network
EOF
uci batch <<EOF
set ddns.myddns_ipv4.enabled=1
set ddns.myddns_ipv4.service_name='No-IP.com'
set ddns.myddns_ipv4.username=myusername
set ddns.myddns_ipv4.password=mypassword
set ddns.myddns_ipv4.domain='mydomain.ddns.net'
set ddns.myddns_ipv4.ip_source=network
set ddns.myddns_ipv4.force_interval=24
set ddns.myddns_ipv4.force_unit=hours
set ddns.myddns_ipv4.check_interval=10
set ddns.myddns_ipv4.check_unit=minutes
commit ddns
EOF
exit 0
@brianonn
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment