Telnet configuration command directory

telnet

ip telnet

where

disconnect

resume

switchkey

switchmsg

sequence-char

clear Telnet

show Telnet

debug Telnet

 This chapter will introduce telnet and its configurations and management commands. “telnet” is used to setup “telnet” session with a remote server. “telnet” is usually used to telnet Unix system.  

It needs negotiation about optional items. “telnet” can not provide authorization to itself . So , it is mostly different from Rlogin in which it can not provide password verification to itself.

telnet

command format to create telnet session is following:

telnet server-ip-addr/server-host-name [/port port][/source-interface interface] [/local local-ip-addr] [/debug][echo/noecho] [/script scriptname]

parameter:

     server-ip-addr:              

Remote server’s IP address is expressed by decimal system.

server-host-name: 

The host name of the remote server, it need use command “ip host” to configure.

port: 

The port providing telnet service of the remote server.

interface:      

Local interface to launch telnet connection

local-ip-addr:  

Local IP address to launch telnet connection

/debug:  

Open debug switch of client , print negotiation course when connection.

 

echo/noecho:    

Open/turnoff local echo, default is noecho.  

scriptname: 

The script name used to automatically login

Default:

port default is 23, interface does not have default.

command mode:

supervisor mode

explanation:

User can use one of following commands to telnet

telnet server-ip-addr/server-host-name

In this condition, application program will transmit telnet request to 23 interface of the remote server, the used IP address is the nearnest IP address according to route table.

telnet server-ip-addr/server-host-name /port port

At this time, application program transmit telnet request to the peer port.

telnet server-ip-addr/server-host-name /source-interface interface

At this time, application use interface’s IP address as local address.

telnet server-ip-addr/server-host-name /debug

At this time, application program opens debug switch of client, and will output link negotiation course.

telnet server-ip-addr/server-host-name echo/noecho

server-ip-addr:              

Remote server’s IP address is expressed by decimal system.

server-host-name: 

The host name of the remote server, it need use command “ip host” to configure.

port: 

The port providing telnet service of the remote server.

interface:      

Local interface to launch telnet connection

local-ip-addr:  

Local IP address to launch telnet connection

/debug:  

Open debug switch of client , print negotiation course when connection.

 

echo/noecho:    

Open/turnoff local echo, default is noecho.  

scriptname: 

The script name used to automatically login

At this time , application program opens/closes local echo. Usually, Local echo is closed ,echo is finished by the server. Only when the server is not responsible for echo, local echo switch will open.  

 

telnet server-ip-addr/server-host-name /script scriptname

Before execute automatically login command of this script , use command “ip telnet script” to configure.

Above command parameters can be used united.

When in the course of session with the remote server ,user can use “q” key to quit .If do not exit by hand, it will exit after 10 seconds waiting.

Example:

If user want to telnet to the server “ 192.168.20.124”, and the server has two telnet ports: 23 and 2323, and local has two ports: e1/1(192.168.20.240) and s1/0(202.96.124.240).User can use following commands to telnet.

1.telnet 192.168.20.124 /port 2323

   In such a condition , telnet will connect to peer 2323 port .The local IP address seen by the peer is 192.168.20.240. 

2.telnet 192.168.20.124 /source-interface s1/0

   In such a condition, telnet will connect to peer 23 port .The local IP address seen by the peer is 202.96.124.240.

3.telnet 192.168.20.124 /local 192.168.20.240

In such a condition , telnet will connect to peer 23 port .The local IP address seen by the peer is 192.168.20.240.

4.telnet 192.168.20.124 /debug

In such a condition, telnet will print negotiation course to setup telnet connection to peer 23 port.

5.telnet 192.168.20.124 /echo

In such a condition, telnet will open local echo switch. At his time, if the sever runs echo also, all input will be echoed for two times.

6.telnet 192.168.20.124 /script s1

Use login script named “s1” to automatically login.

 

ip telnet

configuration commands’ format about telnet session are following:

ip telnet source-interface interface

ip telnet access-class accesslist

ip telnet listen-port start-port [end-port]  

ip telnet script scriptname ‘user_prompt’ user_answer ‘pwd_prompt’ pwd_answer

parameter:

interface:   

  The local interface launching telnet

accesslist:     

When local is receiving connection, accessing list name to limit source address.

 

start-port:               

user appoint the start-port number of interception field

end-port:    

user appoint the end-port number of interception field

scriptname:  

login script name

 

user_prompt: 

user name prompt information sent back by the telnet server

user_answer:    

user answer information submitted by client

pwd_prompt:  

user password prompt information sent back by the telnet server

 

pwd_answer:  

password answer information submitted by client

default

none

command mode

global configuration mode

explanation

User can use following commands to configure local source interface to launch telnet.

ip telnet source-interface interface

In such a condition, all subsequent telnet use this interface. This configuration command is similar to “telnet source-interface interface”, but it does not need to add parameter when using command ‘telnet”. If not only configure a interface ,but also add interface parameter in command “telnet”, it should be determined by the latter.   

User can use following commands to configure access list names limited by local telnet connection.

ip telnet access-class accesslist

In such a condition, after that, when the server accepts all telnet connections, it needs to check access list.

User can use following commands to configure other interfaces except default (23) to receive telnet connection.

 

ip telnet listen-port start-port [end-port]

Explanation: if not appoint end-port number, it will intercept on a special port. The numbers of appointed interception ports can not be more than 16,and ports can be limited between 3001 and 3999.

 

ip telnet script s1 ‘login:’ router ‘Password:’ test

Explanation: when configuring script , user name prompt, answer, password prompt ,answer must fully match. And user must pay attention to prompt information, it differs whether capitalization or not, and prompt information must add (‘’). If any item is not configured properly, it can not automatically login successfully .

Note: above four commands can add prefix “no” to cancel setting.

example

1ip telnet source-interface s1/0

In such a condition, all coming launching telnet connections use s1/0 interface.

2ip telnet access-class abc

In such a condition, all coming accepting telnet connections will be checked by access-list “abc”.

3ip telnet listen-port 3001 3010

Besides 23,user can use all port between 3001 and 3010 to accept telnet connections.

4ip telnet script s1 ‘login:’ router ‘Password:’ test

configure a login script named s1,user name prompt is ‘login:’, answer is router, password prompt is  ‘Password:’, answer is test.

 

ctrl-shift-6+x(suspend current telnet connection)

suspend telnet connection on client

ctrl-shift-6+x

parameter

none

default

none

command mode

any time on current telnet session

explanation

user can use this short key to suspend current telnet connection from client.

example

RouterA>telnet 192.168.20.1

   Welcome to Multi-Protocol 1700 Series Router

RouterB>ena

RouterB#(按ctrl-shift-6+x)

RouterA>

If user press “ctrl-shift-6+x”on current telnet session connection to RouterB , it will suspend connection to RouterB, and go back to RouterA’s current state  

where

check current suspend telnet session on client:

where

parameter

none

default

none

command mode

global configration mode

explanation

User can use this command to check current suspend out telnet connection on client .Displayed information include number, peer address, peer port ,local address, local port.  

note: command ”where” is different from command “show telnet”. The former is used on client to show out telnet connection, while the latter is used on server client to show in telnet connection.  

example

RouterA>telnet 192.168.20.1

   Welcome to Multi-Protocol 1700 Series Router

RouterB>ena

RouterB#(按ctrl-shift-6+x)

RouterA> telnet 192.168.20.2

   Welcome to Multi-Protocol 1700 Series Router

RouterC>ena

RouterC#(按ctrl-shift-6+x)

RouterA>where

NO.         Remote Addr     Remote Port          Local Addr      Local Port

   1       192.168.20.1              23      192.168.20.180           20034

   2       192.168.20.2              23      192.168.20.180           20035

User input command ”where”on RouterA to show out and suspend information on RouterA. 

resume

resume current out and suspend telnet session on client:

resume no

parameter

no:current suspend telnet session number seen through  command “where”

default

none

command mode

global configuration mode

explanation

User can use this command to resume current out and suspend telnet connection on client.

example

RouterA>telnet 192.168.20.1

   Welcome to  Multi-Protocol 1700 Series Router

RouterB>ena

RouterB#(按ctrl-shift-6+x)

RouterA> telnet 192.168.20.2

   Welcome to Multi-Protocol 1700 Series Router

RouterC>ena

RouterC#(按ctrl-shift-6+x)

RouterA>where

NO.         Remote Addr     Remote Port          Local Addr      Local Port

   1       192.168.20.1              23      192.168.20.180           20034

   2       192.168.20.2              23      192.168.20.180           20035

RouterA>Resume 1

  [Resuming connection 1 to 192.168.20.73 . . . ]

 (enter)

RouterB#

User input command “where”on RouterA, after displaying out and suspend information on RouterA, input “Resume 1”,displayed information will prompt user “ resume to connection 1”,  after enter, it will appear: “RouterB#”

 

disconnect

clear current suspend out telnet session on client:

disconnect no

parameter

no: current suspend telnet session number through command “where”

default

none

command mode

global configuration state

expanation

User can use this command to clear current suspend out telnet connection on client.

 

note: command ”disconnect” is different from command “clear telnet”. The former is used on client to clear out telnet connection, while the latter is used on server client to clear in telnet connection.  

 

example

RouterA>telnet 192.168.20.1

   Welcome to Multi-Protocol 1700 Series Router

RouterB>ena

RouterB#(按ctrl-shift-6+x)

RouterA> telnet 192.168.20.2

   Welcome to Multi-Protocol 1700 Series Router

RouterC>ena

RouterC#(按ctrl-shift-6+x)

RouterA>where

NO.         Remote Addr     Remote Port          Local Addr      Local Port

   1       192.168.20.1              23      192.168.20.180           20034

   2       192.168.20.2              23      192.168.20.180           20035

RouterA>disconnect 1

<Closing connection to 192.168.20.1> <y/n>y

 

 Connection closed by remote host.

RouterA>

User inputs command “where”on RouterA, after displaying out and suspend information on RouterA, input “disconnect 1”,displayed information will prompt user “ whether close connection to RouterB”,  after enter”Y”, connection closes.

 

terminal switch function

it adds terminal switch function in this version telnet. Perform following steps to use this function:

1)                          configure alias (alias command) for command “connect” in global configuration mode

2)                          configure terminal switch key in line configuration mode (switchkey command)

3)                          configure terminal character sequence in line configuration mode(sequence-char command)(optional, if without this step, screen information can not be saved.) 

4)                          configure asynchronous interface to interactive mode(async command) in interface configuration mode

5)                          Connect real terminal to asynchronous interface and open the terminal

now ,user can switch terminal free by pressing random configured short keys when operation and can display switch menu by “ctrl+\”keys. 

 

relevant command

 

switchkey

 

the commands to configure terminal switch keys on line are following:

switchkey key cmdalias server-name

parameter:

key: can use “ctrl-a-ctrl-z”, do not use “ctrl-h”

cmdalias: alias of command “connect”

server-name: the remote server’s name, it will appear in switch prompt information and switch menu

default

none

command mode

line configuration mode

 

explanation

User can configure terminal switch keys and their correspond alias and remote host name through using this command.

note: 1:cmdalias parameter must appoint to a correct “connect”command

2) “key” parameter can not be “ctrl-h”

3)  “server-name” parameter will appear in switch prompt information and switch menu   

4)   do not configure “autocommand” on this line ,or terminal switch function will not work    

 

example

RouterA>switchkey ctrl-a cona ServerA

configure switch-key “ctrl-a”, use command alias “cona”, switch to the server “ServerA”.

switchmsg

the command determining whether to output terminal switch prompt information on line are following:

 

switchmsg enable/disable

parameter:

enable:  output terminal switch prompt information

disable:forbid to output terminal switch prompt information

default:

disable

command mode:

line configuration mode

explanation:

User can use this command to configure on line whether to output switch prompt information when terminal switch.

example:

RouterA>switchmsg enable

output switch prompt information when terminal switch

 

sequence-char

the commands to configure switch keys on line are following:

sequence-char key char1 char2 char3 …

parameter:

key: can use “ctrl-a-ctrl-z”, can not configure”ctrl-h”

char1 char2 char3 …  screen sequence-char associated special terminal

default

none

command mode

line configuration mode

explanation:

User can use this command to configure terminal switch keys and sequence-char on line.

note  1) key parameter can not be “ctrl-h”

2) Sequence-char parameter is associated with specific terminal ,user can search terminal manual to obtain usually.

3) Sequence-char parameter must be hex number, begins with Ox,

and distinguish each character with space key.

example

RouterA>sequence-char ctrl-a 0x1b 0x21 0x38 0x51

sequence-char to configure switch key “ctrl-a” is “0x1b 0x21 0x38 0x5”

 

Other alias, async commands can refer to related configuration explanation . 

 

example

The router’s configurations are following: 

...

interface Serial1/1

 physical-layer mode async

 no ip directed-broadcast

 async mode interactive

line tty 1

switchkey     CTRL-U       cona       ServerA

 sequence-char  CTRL-U            0x1b 0x21 0x38 0x51

 switchkey     CTRL-V       conb       ServerB

 sequence-char  CTRL-V            0x1b 0x21 0x39 0x51

 switchkey     CTRL-W       conc       ServerC

 sequence-char  CTRL-W       0x1b 0x21 0x31 0x30 0x51

 switchmsg enable

...

alias cona connect 192.168.20.1

alias conb connect 192.168.20.2

alias conc connect 192.168.20.3

 

After finish all configurations and connection, open terminal, switch menu will automatically appear in the screen. The system will switch to ServerA automatically after entering “CTRL-U”(and output prompt information of current host ServerA). 

 

The system will switch to ServerB automatically after entering “CTRL-V”(and output prompt information of current host ServerB).

The system will switch to ServerC automatically after entering “CTRL-W”(and output prompt information of current host ServerC).

At any time, after entering“CTRL-\”,switch menu will appear in current screen, and add “*”behind current server.

The following is display content after input “CTRL-\”:

======================================

Terminal Switch Menu

1)         CTRL-U       ServerA   *

2)         CTRL-V       ServerB

3)         CTRL-W    ServerC

 

NOTE:

1)        In the operation of several connections, if exiting from one of the connections (not switch), system will take the first connection as current connection, screen will restore to the first host’s interface, if the first connection is exiting , system will take the second connection as current connection, screen will restore to the second host’s interface.

   

2)        after finish all tasks, the suggested way to exit the system is to close terminal directly regardless how many connections are open curremtly.

3)        do not exit the first connection before exiting other connections

4)        user had better not exit some connection in the operation, and only switch. To close the terminal after finish all operations.

5)        in the operation of terminal switch, the functions of connections suspending and restoring through ctrl-shift-6+x will be forbidden.

 

clear telnet

the command format to clear telnet session on the server is following:

clear telnet no

parameter

no:   the telnet session number displayed by show telnet

default

none

command mode

supervisor mode

explanation:

User can use this command to clear telnet session on the server.

example

1. clear telnet 1

clear telnet 1 seesion (192.168.20.220:1097) on the server

 

show telnet

the command format to show telnet session of the server is following:

show telnet

parameter

none

default

none

command mode

other modes except user mode

explanation:

User can use this command to show telnet session of the server. The displayed information include number, peer address, peer port, local address, local port.     

example

1. show telnet

Display connect-in telnet session information of the server.

perform results are following:

NO.         Remote Addr     Remote Port          Local Addr      Local Port

   1      192.168.20.220            1097      192.168.20.240              23

   2      192.168.20.180           14034      192.168.20.240              23

  

debug telnet

 

command”debug”’s  format of telnet session is following:

debug telnet

parameter

none

default

none

command mode

supervisor mode

explanation:

User can use this command to open telnet’s debug switch.

Now, all connect-in telnet session’s negotiation course print in debug output windows.

This command is different from telnet command with debug parameter in: the former is output connect-in telnet session’s debug information of the server, the latter is output launching telnet session’s debug information of the client.

example

debug telnet

User open connect-in telnet session’s debug of the server.