mirror of
https://github.com/richb-hanover/OpenWrtScripts.git
synced 2026-03-30 10:44:32 +02:00
Update label to use top-level DNS domain (from dhcp.dnsmasq.domain);
This is usually ".local", but might be ".lan" Use same code in print-router-label.sh and config-spare-router.sh
This commit is contained in:
parent
e34bd49a00
commit
7eec6fb65f
4 changed files with 29 additions and 15 deletions
|
|
@ -42,6 +42,9 @@ cd /usr/lib
|
|||
git clone https://github.com/richb-hanover/OpenWrtScripts.git
|
||||
```
|
||||
|
||||
**NB:** Some of these scripts have instructions for running the script
|
||||
from `/tmp`
|
||||
|
||||
## [getstats.sh](https://github.com/richb-hanover/OpenWrtScripts/blob/master/getstats.sh)
|
||||
|
||||
The `getstats.sh` script helps diagnose problems with OpenWrt.
|
||||
|
|
@ -117,7 +120,7 @@ to encounter the router (which may be you) can access it.
|
|||
|
||||
This process is reasonably secure - if the bad guy
|
||||
can read the label, they can also factory-reset the router
|
||||
(or steal TV or your silverware). Here's a sample label:
|
||||
(or steal your TV or your silverware). Here's a sample label:
|
||||
|
||||
```text
|
||||
======= Printed with: print-router-label.sh =======
|
||||
|
|
@ -130,7 +133,7 @@ can read the label, they can also factory-reset the router
|
|||
Login PW: abcd9876
|
||||
Wifi SSID: My Wifi SSID
|
||||
Wifi PW: <no password>
|
||||
Configured: 2024-Nov-28
|
||||
Configured: 2024-11-28
|
||||
=== See github.com/richb-hanover/OpenWrtScripts ===
|
||||
|
||||
Label for Power Brick: Linksys E8450 (UBI)
|
||||
|
|
@ -287,7 +290,7 @@ root@openwrt# sh betterspeedtest.sh root@openwrt# sh bette
|
|||
|
||||
The `netperfrunner.sh` script runs several netperf commands simultaneously.
|
||||
This mimics the stress test of
|
||||
[netperf-wrapper](https://github.com/tohojo/netperf-wrapper)
|
||||
[Flent](https://github.com/tohojo/flent)
|
||||
[Github] but without the nice GUI result.
|
||||
|
||||
When you start this script, it concurrently uploads and downloads several
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ It is available at
|
|||
[config-spare-router.sh](https://github.com/richb-hanover/OpenWrtScripts/blob/master/config-spare-router.sh)
|
||||
To use it:
|
||||
|
||||
* Connect via Ethernet to a LAN port
|
||||
* Connect your laptop via Ethernet to a LAN port
|
||||
* Connect the router's WAN Ethernet to the Internet
|
||||
(perhaps the LAN port of the new router).
|
||||
* Use the LuCI GUI to reset settings to
|
||||
factory default (**System -> Backup/Flash firmware**)
|
||||
* Use the [Firmware Selector](https://firmware-selector.openwrt.org/)
|
||||
|
|
@ -37,6 +39,8 @@ To use it:
|
|||
* SSH into the router using the Ethernet connection
|
||||
* Run the attached script (see the instructions within it)
|
||||
* The script prints a label: cut it out and tape it to the router
|
||||
* _Pro tip:_ Printing the label in 12-point type produces a
|
||||
"business card" size label.
|
||||
* _Pro tip:_ Snip the model number from the paper
|
||||
and tape it directly to the power brick.
|
||||
(Use the text from the "Power Brick Label" section.)
|
||||
|
|
@ -58,7 +62,7 @@ suitable for printing and taping to the router.
|
|||
# Login PW: SpareRouter
|
||||
# Wifi SSID: SpareRouter
|
||||
# Wifi PW: <no password>
|
||||
# Configured: 2024-Nov-28
|
||||
# Configured: 2024-11-28
|
||||
# === See github.com/richb-hanover/OpenWrtScripts ===
|
||||
#
|
||||
# Label for Power Brick: Linksys E8450 (UBI)
|
||||
|
|
|
|||
|
|
@ -18,13 +18,15 @@
|
|||
# Login PW: root-password
|
||||
# Wifi SSID: My Wifi SSID
|
||||
# Wifi PW: abcd9876
|
||||
# Configured: 2024-Nov-28
|
||||
# Configured: 2024-11-28
|
||||
# === See github.com/richb-hanover/OpenWrtScripts ===
|
||||
#
|
||||
# Label for Power Brick: Linksys E8450 (UBI)
|
||||
|
||||
# ***** To run this script *****
|
||||
#
|
||||
# 0. (Optional) Make a backup of the current router config.
|
||||
# It'll be easy to restore if necessary.
|
||||
# 1. Connect your laptop on a wired LAN port (Ethernet):
|
||||
# some of these changes can reset the wireless network.
|
||||
# 2. Connect the router's WAN port to the internet: this
|
||||
|
|
@ -50,15 +52,16 @@
|
|||
# === print_router_label() ===
|
||||
# This function is copy/pasted from "print-router-label.sh"
|
||||
# to keep the "config-spare-router.sh" script a single file.
|
||||
# Maintenance hassle: Changes to the printing must be updated
|
||||
# in both places
|
||||
# THIS IS A MAINTENANCE HASSLE:
|
||||
# Changes to the printing must be updated in both places
|
||||
print_router_label() {
|
||||
local ROOTPASSWD="${1:-"?"}"
|
||||
TODAY=$(date +"%Y-%b-%d")
|
||||
TODAY=$(date +"%Y-%m-%d")
|
||||
DEVICE=$(cat /tmp/sysinfo/model)
|
||||
OPENWRTVERSION=$(grep "DISTRIB_DESCRIPTION" /etc/openwrt_release | cut -d"=" -f2 | tr -d '"' | tr -d "'")
|
||||
HOSTNAME=$(uci get system.@system[0].hostname)
|
||||
LANIPADDRESS=$(uci get network.lan.ipaddr)
|
||||
LOCALDNSTLD=$(uci get dhcp.@dnsmasq[0].domain) # top level domain for local names
|
||||
|
||||
# Create temporary file for both SSID and password
|
||||
TMPFILE=$(mktemp /tmp/wifi_creds.XXXXXX)
|
||||
|
|
@ -99,8 +102,8 @@ print_router_label() {
|
|||
echo "======= Printed with: print-router-label.sh ======="
|
||||
echo " Device: $DEVICE"
|
||||
echo " OpenWrt: $OPENWRTVERSION"
|
||||
echo " Connect to: http://$HOSTNAME.local"
|
||||
echo " or: ssh root@$HOSTNAME.local"
|
||||
echo " Connect to: http://$HOSTNAME.$LOCALDNSTLD"
|
||||
echo " or: ssh root@$HOSTNAME.$LOCALDNSTLD"
|
||||
echo " LAN: $LANIPADDRESS"
|
||||
echo " User: root"
|
||||
echo " Login PW: $ROOTPASSWD"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@
|
|||
#
|
||||
# Pro-tip: Snip out the power brick label, and tape it to the
|
||||
# power brick so the router and brick don't get separated.
|
||||
#
|
||||
# Pro-tip: Printing the label in 12-point type produces a
|
||||
# "business card" size label. Small text, but readable.
|
||||
#
|
||||
# If no root-password is supplied, the script prints "?".
|
||||
# You can then write the password on the label.
|
||||
|
|
@ -32,7 +35,7 @@
|
|||
# Login PW: root-password
|
||||
# Wifi SSID: My Wifi SSID
|
||||
# Wifi PW: <no password>
|
||||
# Configured: 2024-Nov-28
|
||||
# Configured: 2024-11-28
|
||||
# === See github.com/richb-hanover/OpenWrtScripts ===
|
||||
#
|
||||
# Label for Power Brick: Linksys E8450 (UBI)
|
||||
|
|
@ -40,11 +43,12 @@
|
|||
|
||||
print_router_label() {
|
||||
local ROOTPASSWD="${1:-"?"}"
|
||||
TODAY=$(date +"%Y-%b-%d")
|
||||
TODAY=$(date +"%Y-%m-%d")
|
||||
DEVICE=$(cat /tmp/sysinfo/model)
|
||||
OPENWRTVERSION=$(grep "DISTRIB_DESCRIPTION" /etc/openwrt_release | cut -d"=" -f2 | tr -d '"' | tr -d "'")
|
||||
HOSTNAME=$(uci get system.@system[0].hostname)
|
||||
LANIPADDRESS=$(uci get network.lan.ipaddr)
|
||||
LOCALDNSTLD=$(uci get dhcp.@dnsmasq[0].domain) # top level domain for local names
|
||||
|
||||
# Create temporary file for both SSID and password
|
||||
TMPFILE=$(mktemp /tmp/wifi_creds.XXXXXX)
|
||||
|
|
@ -85,8 +89,8 @@ print_router_label() {
|
|||
echo "======= Printed with: print-router-label.sh ======="
|
||||
echo " Device: $DEVICE"
|
||||
echo " OpenWrt: $OPENWRTVERSION"
|
||||
echo " Connect to: http://$HOSTNAME.local"
|
||||
echo " or: ssh root@$HOSTNAME.local"
|
||||
echo " Connect to: http://$HOSTNAME.$LOCALDNSTLD"
|
||||
echo " or: ssh root@$HOSTNAME.$LOCALDNSTLD"
|
||||
echo " LAN: $LANIPADDRESS"
|
||||
echo " User: root"
|
||||
echo " Login PW: $ROOTPASSWD"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue