Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   router configuration in telnet (http://www.go4expert.com/forums/router-configuration-telnet-t5858/)

dieya 14Aug2007 18:33

router configuration in telnet
 
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..

jwshepherd 14Aug2007 19:08

Re: router configuration in telnet
 
what are you telneting into, a hardware router , a linux box. We need a lot more information before we can get started

dieya 14Aug2007 19:20

Re: router configuration in telnet
 
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.

jwshepherd 14Aug2007 21:01

Re: router configuration in telnet
 
what kind of router?

dieya 14Aug2007 21:07

Re: router configuration in telnet
 
cisco 2600 series

pradeep 16Aug2007 12:41

Re: router configuration in telnet
 
You can use Perl, it has module called Net::Telnet which can used to emulate a telnet connection through program!

dieya 16Aug2007 14:24

Re: router configuration in telnet
 
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..

jwshepherd 17Aug2007 12:10

Re: router configuration in telnet
 
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.

dieya 17Aug2007 12:27

Re: router configuration in telnet
 
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 Code:

<?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($usenet128)."\n";
                }
        }
?>
   </textarea>

[HTML]

onlyxl 4Feb2010 13:09

Re: router configuration in telnet
 
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.


All times are GMT +5.5. The time now is 14:25.