How to configure SNMP on Asus RT-AC68U
The other day I was playing around with my router (ASUS RT-AC68U) and thought that it would be nice if it would be possible to monitor it through Nagios and continously check portstatus, bandwith utilization, etc. The RT-AC68U is a linuxbased router that easily can be flashed with different open source softwares, such as Merlin for instance. The original software is quite limited outside of the standard functions and there is no support for monitoring the router and retrieving SNMP information for instance. This makes the router quite hard to monitor in a reasonable way with the original software. First I considered changing the software and flash the router with Merlin. But since my router also is used by my entire family I felt that it might be a bit too risky if Murphy would show his face during the operation. But after I Googled around a bit I found out that there is a "bug" in the original software that allows us to install just the tools we need. And remember - Google is your friend ;-)
To access all the MIB's with SNMP in the router we need to install and configure the snmp daemon (snmpd) so it can respond to SNMP requests. By default it isn't possible to install anything on the router when using it's original software. However there is a workaround.
- First we need a USB flash drive with a size of at leat 2 Gb. Start by formatting the USB flash drive with the Linux file system ext4. It will also work with one of the older versions such as ext2 for instance. If you are running Linux on your workstation you would typically use the Gnome Partition Editor or GParted. If you are running windows then you can use a third party software such as MiniTool Partition Wizard or similar. Remember - Google is your friend ;-)
- When the USB flash drive is formatted we simply plug it in to the USB port of our RT-AC68U. Then we log on to the router through the Web UI. In the menu on the right there is an item called "USB Applications". When we click the link we get a screen displaying several functions and applications utilizing the USB port. At the end of the list you will find the "Download Master" function. Click the link and choose to install it on the USB drive. And this is where the magic happens. When the Download Master function installs in the RT-AC68U, it also installs a packet handler (ipkg) that will allow us to install other software packages :-).
- To access the packet handler and insall the snmpd packet we need to activate SSH access to the router. This is accomplished by logging on to the Web UI and then clicking on the "Administration" item in the menu on the right. Then we choose the "System" tab, where we will find a section called "SSH Daemon". We can choose to enable SSH for all ports on the router or just for the local ports. For security reasons I chosen just to enable SSH on local ports. Now we just need to save the settings and we are all done with the preparations
- Now we are ready to configure the router and install the SNMP daemon. Using our favorite SSH client we log on to the RT-AC68U using the same administration account that we used for logging on to the Web UI. Once we are logged on we run the following commands:ipkg update
ipkg install net-snmp
app_set_enabled.sh net-snmp yes
- Now we can change the SNMPD settings if necessary by editing the configuration file. (If we would like to change the community string or enable security for instance.)vi /opt/etc/snmpd.conf
- Finally we need to initialize the SNMP daemon by running:/opt/S70net-snmp.1
Finished! You will now have an extra process in your router looking something like this:
Now we can test our configuration by using the SNMPWALK command. It will traverse through the entire MIB tree and print all the objects in it.