mirror of
https://github.com/richb-hanover/OpenWrtScripts.git
synced 2026-03-30 10:44:32 +02:00
Update README (+2 squashed commits)
Squashed commits: [7b35b92] Updated config-openwrt.sh to configure root password, eth0 for PPPoE, update software packages, set time zone, enable SNMP, enable mDNS, and set SQM [1af1a51] Updated config-openwrt.sh to do basic configuration; added test scripts for installing snmpd and sqm
This commit is contained in:
parent
294d8dede7
commit
a300093954
4 changed files with 183 additions and 92 deletions
102
README.md
102
README.md
|
|
@ -5,14 +5,63 @@ This is a set of scripts (sometimes also called "Openscripts") that configure an
|
|||
|
||||
* Script to configure the OpenWrt router consistently after flashing factory firmware.
|
||||
|
||||
* Script to collect troubleshooting information that helps us diagnose problems in the OpenWrt distribution.
|
||||
|
||||
* Scripts that measure the performance of your router or offer load to the network for testing.
|
||||
|
||||
* Script to set up a IPv6 6-in-4 tunnel to TunnelBroker.net.
|
||||
|
||||
* Script to collect troubleshooting information that helps us diagnose problems in the OpenWrt distribution.
|
||||
|
||||
These scripts can be saved in the `/usr/lib/OpenWrtScripts` directory. They were cloned from the similar CeroWrtScripts at https://github.com/richb-hanover/CeroWrtScripts
|
||||
These scripts can be saved in the `/usr/lib/OpenWrtScripts` directory.
|
||||
|
||||
---
|
||||
## config-openwrt.sh
|
||||
|
||||
This script updates the factory settings of OpenWrt to a known-good configuration.
|
||||
If you frequently update your firmware, you can use this script to reconfigure
|
||||
the router to a consistent state.
|
||||
You should make a copy of this script, customize it to your needs,
|
||||
then use the "To run this script" procedure (below).
|
||||
|
||||
This script is designed to configure the settings after an initial "factory" firmware flash.
|
||||
There are sections below to configure many aspects of your router.
|
||||
All the sections are commented out. There are sections for:
|
||||
|
||||
- Set up the WAN interface to connect to your provider
|
||||
- Update the software packages
|
||||
- Update the root password
|
||||
- Set the time zone
|
||||
- Enable SNMP for traffic monitoring and measurements
|
||||
- Enable NetFlow export for traffic analysis
|
||||
- Enable mDNS/ZeroConf on the WAN interface
|
||||
- Change default IP addresses and subnets for interfaces
|
||||
- Change default DNS names
|
||||
- Set the SQM (Smart Queue Management) parameters
|
||||
- Set the radio channels
|
||||
- Set wireless SSID names
|
||||
- Set the wireless security credentials
|
||||
|
||||
**To run this script**
|
||||
|
||||
Flash the router with factory firmware. Then ssh in and execute these statements.
|
||||
You should do this over a wired connection because some of these changes
|
||||
may reset the wireless network.
|
||||
|
||||
ssh root@172.30.42.1
|
||||
cd /tmp
|
||||
cat > config.sh
|
||||
[paste in the contents of this file, then hit ^D]
|
||||
sh config.sh
|
||||
Presto! (You should reboot the router when this completes.)
|
||||
|
||||
**Note:** If you use a secondary OpenWrt router, you can create another copy of this script, and use it to set different configuration parameters (perhaps different subnets, radio channels, SSIDs, enable mDNS, etc).
|
||||
|
||||
---
|
||||
## openwrtstats.sh
|
||||
|
||||
This script collects a number of useful configuration settings and dynamic values for aid in diagnosing problems with OpenWrt. If you report a problem, it would be helpful to include the output of this script.
|
||||
|
||||
By default, it collects information about the first 2.4GHz radio/interface, and writes the collected data to `/tmp/openwrtstats_output.txt`
|
||||
|
||||
---
|
||||
## betterspeedtest.sh
|
||||
|
||||
|
|
@ -112,47 +161,6 @@ The output of the script looks like this:
|
|||
|
||||
This script continually invokes the netperfrunner script to provide a heavy load. It runs forever - Ctl-C will interrupt it.
|
||||
|
||||
---
|
||||
## config-openwrt.sh
|
||||
|
||||
This script updates the factory settings of OpenWrt to a known-good configuration.
|
||||
If you frequently update your firmware, you can use this script to reconfigure
|
||||
the router to a consistent state.
|
||||
You should make a copy of this script, customize it to your needs,
|
||||
then use the "To run this script" procedure (below).
|
||||
|
||||
This script is designed to configure the settings after an initial "factory" firmware flash.
|
||||
There are sections below to configure many aspects of your router.
|
||||
All the sections are commented out. There are sections for:
|
||||
|
||||
- Set up the WAN interface to connect to your provider
|
||||
- Update the software packages
|
||||
- Update the root password
|
||||
- Set the time zone
|
||||
- Enable SNMP for traffic monitoring and measurements
|
||||
- Enable NetFlow export for traffic analysis
|
||||
- Enable mDNS/ZeroConf on the WAN interface
|
||||
- Change default IP addresses and subnets for interfaces
|
||||
- Change default DNS names
|
||||
- Set the SQM (Smart Queue Management) parameters
|
||||
- Set the radio channels
|
||||
- Set wireless SSID names
|
||||
- Set the wireless security credentials
|
||||
|
||||
**To run this script**
|
||||
|
||||
Flash the router with factory firmware. Then ssh in and execute these statements.
|
||||
You should do this over a wired connection because some of these changes
|
||||
may reset the wireless network.
|
||||
|
||||
ssh root@172.30.42.1
|
||||
cd /tmp
|
||||
cat > config.sh
|
||||
[paste in the contents of this file, then hit ^D]
|
||||
sh config.sh
|
||||
Presto! (You should reboot the router when this completes.)
|
||||
|
||||
**Note:** If you use a secondary OpenWrt router, you can create another copy of this script, and use it to set different configuration parameters (perhaps different subnets, radio channels, SSIDs, enable mDNS, etc).
|
||||
|
||||
---
|
||||
## tunnelbroker.sh
|
||||
|
|
@ -175,9 +183,3 @@ Configurations" tab and select "OpenWRT Backfire 10.03.1". Use the info to fill
|
|||
|
||||
Presto! Your tunnel is up! Your computer should get a global IPv6 address, and should be able to communicate directly with IPv6 devices on the Internet. To test it, try: `ping6 ivp6.google.com`
|
||||
|
||||
---
|
||||
## openwrtstats.sh
|
||||
|
||||
This script collects a number of useful configuration settings and dynamic values for aid in diagnosing problems with OpenWrt. If you report a problem, it would be helpful to include the output of this script.
|
||||
|
||||
By default, it collects information about the first 2.4GHz radio/interface, and writes the collected data to `/tmp/openstats_output.txt`
|
||||
|
|
|
|||
31
TestScripts/snmp.sh
Normal file
31
TestScripts/snmp.sh
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Configure snmpd in OpenWrt
|
||||
# Edit the four variables below (COMMUNITYSTRING, LOCATION, CONTACT, SYSTEMNAME),
|
||||
# then run this script using:
|
||||
#
|
||||
# sh snmp.sh
|
||||
#
|
||||
COMMUNITYSTRING=public
|
||||
LOCATION='Under The House'
|
||||
CONTACT="somebody@example.com"
|
||||
SYSTEMNAME="One Really Sweet Router"
|
||||
|
||||
echo 'Configuring and starting snmpd'
|
||||
# Listen port 161 (v4 & v6), with specified community string
|
||||
uci set snmpd.@agent[0].agentaddress='UDP:161,UDP6:161'
|
||||
uci set snmpd.@com2sec[0].community="$COMMUNITYSTRING"
|
||||
|
||||
# set up to listen for IPv6 queries as well
|
||||
uci add snmpd com2sec6
|
||||
uci set snmpd.@com2sec6[-1].secname=ro
|
||||
uci set snmpd.@com2sec6[-1].source=default
|
||||
uci set snmpd.@com2sec6[-1].community="$COMMUNITYSTRING"
|
||||
|
||||
# Set a few system variables
|
||||
uci set snmpd.@system[-1].sysLocation="$LOCATION"
|
||||
uci set snmpd.@system[-1].sysContact="$CONTACT"
|
||||
uci set snmpd.@system[-1].sysName="$SYSTEMNAME"
|
||||
uci commit snmpd
|
||||
|
||||
# restart the snmpd, and enable it to restart at next boot
|
||||
/etc/init.d/snmpd restart
|
||||
/etc/init.d/snmpd enable
|
||||
15
TestScripts/sqm.sh
Normal file
15
TestScripts/sqm.sh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
DOWNLOADSPEED=8264
|
||||
UPLOADSPEED=911
|
||||
WANIF=eth0
|
||||
echo 'Setting SQM to' $DOWNLOADSPEED/$UPLOADSPEED 'kbps down/up'
|
||||
uci set sqm.@queue[0].interface=$WANIF
|
||||
uci set sqm.@queue[0].enabled=1
|
||||
uci set sqm.@queue[0].download=$DOWNLOADSPEED
|
||||
uci set sqm.@queue[0].upload=$UPLOADSPEED
|
||||
uci set sqm.@queue[0].script='simple.qos' # Already the default
|
||||
uci set sqm.@queue[0].qdisc='fq_codel'
|
||||
uci set sqm.@queue[0].itarget='auto'
|
||||
uci set sqm.@queue[0].etarget='auto'
|
||||
uci set sqm.@queue[0].linklayer='atm'
|
||||
uci set sqm.@queue[0].overhead='44'
|
||||
uci commit sqm
|
||||
|
|
@ -9,55 +9,66 @@
|
|||
# There are sections below to configure many aspects of your router.
|
||||
# All the sections are commented out. There are sections for:
|
||||
#
|
||||
# - Set up the ge00/WAN interface to connect to your provider
|
||||
# - Update the software packages
|
||||
# - Update the root password
|
||||
# - Set up the eth0/WAN interface to connect to your provider
|
||||
# - Update the software packages
|
||||
# - Set the time zone
|
||||
# - Enable SNMP for traffic monitoring and measurements
|
||||
# - Enable NetFlow export for traffic analysis
|
||||
# - Enable mDNS/ZeroConf on the ge00 (WAN) interface
|
||||
# - Change default IP addresses and subnets for interfaces
|
||||
# - Change default DNS names
|
||||
# - Enable mDNS/ZeroConf on the br-lan (LAN) interface
|
||||
# - Set the SQM (Smart Queue Management) parameters
|
||||
# - Set the radio channels
|
||||
# - Set wireless SSID names
|
||||
# - Set the wireless security credentials
|
||||
#
|
||||
# To run this script
|
||||
#
|
||||
# Flash the router with factory firmware. Then ssh in and execute these statements.
|
||||
# Flash the router with factory firmware. Then *telnet* in and execute these statements.
|
||||
# You should do this over a wired connection because some of these changes
|
||||
# will reset the wireless network.
|
||||
#
|
||||
# ssh root@172.30.42.1
|
||||
# telnet 192.168.1.1
|
||||
# cd /tmp
|
||||
# cat > config.sh
|
||||
# [paste in the contents of this file, then hit ^D]
|
||||
# sh config.sh
|
||||
# Presto! (You should reboot the router when this completes.)
|
||||
|
||||
# === Set up the WAN (ge00) interface ==================
|
||||
# === Update root password =====================
|
||||
# Update the root password. Supply new password for NEWPASSWD and
|
||||
# uncomment six lines.
|
||||
#
|
||||
echo 'Updating root password'
|
||||
NEWPASSWD=conT7528
|
||||
passwd <<EOF
|
||||
$NEWPASSWD
|
||||
$NEWPASSWD
|
||||
EOF
|
||||
|
||||
# === Set up the WAN (eth0) interface ==================
|
||||
# Default is DHCP, this sets it to PPPoE (typical for DSL/ADSL)
|
||||
# From http://wiki.openwrt.org/doc/howto/internet.connection
|
||||
# Supply values for DSLUSERNAME and DSLPASSWORD
|
||||
# and uncomment seven lines
|
||||
# and uncomment ten lines
|
||||
#
|
||||
# echo 'Configuring WAN link for PPPoE'
|
||||
# DSLUSERNAME=YOUR-DSL-USERNAME
|
||||
# DSLPASSWORD=YOUR-DSL-PASSWORD
|
||||
# uci set network.ge00.proto=pppoe
|
||||
# uci set network.ge00.username=$DSLUSERNAME
|
||||
# uci set network.ge00.password=$DSLPASSWORD
|
||||
# uci set network.wan.proto=pppoe
|
||||
# uci set network.wan.username=$DSLUSERNAME
|
||||
# uci set network.wan.password=$DSLPASSWORD
|
||||
# uci commit network
|
||||
# ifup ge00
|
||||
# ifup wan
|
||||
# echo 'Waiting for link to initialize'
|
||||
# sleep 20
|
||||
|
||||
# === Update the software packages =============
|
||||
# Download and update all the interesting packages
|
||||
# Some of these are pre-installed, but there is no harm in
|
||||
# updating/installing them a second time.
|
||||
# echo 'Updating software packages'
|
||||
# opkg update # retrieve updated packages
|
||||
# opkg install snmpd fprobe # install snmpd & fprobe
|
||||
# opkg install luci-app-sqm sqm-scripts # install the SQM modules to get fq_codel &c
|
||||
# opkg install luci-app-sqm # install the SQM modules to get fq_codel etc
|
||||
# opkg install ppp-mod-pppoe # install PPPoE module
|
||||
# opkg install avahi-daemon # install the mDNS daemon
|
||||
# opkg install netperf # install the netperf module for speed testing
|
||||
|
||||
# === Update root password =====================
|
||||
# Update the root password. Supply new password for NEWPASSWD and
|
||||
|
|
@ -86,8 +97,6 @@
|
|||
# uci commit system
|
||||
|
||||
# === Enable SNMP daemon =======================
|
||||
# SNMP - See this page for more details
|
||||
# http://www.bufferbloat.net/projects/cerowrt/wiki/Monitoring_CeroWrt
|
||||
# Enables responses on IPv4 & IPv6 with same read-only community string
|
||||
# Supply values for COMMUNITYSTRING and uncomment eleven lines.
|
||||
# COMMUNITYSTRING=public
|
||||
|
|
@ -102,6 +111,62 @@
|
|||
# /etc/init.d/snmpd restart # default snmpd config uses 'public'
|
||||
# /etc/init.d/snmpd enable # community string for SNMPv1 & SNMPv2c
|
||||
|
||||
# === Enable mDNS/ZeroConf =====================
|
||||
# mDNS allows devices to look each other up by name
|
||||
# This enables mDNS lookups on the LAN (br-lan) interface
|
||||
# Uncomment seven lines
|
||||
# echo 'Enabling mDNS on LAN interface'
|
||||
# sed -i '/use-iff/ a \
|
||||
# allow-interfaces=br-lan \
|
||||
# enable-dbus=no ' /etc/avahi/avahi-daemon.conf
|
||||
# sed -i s/enable-reflector=no/enable-reflector=yes/ /etc/avahi/avahi-daemon.conf
|
||||
# /etc/init.d/avahi-daemon start
|
||||
# /etc/init.d/avahi-daemon enable
|
||||
|
||||
# ==============================
|
||||
# Set Smart Queue Management (SQM) values for your own network
|
||||
#
|
||||
# Use a speed test (http://dslreports.com/speedtest) to determine the speed
|
||||
# for your own network, then set the values below accordingly
|
||||
# Speeds below are in kbits per second (3000 = 3 megabits/sec)
|
||||
# For all the details about setting the SQM for your router, see:
|
||||
# http://wiki.openwrt.org/doc/howto/sqm
|
||||
# Set DOWNLOADSPEED, UPLOADSPEED, WANIF and then uncomment 18 lines
|
||||
#
|
||||
# DOWNLOADSPEED=20000
|
||||
# UPLOADSPEED=2000
|
||||
# WANIF=eth0
|
||||
# echo 'Setting SQM on '$WANIF ' to ' $DOWNLOADSPEED/$UPLOADSPEED 'kbps down/up'
|
||||
# uci set sqm.@queue[0].interface=$WANIF
|
||||
# uci set sqm.@queue[0].enabled=1
|
||||
# uci set sqm.@queue[0].download=$DOWNLOADSPEED
|
||||
# uci set sqm.@queue[0].upload=$UPLOADSPEED
|
||||
# uci set sqm.@queue[0].script='simple.qos' # Already the default
|
||||
# uci set sqm.@queue[0].qdisc='fq_codel'
|
||||
# uci set sqm.@queue[0].itarget='auto'
|
||||
# uci set sqm.@queue[0].etarget='auto'
|
||||
# uci set sqm.@queue[0].linklayer='atm'
|
||||
# uci set sqm.@queue[0].overhead='44'
|
||||
# uci commit sqm
|
||||
# /etc/init.d/sqm restart
|
||||
# /etc/init.d/sqm enable
|
||||
|
||||
|
||||
echo 'You should restart the router now for these changes to take effect...'
|
||||
# --- end of script ---
|
||||
|
||||
# ================
|
||||
#
|
||||
# The following sections have not been completed, and should not be uncommented:
|
||||
#
|
||||
# - Enable NetFlow export for traffic analysis
|
||||
# - Enable mDNS/ZeroConf on the ge00 (WAN) interface
|
||||
# - Change default IP addresses and subnets for interfaces
|
||||
# - Change default DNS names
|
||||
# - Set the radio channels
|
||||
# - Set wireless SSID names
|
||||
# - Set the wireless security credentials
|
||||
|
||||
# === Enable NetFlow export ====================
|
||||
# NetFlow export
|
||||
# Start fprobe now to send netflow records to local netflow
|
||||
|
|
@ -155,25 +220,6 @@
|
|||
# echo 'Changing local domain to' $NEWDNS
|
||||
# sed -i s#home.lan#$NEWDNS#g /etc/config/*
|
||||
|
||||
# ==============================
|
||||
# Set Smart Queue Management (SQM) values for your own network
|
||||
#
|
||||
# Use a speed test (http://speedtest.net) to determine the speed
|
||||
# for your own network, then set the values below accordingly
|
||||
# Speeds below are in kbits per second (3000 = 3 megabits/sec)
|
||||
# For all the details about setting the SQM for your router, see:
|
||||
# http://www.bufferbloat.net/projects/cerowrt/wiki/Setting_up_SQM_for_CeroWrt_310
|
||||
#
|
||||
# DOWNLOADSPEED=7000
|
||||
# UPLOADSPEED=830
|
||||
# echo 'Setting SQM to' $DOWNLOADSPEED/$UPLOADSPEED 'kbps down/up'
|
||||
# uci set sqm.ge00.enabled=1
|
||||
# uci set sqm.ge00.download=$DOWNLOADSPEED
|
||||
# uci set sqm.ge00.upload=$UPLOADSPEED
|
||||
# uci set sqm.ge00.script='simple.qos'
|
||||
# uci set sqm.ge00.qdisc='fq_codel'
|
||||
# uci commit sqm
|
||||
|
||||
# === Update WiFi info for the access point ================
|
||||
# a) Assign the radio channels
|
||||
# b) Assign the SSID's
|
||||
|
|
@ -229,6 +275,3 @@
|
|||
# uci set wireless.@wifi-iface[4].encryption=$ENCRMODE
|
||||
|
||||
# uci commit wireless
|
||||
|
||||
echo 'You should restart the router now for these changes to take effect...'
|
||||
# --- end of script ---
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue