OpenWRT: Difference between revisions
NickPGSmith (talk | contribs) |
NickPGSmith (talk | contribs) |
||
(25 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Devices == | == Devices == | ||
=== TP-Link Archer C7 v4 / v5 === | |||
=== TP-Link Archer C7 v4 === | |||
* [https://openwrt.org/toh/tp-link/archer_c7 Device page] | * [https://openwrt.org/toh/tp-link/archer_c7 Device page] | ||
* 775 MHz CPU, 16 MiB flash, 128 MiB RAM | * 775 MHz CPU, 16 MiB flash, 128 MiB RAM | ||
* Currently Installed: 23.05.2 | * Currently Installed: 23.05.5 | ||
* Max Power (2.4/5): 24/30 dBm | |||
* When routing/firewall, max throughput is ~ 135 Mbps until "Software flow offloading" is enabled. | |||
* Can trigger on WPS button with script in /etc/rc.button/wps | |||
=== HooToo TripMate Nano (HT-TM02) === | === HooToo TripMate Nano (HT-TM02) === | ||
Line 336: | Line 69: | ||
cp "$config/$file" $CONFIG | cp "$config/$file" $CONFIG | ||
done | done | ||
== Configuration and Commands == | == Configuration and Commands == | ||
Line 375: | Line 85: | ||
* network | * network | ||
* firewall | * firewall | ||
* [https://www.youtube.com/watch?v=UvniZs8q3eU OpenWRT setmentation] | |||
Disable IPv6 DHCP Server: | |||
* Interface -> IPv6 -> | |||
** RA-Servce: disabled | |||
** DHCPv6-Service: disabled | |||
** NDP-Proxy: disabled | |||
Custom startup scripts: | Custom startup scripts: | ||
Line 391: | Line 109: | ||
* resolv.conf symlinked to /tmp/resolv.conf which points to local dnsmasq service which delivers from its cache or via DNS servers pointed to by proxies resolv.conf.auto (DHCP client updated) | * resolv.conf symlinked to /tmp/resolv.conf which points to local dnsmasq service which delivers from its cache or via DNS servers pointed to by proxies resolv.conf.auto (DHCP client updated) | ||
* See also [https://openwrt.org/docs/guide-user/base-system/dns_configuration here] | * See also [https://openwrt.org/docs/guide-user/base-system/dns_configuration here] | ||
=== Package Management === | |||
opkg update | |||
opkg list | |||
opkg list-installed | |||
opkg install blah | |||
opkg remove blah | |||
=== Reset === | |||
* Controlled by /etc/rc.button/reset | |||
* Quick press of reset button reboots | |||
* Failsafe (long press) forces network to: | |||
** 192.168.1.1 / 255.255.255.0 | |||
** SSH open with root / no password | |||
** "firstboot" command to revert to factory defaults | |||
** Hard factory reset (to 192.168.1.1.): umount /overlay && jffs2reset && reboot now | |||
** "mount_root" to mount root partition | |||
=== Wifi commands === | === Wifi commands === | ||
Line 448: | Line 185: | ||
return 0 | return 0 | ||
root@wifi-ht:/etc/rc.button# | root@wifi-ht:/etc/rc.button# | ||
=== 6in4 === | === 6in4 === | ||
Line 510: | Line 218: | ||
ifup henet | ifup henet | ||
/etc/init.d/firewall restart | /etc/init.d/firewall restart | ||
== Regulatory Domains and Channels == | |||
iw reg set GB | |||
iw reg get | |||
Regulatory domains defined in: | |||
/lib/firmware/regulatory.db | |||
* [https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git Regulatory Database Github] | |||
See [https://openwrt.org/docs/guide-user/network/wifi/wifi_countrycode here] for explanation of format. | |||
The following lists taken from: | |||
iw list | |||
=== 2.4 GHz === | |||
CA | |||
* '''2412 MHz [1] (30.0 dBm)''' | |||
* 2417 MHz [2] (30.0 dBm) | |||
* 2422 MHz [3] (30.0 dBm) | |||
* 2427 MHz [4] (30.0 dBm) | |||
* '''2432 MHz [5] (30.0 dBm)''' | |||
* 2437 MHz [6] (30.0 dBm) | |||
* 2442 MHz [7] (30.0 dBm) | |||
* 2447 MHz [8] (30.0 dBm) | |||
* 2452 MHz [9] (30.0 dBm) | |||
* 2457 MHz [10] (30.0 dBm) | |||
* 2462 MHz [11] (30.0 dBm) | |||
* 2467 MHz [12] (disabled) | |||
* 2472 MHz [13] (disabled) | |||
* 2484 MHz [14] (disabled) | |||
PA | |||
* 2412 MHz [1] (24.0 dBm) | |||
* 2417 MHz [2] (24.0 dBm) | |||
* 2422 MHz [3] (24.0 dBm) | |||
* 2427 MHz [4] (24.0 dBm) | |||
* 2432 MHz [5] (24.0 dBm) | |||
* 2437 MHz [6] (24.0 dBm) | |||
* 2442 MHz [7] (24.0 dBm) | |||
* 2447 MHz [8] (24.0 dBm) | |||
* 2452 MHz [9] (24.0 dBm) | |||
* 2457 MHz [10] (24.0 dBm) | |||
* 2462 MHz [11] (24.0 dBm) | |||
* 2467 MHz [12] (24.0 dBm) | |||
* '''2472 MHz [13] (24.0 dBm)''' | |||
* 2484 MHz [14] (disabled) | |||
UK | |||
* 2412 MHz [1] (20.0 dBm) | |||
* 2417 MHz [2] (20.0 dBm) | |||
* 2422 MHz [3] (20.0 dBm) | |||
* 2427 MHz [4] (20.0 dBm) | |||
* 2432 MHz [5] (20.0 dBm) | |||
* 2437 MHz [6] (20.0 dBm) | |||
* 2442 MHz [7] (20.0 dBm) | |||
* 2447 MHz [8] (20.0 dBm) | |||
* 2452 MHz [9] (20.0 dBm) | |||
* 2457 MHz [10] (20.0 dBm) | |||
* 2462 MHz [11] (20.0 dBm) | |||
* 2467 MHz [12] (20.0 dBm) | |||
* 2472 MHz [13] (20.0 dBm) | |||
* 2484 MHz [14] (disabled) | |||
=== 5 GHz === | |||
IN | |||
* 5180 MHz [36] (30.0 dBm) | |||
* 5200 MHz [40] (30.0 dBm) | |||
* 5220 MHz [44] (30.0 dBm) | |||
* 5240 MHz [48] (30.0 dBm) | |||
* 5260 MHz [52] (24.0 dBm) | |||
* 5280 MHz [56] (24.0 dBm) | |||
* 5300 MHz [60] (24.0 dBm) | |||
* 5320 MHz [64] (24.0 dBm) | |||
* 5500 MHz [100] (24.0 dBm) | |||
* 5520 MHz [104] (24.0 dBm) | |||
* 5540 MHz [108] (24.0 dBm) | |||
* 5560 MHz [112] (24.0 dBm) | |||
* 5580 MHz [116] (24.0 dBm) | |||
* 5600 MHz [120] (24.0 dBm) | |||
* 5620 MHz [124] (24.0 dBm) | |||
* 5640 MHz [128] (24.0 dBm) | |||
* 5660 MHz [132] (24.0 dBm) | |||
* 5680 MHz [136] (24.0 dBm) | |||
* 5700 MHz [140] (24.0 dBm) | |||
* 5720 MHz [144] (24.0 dBm) | |||
* 5745 MHz [149] (30.0 dBm) | |||
* 5765 MHz [153] (30.0 dBm) | |||
* 5785 MHz [157] (30.0 dBm) | |||
* 5805 MHz [161] (30.0 dBm) | |||
* 5825 MHz [165] (30.0 dBm) | |||
* 5845 MHz [169] (30.0 dBm) | |||
* 5865 MHz [173] (30.0 dBm) | |||
PA | |||
* 5180 MHz [36] (30.0 dBm) | |||
* 5200 MHz [40] (30.0 dBm) | |||
* 5220 MHz [44] (30.0 dBm) | |||
* 5240 MHz [48] (30.0 dBm) | |||
* 5260 MHz [52] (30.0 dBm) | |||
* 5280 MHz [56] (30.0 dBm) | |||
* 5300 MHz [60] (30.0 dBm) | |||
* 5320 MHz [64] (30.0 dBm) | |||
* 5500 MHz [100] (30.0 dBm) | |||
* 5520 MHz [104] (30.0 dBm) | |||
* 5540 MHz [108] (30.0 dBm) | |||
* 5560 MHz [112] (30.0 dBm) | |||
* 5580 MHz [116] (30.0 dBm) | |||
* 5600 MHz [120] (30.0 dBm) | |||
* 5620 MHz [124] (30.0 dBm) | |||
* 5640 MHz [128] (30.0 dBm) | |||
* '''5660 MHz [132] (30.0 dBm)''' | |||
* 5680 MHz [136] (30.0 dBm) | |||
* 5700 MHz [140] (30.0 dBm) | |||
* 5720 MHz [144] (30.0 dBm) | |||
* '''5745 MHz [149] (30.0 dBm)''' | |||
* 5765 MHz [153] (30.0 dBm) | |||
* 5785 MHz [157] (30.0 dBm) | |||
* 5805 MHz [161] (30.0 dBm) | |||
* 5825 MHz [165] (30.0 dBm) | |||
* 5845 MHz [169] (disabled) | |||
* 5865 MHz [173] (disabled) | |||
UK | |||
* 5180 MHz [36] (23.0 dBm) | |||
* 5200 MHz [40] (23.0 dBm) | |||
* 5220 MHz [44] (23.0 dBm) | |||
* 5240 MHz [48] (23.0 dBm) | |||
* 5260 MHz [52] (20.0 dBm) (radar detection) | |||
* 5280 MHz [56] (20.0 dBm) (radar detection) | |||
* 5300 MHz [60] (20.0 dBm) (radar detection) | |||
* 5320 MHz [64] (20.0 dBm) (radar detection) | |||
* 5500 MHz [100] (26.0 dBm) (radar detection) | |||
* 5520 MHz [104] (26.0 dBm) (radar detection) | |||
* 5540 MHz [108] (26.0 dBm) (radar detection) | |||
* 5560 MHz [112] (26.0 dBm) (radar detection) | |||
* 5580 MHz [116] (26.0 dBm) (radar detection) | |||
* 5600 MHz [120] (26.0 dBm) (radar detection) | |||
* 5620 MHz [124] (26.0 dBm) (radar detection) | |||
* 5640 MHz [128] (26.0 dBm) (radar detection) | |||
* 5660 MHz [132] (26.0 dBm) (radar detection) | |||
* 5680 MHz [136] (26.0 dBm) (radar detection) | |||
* 5700 MHz [140] (26.0 dBm) (radar detection) | |||
* 5720 MHz [144] (26.0 dBm) (radar detection) | |||
* 5745 MHz [149] (20.0 dBm) (radar detection) | |||
* 5765 MHz [153] (20.0 dBm) (radar detection) | |||
* 5785 MHz [157] (20.0 dBm) (radar detection) | |||
* 5805 MHz [161] (20.0 dBm) (radar detection) | |||
* 5825 MHz [165] (20.0 dBm) (radar detection) | |||
* 5845 MHz [169] (20.0 dBm) (radar detection) | |||
* 5865 MHz [173] (20.0 dBm) (radar detection) |
Latest revision as of 20:11, 25 September 2024
Devices
TP-Link Archer C7 v4 / v5
- Device page
- 775 MHz CPU, 16 MiB flash, 128 MiB RAM
- Currently Installed: 23.05.5
- Max Power (2.4/5): 24/30 dBm
- When routing/firewall, max throughput is ~ 135 Mbps until "Software flow offloading" is enabled.
- Can trigger on WPS button with script in /etc/rc.button/wps
HooToo TripMate Nano (HT-TM02)
- Device page
- 360 MHz CPU, 8 MiB flash, 32 MiB RAM
- Currently Installed: 19.07.10
- Initial installation here
- Can remove kernel PPP packages
Mode on Startup
Read status of buttons:
root@wifi-ht:~# cat /sys/kernel/debug/gpio gpiochip0: GPIOs 0-21, parent: platform/10000600.gpio, 10000600.gpio: gpio-7 ( |ht-tm02:blue:wlan ) out lo gpio-10 ( |reset ) in hi gpio-12 ( |ht-tm02:green:lan ) out lo gpio-14 ( |modeswitch ) in lo root@wifi-ht:~#
For modeswitch, "lo" is Wired, "hi" is WiFi position.
Could also use slide-switch package. Biggest advantage of this is that it triggers at boot time, not just a switch change.
opkg install slide-switch
On startup On mode (button) change, copy files from /etc/config/config-wired or config-wireless to /etc/config with:
- etc/rc.d/S15config-mode -> /etc/config/config-mode
#!/bin/sh # # Set mode according to slide switch # CONFIG=/etc/config state=$(grep modeswitch /sys/kernel/debug/gpio | sed 's/.*\(lo\|hi\).*/\1/') case "$state" in lo) mode="wired" ;; hi) mode="wireless" ;; *) echo "unknown" return 1 ;; esac message="Using config mode: $mode" echo $message logger $message config="$CONFIG/config-$mode" for file in $(ls $config) do echo $file cp "$config/$file" $CONFIG done
Configuration and Commands
Misc
- Busybox
- UCI Configuration System
- Show logging: logread -f
- wifi up
In /etc/config:
- wireless
- dhcp
- system
- network
- firewall
Disable IPv6 DHCP Server:
- Interface -> IPv6 ->
- RA-Servce: disabled
- DHCPv6-Service: disabled
- NDP-Proxy: disabled
Custom startup scripts:
- /etc/rc.local
In /etc:
- sysupgrade.conf
DHCP
Custom options may be given per network, eg: for NTP:
- 42, 192.168.1.1
DNS
- resolv.conf symlinked to /tmp/resolv.conf which points to local dnsmasq service which delivers from its cache or via DNS servers pointed to by proxies resolv.conf.auto (DHCP client updated)
- See also here
Package Management
opkg update opkg list opkg list-installed opkg install blah opkg remove blah
Reset
- Controlled by /etc/rc.button/reset
- Quick press of reset button reboots
- Failsafe (long press) forces network to:
- 192.168.1.1 / 255.255.255.0
- SSH open with root / no password
- "firstboot" command to revert to factory defaults
- Hard factory reset (to 192.168.1.1.): umount /overlay && jffs2reset && reboot now
- "mount_root" to mount root partition
Wifi commands
iw phy0 info iw reg get iw reg set GB
See other iw commands and Reg Database.
USB and File sharing
Add packages:
opkg install kmod-usb-core kmod-usb-storage usbutils block-mount luci-app-minidlna
Show device:
ls /dev/sd* lsusb -t
Driver USB 1, 2, 3: uhci/ohci, ehci, xhci
Show device:
# block info /dev/sda1 /dev/sda1: UUID="9814-E49A" LABEL="2" VERSION="FAT16" TYPE="vfat"
Mount FAT32 USB stick:
/sbin/block mount cd /mnt/sda1
See also here
LEDs
- Panel LEDS: LED Config
- GPIO
Buttons
- Panel buttons: Button Config.
procd interface:
root@hootoo:/etc/rc.button# ls BTN_0 failsafe power reset rfkill root@hootoo:/etc/rc.button#
scripts need to be named according to the button name, like "BTN_0" or "wps" (see here). They receive values:
- $BUTTON: Name of button
- $ACTION: "pressed", "timeout" or "released". For released, script returns timeout seconds (for hold down).
- $SEEN: number of seconds
root@wifi-ht:/etc/rc.button# cat BTN_0 #!/bin/sh logger "Button $BUTTON: $ACTION (Seen $SEEN)" return 0 root@wifi-ht:/etc/rc.button#
6in4
Requires packages: 6in4 luci-proto-ipv6 and used tunnel from Hurricane Electric.
- Restart network
- In LUCI, edit wan6 and change protocol from DHCPv6 to RFC4213
- Set Remote IPv4 address (eg 74.82.46.6)
- Set Local IPv6 address
- Set IPv6 routed prefix (Routed /48)
- Dynamic tunnel
- Tunnel ID
- HE username/password
ping ipv6.google.com
Manual Config:
opkg install 6in4
uci set network.henet=interface uci set network.henet.proto=6in4 uci set network.henet.peeraddr=[get IPv4 of HE gateway] uci set network.henet.ip6addr='[IPv6 from HE]' uci set network.henet.tunnelid=[HE tunnel ID] uci set network.henet.username=[HE username] uci set network.henet.password='[HE password]' uci commit network uci set firewall.@zone[1].network='wan henet' uci commit firewall ifup henet /etc/init.d/firewall restart
Regulatory Domains and Channels
iw reg set GB iw reg get
Regulatory domains defined in:
/lib/firmware/regulatory.db
See here for explanation of format.
The following lists taken from:
iw list
2.4 GHz
CA
- 2412 MHz [1] (30.0 dBm)
- 2417 MHz [2] (30.0 dBm)
- 2422 MHz [3] (30.0 dBm)
- 2427 MHz [4] (30.0 dBm)
- 2432 MHz [5] (30.0 dBm)
- 2437 MHz [6] (30.0 dBm)
- 2442 MHz [7] (30.0 dBm)
- 2447 MHz [8] (30.0 dBm)
- 2452 MHz [9] (30.0 dBm)
- 2457 MHz [10] (30.0 dBm)
- 2462 MHz [11] (30.0 dBm)
- 2467 MHz [12] (disabled)
- 2472 MHz [13] (disabled)
- 2484 MHz [14] (disabled)
PA
- 2412 MHz [1] (24.0 dBm)
- 2417 MHz [2] (24.0 dBm)
- 2422 MHz [3] (24.0 dBm)
- 2427 MHz [4] (24.0 dBm)
- 2432 MHz [5] (24.0 dBm)
- 2437 MHz [6] (24.0 dBm)
- 2442 MHz [7] (24.0 dBm)
- 2447 MHz [8] (24.0 dBm)
- 2452 MHz [9] (24.0 dBm)
- 2457 MHz [10] (24.0 dBm)
- 2462 MHz [11] (24.0 dBm)
- 2467 MHz [12] (24.0 dBm)
- 2472 MHz [13] (24.0 dBm)
- 2484 MHz [14] (disabled)
UK
- 2412 MHz [1] (20.0 dBm)
- 2417 MHz [2] (20.0 dBm)
- 2422 MHz [3] (20.0 dBm)
- 2427 MHz [4] (20.0 dBm)
- 2432 MHz [5] (20.0 dBm)
- 2437 MHz [6] (20.0 dBm)
- 2442 MHz [7] (20.0 dBm)
- 2447 MHz [8] (20.0 dBm)
- 2452 MHz [9] (20.0 dBm)
- 2457 MHz [10] (20.0 dBm)
- 2462 MHz [11] (20.0 dBm)
- 2467 MHz [12] (20.0 dBm)
- 2472 MHz [13] (20.0 dBm)
- 2484 MHz [14] (disabled)
5 GHz
IN
- 5180 MHz [36] (30.0 dBm)
- 5200 MHz [40] (30.0 dBm)
- 5220 MHz [44] (30.0 dBm)
- 5240 MHz [48] (30.0 dBm)
- 5260 MHz [52] (24.0 dBm)
- 5280 MHz [56] (24.0 dBm)
- 5300 MHz [60] (24.0 dBm)
- 5320 MHz [64] (24.0 dBm)
- 5500 MHz [100] (24.0 dBm)
- 5520 MHz [104] (24.0 dBm)
- 5540 MHz [108] (24.0 dBm)
- 5560 MHz [112] (24.0 dBm)
- 5580 MHz [116] (24.0 dBm)
- 5600 MHz [120] (24.0 dBm)
- 5620 MHz [124] (24.0 dBm)
- 5640 MHz [128] (24.0 dBm)
- 5660 MHz [132] (24.0 dBm)
- 5680 MHz [136] (24.0 dBm)
- 5700 MHz [140] (24.0 dBm)
- 5720 MHz [144] (24.0 dBm)
- 5745 MHz [149] (30.0 dBm)
- 5765 MHz [153] (30.0 dBm)
- 5785 MHz [157] (30.0 dBm)
- 5805 MHz [161] (30.0 dBm)
- 5825 MHz [165] (30.0 dBm)
- 5845 MHz [169] (30.0 dBm)
- 5865 MHz [173] (30.0 dBm)
PA
- 5180 MHz [36] (30.0 dBm)
- 5200 MHz [40] (30.0 dBm)
- 5220 MHz [44] (30.0 dBm)
- 5240 MHz [48] (30.0 dBm)
- 5260 MHz [52] (30.0 dBm)
- 5280 MHz [56] (30.0 dBm)
- 5300 MHz [60] (30.0 dBm)
- 5320 MHz [64] (30.0 dBm)
- 5500 MHz [100] (30.0 dBm)
- 5520 MHz [104] (30.0 dBm)
- 5540 MHz [108] (30.0 dBm)
- 5560 MHz [112] (30.0 dBm)
- 5580 MHz [116] (30.0 dBm)
- 5600 MHz [120] (30.0 dBm)
- 5620 MHz [124] (30.0 dBm)
- 5640 MHz [128] (30.0 dBm)
- 5660 MHz [132] (30.0 dBm)
- 5680 MHz [136] (30.0 dBm)
- 5700 MHz [140] (30.0 dBm)
- 5720 MHz [144] (30.0 dBm)
- 5745 MHz [149] (30.0 dBm)
- 5765 MHz [153] (30.0 dBm)
- 5785 MHz [157] (30.0 dBm)
- 5805 MHz [161] (30.0 dBm)
- 5825 MHz [165] (30.0 dBm)
- 5845 MHz [169] (disabled)
- 5865 MHz [173] (disabled)
UK
- 5180 MHz [36] (23.0 dBm)
- 5200 MHz [40] (23.0 dBm)
- 5220 MHz [44] (23.0 dBm)
- 5240 MHz [48] (23.0 dBm)
- 5260 MHz [52] (20.0 dBm) (radar detection)
- 5280 MHz [56] (20.0 dBm) (radar detection)
- 5300 MHz [60] (20.0 dBm) (radar detection)
- 5320 MHz [64] (20.0 dBm) (radar detection)
- 5500 MHz [100] (26.0 dBm) (radar detection)
- 5520 MHz [104] (26.0 dBm) (radar detection)
- 5540 MHz [108] (26.0 dBm) (radar detection)
- 5560 MHz [112] (26.0 dBm) (radar detection)
- 5580 MHz [116] (26.0 dBm) (radar detection)
- 5600 MHz [120] (26.0 dBm) (radar detection)
- 5620 MHz [124] (26.0 dBm) (radar detection)
- 5640 MHz [128] (26.0 dBm) (radar detection)
- 5660 MHz [132] (26.0 dBm) (radar detection)
- 5680 MHz [136] (26.0 dBm) (radar detection)
- 5700 MHz [140] (26.0 dBm) (radar detection)
- 5720 MHz [144] (26.0 dBm) (radar detection)
- 5745 MHz [149] (20.0 dBm) (radar detection)
- 5765 MHz [153] (20.0 dBm) (radar detection)
- 5785 MHz [157] (20.0 dBm) (radar detection)
- 5805 MHz [161] (20.0 dBm) (radar detection)
- 5825 MHz [165] (20.0 dBm) (radar detection)
- 5845 MHz [169] (20.0 dBm) (radar detection)
- 5865 MHz [173] (20.0 dBm) (radar detection)