User Tools

Site Tools


Cisco IOS への SSH

前に設定した service password-encryption を削除しておく。

R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#no service password-encryption


R2(config)#username admin1 password cisco1
R2(config)#line vty 0 15
R2(config-line)#login local
R2(config-line)#hostname R2
R2(config)#ip domain
R2(config)#ip domain-na
R2(config)#ip domain-name
R2(config)#crypto ke
R2(config)#crypto key ge
R2(config)#crypto key generate ?
  ec   Generate EC keys for ECDSA
  rsa  Generate RSA keys

R2(config)#crypto key generate rsa
The name for the keys will be:
Choose the size of the key modulus in the range of 360 to 4096 for your
  General Purpose Keys. Choosing a key modulus greater than 512 may take
  a few minutes.

How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 2 seconds)

*Jan 28 13:30:14.927: %SSH-5-ENABLED: SSH 1.99 has been enabled
R2(config)#ip ssh version 2

この時点で SSH ログインできるようになった。

しかしこの時点では telnet アクセスも有効なまま。

以下のようにして SSH アクセスのみ許可する。

R2(config)#line vty 0 15
R2(config-line)#transport input ssh ?
  lapb-ta  LAPB Terminal Adapter
  lat      DEC LAT protocol
  mop      DEC MOP Remote Console Protocol
  pad      X.3 PAD
  rlogin   Unix rlogin protocol
  telnet   TCP/IP Telnet protocol
  udptn    UDPTN async via UDP protocol
  v120     Async over ISDN

R2(config-line)#transport input ssh

telnet は弾かれるようになった。

R2#sh ssh
Connection Version Mode Encryption  Hmac         State                 Username
0          2.0     IN   aes256-cbc  hmac-sha1    Session started       admin1
0          2.0     OUT  aes256-cbc  hmac-sha1    Session started       admin1
%No SSHv1 server connections running.

Cisco ルータ間のSSH

もう 1 台ルータ起動するのが面倒なので GNS3 で検証する。

R1#ssh -l admin1
% Connection refused by remote host

R1#ssh -l admin1


R2#sh run
Building configuration...

レスポンス悪いって書いてあったけどめっちゃひどい。 こういう処理苦手なのかな IOS は。 それともこれは GNS3 で検証したからなのか。

R1#sh int f0/0
FastEthernet0/0 is up, line protocol is up
  Hardware is Gt96k FE, address is c201.072d.0000 (bia c201.072d.0000)
  Internet address is
  MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Half-duplex, 10Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:33, output 00:00:05, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     103 packets input, 13813 bytes
     Received 11 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog
     0 input packets with dribble condition detected
     134 packets output, 12750 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 unknown protocol drops
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out


tech/network/ssh/ssh.txt · Last modified: 2018/01/28 23:15 by wnoguchi