I don't know about you but in these times of working from home and social distancing I get way more annoyed when internet speeds are not reaching the levels required for a decent video conference. I have three routers in my home all of which are running FreshTomato firmware.
In my setup two of those routers actually don't do much more than serve as a access point for the WiFi. The real magic is done on my main router (Netgear Nighthawk R7000). Here I take care of all DHCP requests, static leases and it runs a network-wide VPN client amongst other services and configuration.
I was running the AIO (All in One) build of Freshtomato on all of my routers but when bothered by slow speeds I started investigating how to improve this. I figured I didn't need the AIO build for my current purposes and decided to re-flash my routers with the VPN build which has a slightly smaller footprint.
I started out with my two easily configured access-point routers, since these are just slightly configured I decided to flush the entire NVRAM (clean-install) given that their configuration lived through countless updates even accross Tomato forks (Shibby > Freshtomato). After I was done re-configuring these routers I saw speeds skyrocket! They truly needed a fresh configuration and a lighter build.
Now for my main router... this puppy has been quite heavily configured over the years and had probably survived more updates than any of my others without ever refreshing the configuration (even though this is recommended at certain update intervals). The forecast of having to re-configure this beast by hand was just holding me back. Of course you can use the built-in backup utility but that will restore your NVRAM to the exact state it was in when backing-up. So you won't gain the fresh set of defaults that you might or might not have been tinkering with over these years.
I decided to selectively back-up and restore my configuration based on the parts I knew for sure were configured deliberately and actually served a purpose today. Also I scoped these backups to include only configs which are hard or cumbersome to do. All the basic configuration is just a few clicks away anyways.
The idea was easy enough but I didn't know the exact method to selectively back-up and restore bits and pieces of my config from the NVRAM. I did some DuckDuckGo searching and soon found my solution. I hope this is of use to some of you as well!
Good to note:
I have my router configured inside a
.ssh/config file and therefore can simply use the term
nighthawk in my SSH/SCP commands and it uses the appropriate user and key for that connection to happen. If you don't have this config your SCP command will look something like this instead:
scp -i ~/.ssh/my-private-key -r <router_user><router_ip>:/etc/backup /home/$USER/nighthawk-master
So be sure to use whatever is appropriate for your situation.
On your current/old router:
Create a backup directory to store your configs
To see all the nvram vars you could save type
nvram show | less
Choose what to backup for your needs
nvram get dhcpd_static > /etc/backup/dhcpd_static.bak
nvram get dnsmasq_custom > /etc/backup/dnsmasq_custom.bak
nvram get script_fire > /etc/backup/script_fire.bak
nvram get sshd_authkeys > /etc/backup/sshd_authkeys.bak
On your local machine:
Use SCP to pull these backups to your local machine
mkdir -p /home/$USER/nighthawk-master/backup
scp -r nighthawk:/etc/backup /home/$USER/nighthawk-master
Use SCP to push these backups to the new router under
Note: Before you can push these using SCP you need to make sure your private key relating to your current local machine is at least set inside the administration section, otherwise you can't connect.
scp -r /home/$USER/nighthawk-master/backup nighthawk:/etc
On the new/cleared router:
Now restore your backups:
nvram set dhcpd_static=`cat /etc/backup/dhcpd_static.bak`
nvram set dnsmasq_custom=`cat /etc/backup/dnsmasq_custom.bak`
nvram set script_fire=`cat /etc/backup/script_fire.bak`
nvram set sshd_authkeys=`cat /etc/backup/sshd_authkeys.bak`
Commit your changes to RAM and reboot
Bonus tip (not for faint of heart):
Overclock your router to possibly get some additional speed improvements. These commands are meant to work for Tomato firmware and could potentially break your router so read up on the recommended settings for your particulare make and model router first!
First check current clockspeed
nvram get clkfreq
Set new higher clockspeed (BE CAREFUL HERE)
nvram set clkfreq=1200,800