Cisco telnet

R2 側に必要な設定

enable secret password
line vty 0 15
password password
login
end

接続

R1#telnet 192.168.12.2
Trying 192.168.12.2 ... Open


User Access Verification

Password:
R2>en
Password:
R2#

ユーザ一覧

R1 から telnet してアクセスした場合

R2>show users
    Line       User       Host(s)              Idle       Location
   0 con 0                idle                 00:01:33
* 98 vty 0                idle                 00:00:00 192.168.12.1

  Interface    User               Mode         Idle     Peer Address

GNS3 上でのコンソールアクセスの場合

R2#show users
    Line       User       Host(s)              Idle       Location
*  0 con 0                idle                 00:00:00
  98 vty 0                idle                 00:00:41 192.168.12.1

  Interface    User               Mode         Idle     Peer Address

Exit Session

R2>exit

セッションの再開

[Connection to 192.168.12.2 closed by foreign host]

R1#telnet 192.168.12.2
Trying 192.168.12.2 ... Open


User Access Verification

Password:
R2>en
Password:
R2# ← Ctrl+Shift+6 X(or control+^ X)
R1#

R1#sh sessions
Conn Host                Address             Byte  Idle Conn Name
*  1 192.168.12.2        192.168.12.2           0     0 192.168.12.2

R1#resume 1
[Resuming connection 1 to 192.168.12.2 ... ]

R2#

telnet セッションを切断したい

Ctrl+Shift+6 X

R2# ← Ctrl+Shift+6 X(or control+^ X)
R1#disconnect
Closing connection to 192.168.12.2 [confirm]
R1#sh sessions
% No connections open

R2#sh users
    Line       User       Host(s)              Idle       Location
*  0 con 0                idle                 00:00:00

  Interface    User               Mode         Idle     Peer Address

放置されたセッション、悪意あるセッションを殺す

R1#telnet 192.168.12.2
Trying 192.168.12.2 ... Open


User Access Verification

Password:
R2>en
Password:
R2#

R2#sh users
    Line       User       Host(s)              Idle       Location
*  0 con 0                idle                 00:00:00
  98 vty 0                idle                 00:00:26 192.168.12.1

  Interface    User               Mode         Idle     Peer Address

駆逐してやる!

R2#clear line 98
[confirm]
 [OK]
R2#sh users
    Line       User       Host(s)              Idle       Location
*  0 con 0                idle                 00:00:00

  Interface    User               Mode         Idle     Peer Address

R1 側では

R2#
[Connection to 192.168.12.2 closed by foreign host]
R1#

実装時や実験環境ではセッションタイムアウトを無効にしていることが多い。

exec-timeout 0 0

References

  1. Ciscoデバイスの操作 – Telnet
  2. WS-C3550でTelnetログインできるようにする | | Beyond Future Yak Shaving
  3. Network Swiss Army Knife | Beyond Future Yak Shaving

GNS3 iTerm2 terminal says ‘telnet: not found’

May from macOS High Sierra, Apple removed telnet?

  1. macOS High Sierra 10.13.2
  2. GNS3 2.1.1
  3. terminal: iTerm2
  4. VMware Fusion Pro 10.1.0 (7370838)

telnet not found

sh-3.2$ exec telnet 172.16.98.128 5000
sh: exec: telnet: not found
sh-3.2$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin
$ brew install telnet
$ which telnet
/usr/local/bin/telnet

Configure GNS3 iTerm2 configuration.

osascript -e 'tell application "iTerm"' -e 'activate' -e 'if (count of windows) = 0 then' -e '   set t to (create window with default profile)' -e 'else' -e '   set t to current window' -e 'end if' -e 'tell t' -e '    create tab with default profile command "sh"' -e '    set s to current session' -e '    tell s' -e '        set name to "%d"' -e '        write text "exec telnet %h %p"' -e '    end tell' -e 'end tell' -e 'end tell'

changes following(specify telnet full path):

osascript -e 'tell application "iTerm"' -e 'activate' -e 'if (count of windows) = 0 then' -e '   set t to (create window with default profile)' -e 'else' -e '   set t to current window' -e 'end if' -e 'tell t' -e '    create tab with default profile command "sh"' -e '    set s to current session' -e '    tell s' -e '        set name to "%d"' -e '        write text "exec /usr/local/bin/telnet %h %p"' -e '    end tell' -e 'end tell' -e 'end tell'