read from Cisco router

is it possible to read the configuration stored in cisco router using C#

How




Answer this question

read from Cisco router

  • Zero_

    i dont think so, unless there are API's or something, unlikely however.

    only way would be via telnet (or its own web config page)

     

    I guess if you are connecting to it via serial cable, use the SerialPorts class in .NET 2.0 to establish a connection, then read data from it using the DataRecieved Event or something. But in terms of reading the configuration, not really sure



  • gtimofte

    For this kind of devices you have normally two choices - either is is configurable by means of WEB interface - then use HttpWebRequest or it is configurable by TELNET then use TcpClient from System.Net namespace. Both is feasible, however because CISCO has quite simple command line interface on TELNET connection, I would definetely recommend you to use this.


  • MBorjesson

    but each router has an IP address and I connect to it using that IP na deach router has configuration file(s)..

    isn't it possible to connect using the IP and retrieve values from the configuration file

    so Microsoft never thought of it and it's a new idea WOW!!!!!!



  • ahmedilyas

    to: toben888

    but this way,the info isn't the newest

    maybe the telnet is better



  • Rassol

    there is no real way to have to make something for every single router in the world - this is just not possible. .NET was not designed for this - what you are asking for really is having to go perhaps low level (C/C++). Please do consider this than making assumptions which would be invalid.

    if you know the exact location of the file, then try getting it using the System.Net classes, either by FTP classes (probably not usable for the router) or by using the socket/network stream classes to connect to the router and then get the file.

    Now, you will most likely not be able to retrieve the configuration file since it would be secured and unreadable to the human, which the router software takes care of and this is why you have a console/router configuration software to interact with - that is the whole point on the manufacturers' making their own software interaction and to prevent hackers modifying the configuration file (even though this is not your intention)



  • Garegin Gulyan

    I do not think you can do this since there is no direct access support for such things. Either maybe use SerialPorts and send commands and then pick up the response from the DataRecieved event or telnet would be the option.



  • lucerias

    You should be able to connect to it useing the System.Net classes and simulate a telnet session. The other way is to use some sort of web scrapping classes to collect the data. My suggestion would be to simulate a telnet session as you will be able to pull more information. You might have to check on the security systems though, for example if the connection uses a security layer in the telnet session.

    No if you just want to read the information and monitor the system, I would look at snmp, or setting up a syslog server to collect the monitoring data.



  • Davids Learning

    Cisco routers have the option to backup to a tftp server. Just set them to backup to a tftp server and read the file in from there.

  • Igor Solodovnikov

    i want to read thd configuration file directly withouy telneting

    for example.. i want to show the version of the router IOS on my form directly instead of telnet->show version



  • read from Cisco router