Skip to content

Instantly share code, notes, and snippets.

@sclaret
Last active May 6, 2023 21:18
Show Gist options
  • Save sclaret/42df7b8698da14f248bd8571a302eec9 to your computer and use it in GitHub Desktop.
Save sclaret/42df7b8698da14f248bd8571a302eec9 to your computer and use it in GitHub Desktop.
OpenWrt v22.03.2 router

OpenWrt Router

https://openwrt.org/

https://downloads.openwrt.org/releases/

https://firmware-selector.openwrt.org/?version=22.03.2&target=mvebu%2Fcortexa9&id=linksys_wrt1900acs

https://github.com/openwrt/openwrt

https://github.com/openwrt/packages

https://doc.turris.cz/doc/en/public/start

Flash OpenWRT partition

Reboot into stock linksys firmware

https://openwrt.org/toh/linksys/wrt1900acs#return_to_stock_firmware

Connect LAN ethernet port to laptop

Connectivity -> Basic -> Router Firmware Update -> Manual

openwrt-22.03.2-mvebu-cortexa9-linksys_wrt1900acs-squashfs-factory.img

How to reboot from stock firmware into OpenWRT partition?

Troubleshooting -> Diagnostics -> Restore previous firmware

Configure Openwrt

https://d2cpnw0u24fjm4.cloudfront.net/wp-content/uploads/Wi-Fi-Channel-Allocations-5GHz-and-2.4GHz-WLAN-Pros.pdf

http://192.168.1.1/

System —> System Timezone: Americas / Toronto Sync with NTP-Server

scp ~/.ssh/id_rsa.pub root@192.168.1.1:/etc/dropbear/authorized_keys
ssh root@192.168.1.1
passwd
login to web page
cat /etc/config/dropbear
uci set dropbear.@dropbear[0].PasswordAuth=off
uci set dropbear.@dropbear[0].RootPasswordAuth=off
uci commit
service dropbear restart

sudo su -
rm ~/.ssh/known_hosts; ssh root@192.168.1.1
root@192.168.1.1: Permission denied (publickey).

cat /etc/config/wireless
uci set wireless.radio1.disabled=0
uci set wireless.radio1.txpower=30
uci set wireless.radio1.channel=6
uci set wireless.default_radio1.encryption=psk2
uci set wireless.default_radio1.ssid=
uci set wireless.default_radio1.key=

uci set wireless.radio0.disabled=0
uci set wireless.radio0.txpower=23
uci set wireless.radio0.channel=157
uci set wireless.default_radio0.ieee80211r=1
uci set wireless.default_radio0.ft_psk_generate_local=1
uci set wireless.default_radio0.encryption=psk2
uci set wireless.default_radio0.ssid=
uci set wireless.default_radio0.key=

uci set wireless.default_radio1.ssid=
uci set wireless.default_radio1.key=
uci set wireless.default_radio0.ssid=
uci set wireless.default_radio0.key=
uci commit

service network restart

ssh root@172.16.1.1
ip a
ip route
cat /etc/resolv.conf
cat /tmp/resolv.conf.d/resolv.conf.auto
iw reg get
iw dev
iw phy

PPPoE

https://openwrt.org/docs/guide-user/network/wan/isp-configurations?s%5B%5D=pppoe#bell_canada_fibe

Network -> Interfaces -> WAN

Edit -> Protocol -> PPPoE Switch Protocol Enter saved username, password Save Save & Apply

config interface 'wan'
	option device 'wan'
	option proto 'dhcp'
config interface 'wan'
	option device 'wan'
	option proto 'pppoe'
	option username '###'
	option password '###'
	option ipv6 'auto'

Tether

https://openwrt.org/docs/guide-user/network/wan/smartphone.usb.tethering

opkg update
opkg install kmod-usb-net-rndis

vim /etc/config/network
config interface 'wan'
	option device 'usb0'
	option proto 'dhcp'

logread -f
Tue Oct  5 18:44:02 2021 kern.info kernel: [71314.453624] usb 1-1: new high-speed USB device number 2 using orion-ehci
Tue Oct  5 18:44:02 2021 kern.info kernel: [71314.661016] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-f1058000.usb-1, RNDIS device, 02:3f:a2:6e:54:49
Tue Oct  5 18:46:52 2021 daemon.notice netifd: Interface 'wan' is enabled
Tue Oct  5 18:46:52 2021 kern.info kernel: [71484.313819] mv88e6085 f1072004.mdio-mii:00 wan: configuring for phy/gmii link mode
Tue Oct  5 18:46:52 2021 daemon.notice netifd: Interface 'wan6' is enabled
Tue Oct  5 18:46:52 2021 daemon.notice netifd: Interface 'wan' has link connectivity
Tue Oct  5 18:46:52 2021 daemon.notice netifd: Interface 'wan' is setting up now
Tue Oct  5 18:46:52 2021 kern.info kernel: [71484.333212] 8021q: adding VLAN 0 to HW filter on device wan
Tue Oct  5 18:46:52 2021 daemon.notice netifd: wan (6960): udhcpc: started, v1.33.1
Tue Oct  5 18:46:52 2021 daemon.notice netifd: wan (6960): udhcpc: sending discover
Tue Oct  5 18:46:52 2021 daemon.notice netifd: wan (6960): udhcpc: sending select for 192.168.23.238
Tue Oct  5 18:46:52 2021 daemon.notice netifd: wan (6960): udhcpc: lease of 192.168.23.238 obtained, lease time 3599
Tue Oct  5 18:46:52 2021 daemon.notice netifd: Interface 'wan' is now up
Tue Oct  5 18:46:52 2021 user.notice firewall: Reloading firewall due to ifup of wan (usb0)

ip a show usb0
18: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN qlen 1000
    link/ether 02:3f:a2:6e:54:49 brd ff:ff:ff:ff:ff:ff
    inet 192.168.23.238/24 brd 192.168.23.255 scope global usb0
       valid_lft forever preferred_lft forever
    inet6 fe80::3f:a2ff:fe6e:5449/64 scope link 
       valid_lft forever preferred_lft forever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment