From a3000939540f9fb2802a3220c37d9d0077a3aeb8 Mon Sep 17 00:00:00 2001 From: Rich Brown Date: Tue, 28 Apr 2015 23:58:19 -0400 Subject: [PATCH] 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 --- README.md | 102 ++++++++++++++++++----------------- TestScripts/snmp.sh | 31 +++++++++++ TestScripts/sqm.sh | 15 ++++++ config-openwrt.sh | 127 +++++++++++++++++++++++++++++--------------- 4 files changed, 183 insertions(+), 92 deletions(-) create mode 100644 TestScripts/snmp.sh create mode 100644 TestScripts/sqm.sh diff --git a/README.md b/README.md index 3527217..182634a 100644 --- a/README.md +++ b/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` diff --git a/TestScripts/snmp.sh b/TestScripts/snmp.sh new file mode 100644 index 0000000..3742e9a --- /dev/null +++ b/TestScripts/snmp.sh @@ -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 diff --git a/TestScripts/sqm.sh b/TestScripts/sqm.sh new file mode 100644 index 0000000..6d37444 --- /dev/null +++ b/TestScripts/sqm.sh @@ -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 \ No newline at end of file diff --git a/config-openwrt.sh b/config-openwrt.sh index 45f905c..ecb2cf6 100755 --- a/config-openwrt.sh +++ b/config-openwrt.sh @@ -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 <