Skip to content

Instantly share code, notes, and snippets.

@AzimsTech
Last active July 16, 2023 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AzimsTech/61e4fd6138dcbe3a536188e62164fc5d to your computer and use it in GitHub Desktop.
Save AzimsTech/61e4fd6138dcbe3a536188e62164fc5d to your computer and use it in GitHub Desktop.
TMNET UniFi with OpenWrt 22.03.x (DSA)

TMNet UniFi with OpenWrt 22.03.x (DSA)

                                   _______                     ________        __
                                  |       |.-----.-----.-----.|  |  |  |.----.|  |_
                                  |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
                                  |_______||   __|_____|__|__||________||__|  |____|
                                           |__| W I R E L E S S   F R E E D O M
                                  -----------------------------------------------------

SSH into OpenWrt Router

We use Windows PowerShell (Win + X >> Windows PowerShell):

rm -r "~\.ssh"
ssh root@192.168.1.1
Get-Childitem 

next time just use ssh root@192.168.1.1

How to tell: DSA vs Swconfig

DSA (eg: Mi Router 4A, D-Link DIR-882, Linksys E8450)

swconfig list
-bash: swconfig: not found

Swconfig (eg: Tp-Link Archer C7, D-Link DIR-842)

swconfig list
Found: switch0 - mdio.0

For Swconfig please use this guide instead OpenWrt 22.03.x TMNet UniFi Configurations | D-Link DIR-842 (swconfig)

Set up IPv6

uci set network.lan.ip6assign='64'
uci set network.lan.defaultroute='0'
uci set network.lan.delegate='0'
uci commit network 
ifup lan

Set up UniFi PPPoE Username & Password

PPPOE_USERNAME=xxxx@unifi
PPPOE_PASSWORD=xxxxxxxxxxxxxx
DNS_1=1.1.1.1
DNS_2=8.8.8.8
DNS6_1=2606:4700:4700::1111
DNS6_2=2001:4860:4860::8888
uci set network.wan.proto='pppoe'
uci set network.wan.username=$PPPOE_USERNAME
uci set network.wan.password=$PPPOE_PASSWORD
uci set network.wan.device='wan.500'
uci set network.wan.ipv6='1'
uci set network.wan.peerdns='0'
uci set network.wan.delegate='0'
uci set network.wan.dns="$DNS_1 $DNS_2"
uci set network.wan6.proto='dhcpv6'
uci set network.wan6.device='@wan'
uci set network.wan6.peerdns='0'
uci set network.wan6.dns="$DNS6_1 $DNS6_2"
uci commit network
ifup wan
echo 'Waiting for link to initialize'
sleep 20

Extras

Set Router Password

echo 'Updating root password'
NEWPASSWD=123
passwd <<EOF
$NEWPASSWD
$NEWPASSWD
EOF

Set Correct Timezone

TIMEZONE='<+08>-8'
ZONENAME='Asia/Kuala Lumpur'
echo 'Setting timezone to' $TIMEZONE
uci set system.@system[0].timezone="$TIMEZONE"
echo 'Setting zone name to' $ZONENAME 
uci set system.@system[0].zonename="$ZONENAME"
uci commit system
/etc/init.d/system reload

Set Router Hostname

HOSTNAME="DLiNK"
uci set system.@system[0].hostname=$HOSTNAME
uci set network.lan.hostname="`uci get system.@system[0].hostname`"
uci commit system
/etc/init.d/system reload

Install Optional Packages

opkg update                # retrieve updated packages
opkg install luci-app-sqm  # install the SQM modules to get fq_codel etc
opkg remove wpad-basic-wolfssl  # remove the non-mesh version of wpad
opkg install wpad-mesh-wolfssl  # Install the mesh supporting version
opkg intall luci-app-attendedsysupgrade # Install Attended Sysupgrade for keeping firmware up-to-date

Research

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