SysRestart Billion ADSL router (SNMP v2 or HTTP)

oidresetsnmp

Background

I am used to restart my servers on a scheduled basis. Now I want the same for my ADSL router.

This is my reason: When a random failure occurs, I am used to normally try to reboot the servers , interfaces and related equipments (if possible) as the first step before any other troubleshooting (e.g: changing configurations, etc).
In fact there are times that this corrects the problem (The service starts working as expected). This may be because when a system is long time up (sometimes, depending on the software and services), it may become unresponsive or faulty. May be the software fails to release some memory, unlock some resources , etc

Now for some services which scheduled down time is acceptable during non-work hours, I schedule the automatic restart. This way, such type of problems appear less frequently. And now if a problem occurs during work-hours, I don't need to restart the whole service, instead I will resume troubleshooting like after I had restarted them.

What we have

This is a Billion 5000 Series router and supports TELNET, HTTP and SNMP for management.

Telnet method (Updated)

This is possible to reboot the router via telnet command:

C:\>telnet 192.168.1.1
    Password:********
    router>set reboot

So near, just need a script that automatically telnets, pushes password characters and issues the 'set reboot' command. [The approach of using expect suggested by SvenW]

HTTP method

Good to mention that I utilize a software[1] application for monitoring my ADSL connection speed and noise margin via HTTP interface (the software itself, instead of a browser application, connects, logs in unattendedly and reads the values from HTTP interface and display them in a graph!).

I wonder if it is possible to achieve the SysRestart with similar approach (A script that automatically logs in and clicks the SysRestart button!)

The restart page:

  • Picture of the page:
    HTML Page with restart button
  • The source HTML of the page:

    <html><head>
    <meta http-equiv=Content-Script-Type content=text/javascript>
    <meta http-equiv=Content-Style-Type content=text/css>
    <meta http-equiv=Content-Type content="text/html; charset=
    iso-8859-1">
    <link rel="stylesheet" href="../css/style.css" type="text/css">
    <script language="JavaScript"> 
    function doRefresh()
    {
        alert("Reboot Complete");   parent.navigation.location.href = "/navigation-status.html";
        window.location.href = "../status/status_deviceinfo.htm";
    }
    
    function doLoad()
    {
    
         }
    
    </script>
    </head><body onload="doLoad()">
    <FORM METHOD="POST" ACTION="/Forms/tools_system_1" name="System_Restore">
    <table width="760" border="0" align=center cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
      <tr>
          <td height="5" class="light-orange" colspan="5">&nbsp;</td></tr><tr>
        <td width="150" height="30" class="title-main">
        <font color="#FFFFFF">System Restart</font>    </td><td width="10" class="black">&nbsp;</td><td width="150"></td><td width="10"> </td><td width="440"></td></tr><tr>
        <td class="light-orange">&nbsp;</td><td class="light-orange"></td><td class="tabdata"><div align=right>
        <font color="#000000">System Restart with</font>    </div></td><td class="tabdata"><div align=center>:</div></td><td class="tabdata">
            <INPUT TYPE="RADIO" NAME="restoreFlag" VALUE="0" CHECKED>       <font color="#000000">Current Settings</font>       </td></tr><tr>
        <td class="light-orange">&nbsp;</td><td class="light-orange"></td><td class="tabdata">&nbsp;</td><td class="tabdata">&nbsp;</td><td class="tabdata">
            <INPUT TYPE="RADIO" NAME="restoreFlag" VALUE="1">       <font color="#000000">Factory Default Settings</font>       </td></tr><tr>
        <td class="light-orange">&nbsp;</td><td class="light-orange"></td><td width="150">&nbsp;</td><td width="10">&nbsp;</td><td width="440">&nbsp;</td></tr></table><table width="760" border="0" align=center cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
      <tr>
        <td width="160" class="black" height="42" >&nbsp;</td><td width="160" class="orange">&nbsp;</td><td width="440" class="orange">
            <INPUT TYPE="SUBMIT" NAME="Restart" VALUE="RESTART">    </td></tr></table></div></form>
    </body></html>
    

SNMP Method

The router also has support for SNMP v2 read and write communities. I thought it might be possible to perform it this way.

In fact, by some search I found[2] that some people use SNMP to restart their devices (But I can't find an OID for my router to pass for performing a reset)

For example it appear that those who have one of these devices can reboot them using these OIDs:

'.1.3.6.1.4.1.207.8.4.4.3.2.0',    # Allied Telesyn restart
'.1.3.6.1.4.1.11.2.14.11.1.4.1.0', # Hewlett-Packard hpicfReset
'.1.3.6.1.4.1.9.5.1.1.9.0',        # Cisco CatOS sysReset
'.1.3.6.1.4.1.9.2.9.9.0',          # Cisco IOS tsMsgSend
'.1.3.6.1.4.1.529.9.8.0.0'         # Ascend sysReset

SNMP Walk

Using SNMP walk I could get a list of more than five hundred OIDs such as:

.1.3.6.1.4.1.16972.5.1.1.0
.1.3.6.1.4.1.16972.4.10.0
...etc (568 more)...

But I have currently no idea how can I pick one among them (specially afraid to test snmp-write on them!).

Some more info

Some other (walked) OID and values that might help:

.1.3.6.1.4.1.16972.1.3.0; Trendchip TC3162 T14F7_3.0
.1.3.6.1.4.1.16972.5.1.1.0; www.huawei.com
.1.3.6.1.4.1.16972.1.6.0; Ras Ver:2.10.4.0(UE0.C2C)3.6.0.0   DMT Ver:3.6.0.0

How can you help ?

  • Suggesting a way to script a restart via SNMP (Requires finding the
    OID first!?)
  • Suggesting a way to script a restart via HTTP
  • Suggesting a way to script a restart via telnet
  • Suggesting a way to script a restart (any other ways!)

FootNotes:

Best Answer

Without a proper MIB file for SNMP your best bet will to either find some telnet command that does the restart and maybe use it with the help of the expect tool or to use something like curl to use the web interface.

Using curl might require multiple calls to it to first login and save a session cookies and then to do the actual restart.

I do wonder though - do you have an actual problem with the device you try to fix with a regular restart? If not, I can't see the reason to do so.

Edit:

Basic example for an expect script. Call it with scriptname hostname password or alter the variable assignments to contain the actual hostname and password:

#!/usr/bin/expect 

set timeout 15
set hostname [lindex $argv 0] 
set password [lindex $argv 1] 

spawn telnet $hostname 

expect "Password:" 
send "$password " 
expect "router>" 
send "set reboot "
Related Topic