Enabling SNMP on an ASUS RT-N66U

Recently I wanted to monitor an ASUS RT-N66U, a brilliant router with many feature, one of which did NOT appear to be SNMP.

After some rooting around on the Internet (pun intended?), I discovered that it is actually quite easy to set up.

For this you will need a small USB stick, I used an old tiny 4GB thumb drive.

Ensure it's partitioned and formatted to ext2. If you're using Windows then EaseUS Partition Master can help, there's a free version for home use.  Otherwise the Gnome Partition Editor, otherwise known as GParted, will work.

Just pop the USB drive into the back of the router and go to the "USB application" page in the UI, it's one of the options under "General" on the left hand index.

At the bottom of that page is the "Download Master" which you can then choose to install onto your USB.

What this does is into install a package manager, along with various packages for the Download Master, but this gives you the ability to install other packages!

Next, in the "Advanced Settings" -> "Adminstration" section, about half way down the page in the "Miscellaneous" section is the "Enable Telnet" option. Set this to "Yes" so you can log into the router via telnet.

Telnet to the router and log in with your admin account.

Execute the following:

ipkg update 
ipkg install net-snmp
app_set_enabled.sh net-snmp yes

the config file, should you need to change it, is /opt/etc/snmpd.conf

I found that after changing the file, to modify the community string for example, I had to execute S70net-snmp.1 in the /opt directory which, if you look at its contents, shuts down any snmpd and starts it again.
 

Comments

  1. I try and do this and get:

    admin@RT-N66U:/tmp/home/root# ipkg update
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz
    Inflating http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz
    Updated list of available packages in /opt/lib/ipkg/lists/optware.oleg
    Downloading http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz
    An error ocurred, return value: 1.
    Collected errors:
    ipkg_download: ERROR: Command failed with return value 8: `wget -q -P /opt/ipkg-fzhN2l http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz'
    admin@RT-N66U:/tmp/home/root#

    ReplyDelete
    Replies
    1. That implies the server has returned an error when trying to update.
      You could try again later. Also did this stop you from doing the install?

      Delete
    2. incase anyone else stumbles onto this. I had the same problem. a firmware update fixed it.

      Delete
    3. Hi Daniel
      I am facing the same issue even after trying multiple times
      admin@RT-N56U:/tmp/home/root# ipkg update Downloading http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz Inflating http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz Updated list of available packages in /opt/lib/ipkg/lists/optware.oleg Downloading http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz wget: server returned error: HTTP/1.1 404 Not Found An error ocurred, return value: 1. Collected errors: ipkg_download: ERROR: Command failed with return value 1: `wget -q -P /opt/ipkg-b93bQW http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz' admin@RT-N56U:/tmp/home/root#

      Delete
  2. Hello Daniel,

    I have setup the SNMP and it all works great. I want to be able to monitor the Internet bandwidth. problem is there are multi sensors which i have no clue which is which.

    Options for the sensors are as follows; eth0, eth1, eth2, vlan1 and vlan2

    What i need to know is which ones are Internet, Wireless and Local Network.

    Any advice would be helpful.

    Thank you

    ReplyDelete
    Replies
    1. Unfortunately I have seen it vary so the simplest approach is to put load on the network and see which interface increases. So try an Internet download, a file transfer from one box to another on the wireless and wired connection.

      Delete
    2. Thank you,

      I will try this out and report what happens. Also thank you for the guide on how to setup SNMP on my ASUS router. it worked like a charm and was super easy to do. Now i can use PRTG Network Monitor to track my bandwidth usage.

      Delete
    3. After some playing with moving data and more internet searches, i have come to this conclusion.

      eth0 = WAN
      br0 = Bridge
      eth1 = Wifi 2.4G
      eth2 = Wifi 5G
      vlan1 = LAN switch

      The bridge is made up of vlan1, eth1 and eth2. So basicallly br0 is the whole LAN.

      You can get additional VLANs if you have Dual WAN enabled, for example.

      Delete
    4. After some investigation I realized if you actually use it on access point mode, then it bridges all wifi radios in one. That is the only explanation I can come up for my RT-87U showing only eth0 and eth1. Others are fine and seem to confirm the findings here, but really a bummer not been able to monitor both interfaces individually when in AP mode.

      Delete
  3. A comment on the statement by Berry Kropiwka: his observation may be a specific case. I got all interfaces graphing on Cacti (minus loopback), and noticed that the traffic in br0 is smaller than on Vlan1. That would signify that the bridge (br0) is not the aggregate of the entire LAN side, not that I can tell what it is doing instead :( Perhaps the bridge aggregates only the wi-fi, but this is speculation.

    A last point. I forced a big transfer and some Netflix streaming from a node *connected over ethernet*, and it was clear that the WAN traffic (eth0) was matched in VLAN1. I think it is safe to second his call that vlan1 is the switch, as was posted.

    So, wrapping: WAN and wired LAN interfaces seem "made" and plotted, but the relationship between bridge, eth1 and eth2 may not be completely clear.

    I pasted a link to the Cacti screenshot in case someone wants to try to analyze the relationship, it might be useful. - http://www.screencast.com/t/gbCn3Xta4VPy

    ReplyDelete
  4. Thanks for posting this article. I was looking for a way to use SNMP on my RT-AC68U - Google search seemed to indicate that it did do it, but Asus were pretty tight lipped about it.
    Not sure about your '66U, but the 68U has ssh and can use key authentication (good for security and preferable to telnet). I'm a bit annoyed though that the whole NSLU2 package setup seems to be pretty much a hidden feature as far as Asus goes!

    ReplyDelete
  5. I am using NetWorx to monitor all my internet traffic to make sure Comcast is accurately reporting my usage. I cannot find any interface that reports only the WAN traffic or external only. The eth0 interface seems to report everything even if I unplug the WAN it still reports traffic from computer to computer over the network. The other interfaces monitor wifi or ethernet ports. None of these are what I need.

    ReplyDelete
    Replies
    1. An old post I know but did you work this out? I am having the same problem!

      Networx is showing the following under 'WAN interface': lo, ifb0, ifb1, fwd0, fwd1, agg, eth0, dpsta, eth1, eth2, vlan1, vlan2, br0.

      Thanks.

      Delete
  6. I have an ASUS RT-N66W and am trying to do as you suggest but when I type in 'ipkg update' I get 'ipkg not found'. Is there a difference between the RT-N66W and the RT-N66U?

    ReplyDelete
    Replies
    1. I had this problem until i did the following:
      Just pop the USB drive into the back of the router and go to the "USB application" page in the UI, it's one of the options under "General" on the left hand index.

      At the bottom of that page is the "Download Master" which you can then choose to install onto your USB.

      There is a big icon which shows the USB drive.
      Move the mouse around til a green down arrow appears on the icon. click on the arrow and the download master loads onto the usb.

      After doing this telnet into the router and the ipkg command works.

      Delete
    2. Isn't that what the instructions say to do?

      Delete
    3. The instructions show the right place to go but don't say exactly what to do and what to expect to happen. The first time I tried, I clicked on the big USB icon and it highlighted so I thought I was done. I spent an hour on google trying to find out why ipkg still didn't work on my router. Clicking on the right place on the icon starts the download master install. It show a log of the install which takes a few minutes. Then ipkg works.
      Without this whole page of instructions I would be at a complete loss, thx.

      Delete
  7. Can the USB be removed after the installation of "Download Master"?

    ReplyDelete
    Replies
    1. That's a good question. I don't know as I had an old one I just left in there. I would have thought so though. Best check router's fine after a reboot without it in though to be sure.

      Delete
    2. I tried on my RT-87U and it did removed ipkg when USB drive is removed through the interface. Don't know if simply unmounting it and removing would do the same.

      Delete
  8. Hey guys. I just did this, and it worked great. The problem is that it doesn't survive a reboot. Can anyone tell me what to do to get OptWare & net-snmp restarted? Thanks.
    -G

    ReplyDelete
  9. Please ignore that last post. Everything came back on it's own. It just took a while.
    -G

    ReplyDelete
  10. Works perfectly on the DSL-AC68U, thank you!

    ReplyDelete
  11. I found that a firmware update on my DSL-AC86 broke the SNMP, so by following the original instructions with the "-force-reinstall" parameter, restored snmp operation

    ReplyDelete
  12. Asus RT-AC87u, followed the procedure in the past - worked great.
    Now, after updating to version 3.0.0.4.380_7378, trying to do "ipkg install net-snmp", getting an error :
    /opt/sbin/snmpd: can't load library 'libcrypto.so.0.9.8'
    postinst script returned status 16
    ERROR: net-snmp.postinst returned 16

    Help would be appreciated...

    ReplyDelete
    Replies
    1. Try ipkg install net-snmp -force-reinstall..

      make sure you don't overwrite your snmpd.conf file though

      for bandwidth refresh intervals have a look at setting the cache refresh parameters through snmpset..

      Facing a different challenge myself..Has anyone had any success enabling debug logging btw? I've enabled a swap file but still keep getting issues as it can't find swap stat counters in /proc/vmstat..

      Delete
    2. to fix the libcrypto.so 0.9.8' error you'll need to reinstall net-snmp's dependent app 'openssl' To do this use the following command

      ipkg install openssl -force-reinstall

      worked for me.

      Delete
    3. Same problem for my router.
      But I need to reinstall openssl at every boot.
      There is a way to save this package configuration so it doesn't loose at every reboot?

      Delete
  13. Further info incase this post gets picked up by anyone else..

    To increase the polling rate :

    snmpset -v 2c -c 127.0.0.1 1.3.6.1.4.1.8072.1.5.3.1.2.1.3.6.1.2.1.2.2 i 1

    this sets the ifTables & refresh interval to 1..

    (This was why i was trying to get debugging working, ended up using wireshark to check i was on 64bit counters & then found a post somewhere talking about updating the polling intervals)


    ReplyDelete
  14. snmpset -v 1 -c SNMPv1_RW 127.0.0.1 1.3.6.1.4.1.8072.1.5.3.1.2.1.3.6.1.2.1.2.2 i 1

    is what ended up working for me for changing the polling intervals after reading the man page of the snmpset command and getting the default write community from the /opt/etc/snmpd.conf file which was SNMPv1_RW.

    Now if someone could enlighten me on how Athar got the OID for changing the interval so I can make similar mods on other routers, Cisco etc

    Thanks a lot Daniel and everyone :)

    ReplyDelete
  15. vi /opt/etc/init.d/S70net-snmp
    to append the line
    snmpset -v 1 -c SNMPv1_RW 127.0.0.1 1.3.6.1.4.1.8072.1.5.3.1.2.1.3.6.1.2.1.2.2 i 1
    This will make the polling interval change permanent.

    The usb stick also has to stay in for the SNMP to continue working after reboot.

    hth :)

    ReplyDelete
  16. After updating firmware on RT-AC68U to 3.0.0.4.384_20308 that config (/opt/etc/ipkg.conf) helped me to repair snmp:
    #Uncomment the following line for native packages feed (if any)
    src nslu2 http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable
    src/gz optware.mbwe-bluering http://ipkg.nslu2-linux.org/feeds/optware/mbwe-bluering/cross/stable
    src/gz optware.asus http://nw-dlcdnet.asus.com/asusware/arm/stable
    dest /opt/ /
    option verbose-wget

    ReplyDelete
  17. Awesome post, everything worked as expected. Thank you!

    ReplyDelete

Post a Comment

Popular posts from this blog

Windows 7 - Cisco VPN Client

Making Microsoft Dataverse OData queries using Postman