1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

router configuration in telnet

Discussion in 'PHP' started by dieya, Aug 14, 2007.

  1. dieya

    dieya New Member

    Joined:
    Aug 13, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    hye...im new in PHP..and i have my project to configure the router by using telnet in PHP script
    as i review and surf internet, to use telnet, we need to used fsockopen function to connect the telnet..
    plzz.help me..where can i get a guideline or something that can be usefull for my project for router configuration using telnet....plzz..
     
  2. jwshepherd

    jwshepherd New Member

    Joined:
    Aug 13, 2007
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VP Technology Corporation
    Location:
    Texas
    Home Page:
    what are you telneting into, a hardware router , a linux box. We need a lot more information before we can get started
     
  3. dieya

    dieya New Member

    Joined:
    Aug 13, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    sorry...
    want to telnet to the router for router configuration.for this project, i want to configure the router using telnet connection such as Ping, Telnet, router Rip, change hostname, set password in web based using PHP.
     
  4. jwshepherd

    jwshepherd New Member

    Joined:
    Aug 13, 2007
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VP Technology Corporation
    Location:
    Texas
    Home Page:
    what kind of router?
     
  5. dieya

    dieya New Member

    Joined:
    Aug 13, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    cisco 2600 series
     
  6. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    You can use Perl, it has module called Net::Telnet which can used to emulate a telnet connection through program!
     
  7. dieya

    dieya New Member

    Joined:
    Aug 13, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    i have review perl coding..is that can be used in PHP...as i know perl is a simple set of Perl script....so can perl be used n translate to PHP??
    as i surfing in internet..i also found 1 website were perl to php..http://www.cs.wcupa.edu/~rkline/perl2php/
    can somebody gv me other suggestion or guideline.pls..
     
  8. jwshepherd

    jwshepherd New Member

    Joined:
    Aug 13, 2007
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VP Technology Corporation
    Location:
    Texas
    Home Page:
    create a web page with all of the params you want. Then once you POST the page send that data to your perl to telnet the data into your cisco.
     
  9. dieya

    dieya New Member

    Joined:
    Aug 13, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    i already try one script To make a telnet connection with a Cisco router. i have try it n found error and can't understand it.plz,.explain to me...

    HTML:
    	[PHP]<?php 
    
    //$value1=$_POST['text'];
    $ip=$_POST['ip'];
    $port=$_POST['port'];
    
    $cfgServer = $ip;  //IP of your router
    $cfgPort    = $port;                //port, 22 if SSH
    $cfgTimeOut = 10;
    
    $usenet = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut);
    ?>
    <textarea name="ios" cols="50" rows="10" id="ios">
    <?php
    if(!$usenet)
            {
            echo "Connection failed\n";
            exit();
            }
    else
            {
            echo "Connected\n";
            fputs ($usenet, "toto\r\n");
           fputs ($usenet, "en\r\n");
           fputs ($usenet, "tutu\r\n");
           fputs ($usenet, "exit\r\n");
            while (!feof($usenet))
                    {
                    echo ". ".fgets($usenet, 128)."\n";
                    }
            }
    ?>
       </textarea>[/PHP]
    [HTML]
     
  10. onlyxl

    onlyxl New Member

    Joined:
    Feb 2, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    HI, i have come across this forum, and i would like to ask u guys to help me up wif my codes/scripts. i need to create a web based application to configure routers using perl script. as i have use net::telnet::cisco already.. this makes me telnet to the terminal server. as i'm totally new to PERL, please kindly guide me. show me one example of changing hostname from web based to configure router using perl script? any help will be deeply appreciated.
     
  11. seangtz

    seangtz New Member

    Joined:
    Jun 6, 2008
    Messages:
    126
    Likes Received:
    3
    Trophy Points:
    0

Share This Page