Intalling and configuring OpenWRT to my taste is a lengthy process. These documents and scripts should help make things simpler.
Scripts and steps assume:
- OpenWRT version: 15.05 (Barrier Breaker)
- Router model: TP-Link TL-WDR4300
- Connect router to an internet enabled network.
- Connect a device to the router through Ethernet.
- Connect power.
- Upgrade firmware to latest version.
- Upgrade firmware to OpenWRT.
This set of scripts is meant to configure an OpenWRT router for the network requirements I have. The scripts try to be idempotent (no matter how many time a script is run it will result in the same configuration) but not all of them are. DO NOT ASSUME IDEMPOTENCE
Some of the scripts are generated using templatise so
they need to be built first.
Run the following from the root of the repository to populate the
dist
directory with usable scripts:
npm install
grunt
scp dist.tar.gz root@192.168.1.1:
ssh root@192.168.1.1
gunzip dist.tar.gz
tar -xf dist.tar
rm dist.tar
./router-bootstrap/sequence
- Install OpenWRT onto the router.
- Update root password and enable ssh with keys.
- Install pre-extroot packages.
- Configure router static IP address and hostname.
- Disable all unwanted/unsave services.
- Setup external USB and extroot.
- Install additional packages.
- Configure syslog.
- Configure DHCP and DNS.
- Configure SSH server.
- Wireless configuration.
- Configure OpenVPN server.
- Setup firewall rules.
- Add initial users and groups.
- Setup SSH key.
- Configure DDNS client.
- Initial samba share.
- Configure print server.
- Configure scan server.
- Setup Wake-On-Line client.
- Enhance shell with aliases. #23. CollectD configuration.
Once the distribution is built you can run the scripts manually following the
list of steps above or you can run dist/sequence
to do it for you.
Note that reboots are required during the process, the sequence script
will reboot when needed and it will remeber the current point of execution.
This information is stored in a auto-conf-sequence
file.
For this reason dist/sequence
must be run always from the same directory
and that directory needs to persist across reboots.
To achieve this the device must be rebooted in failsafe mode:
- Power of the device
- Repeatedly press the reset button on the back as the device boots.
- Telnet in with the default IP 192.168.1.1
Once in the configuration on the device can be reset to stock OpenWRT
through the firstboot
command.
Once the command is complete the device can be rebooted into a clean install.
Keep in mind that the USB device will not be used to boot but it will still have the previous data so it will need to be cleared too.
Updates should be made to this script first and to the device after. Updates should also never be made through the web interface.
Remember that most scripts are idempotent and those that are not can be refactored to be. Maybe an update can be done by running the individual step?
If the changes require a lot of manual work to be performed a reset and reinstall may be a good option.