Powered by Blogger.

Cấu hình SSH trên router Cisco

Cấu hình router để hỗ trợ SSH

Phiên bản IOS hỗ trợ cho SSH và được dùng trong bài lab này là Advance Security. Đầu tiên hãy dùng lệnh show version để kiểm tra IOS của bạn có hỗ trợ SSH không.

demi#sh ver
Cisco IOS Software, 2801 Software (C2801-ADVENTERPRISEK9-M), Version 12.3(14)T4, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Thu 08-Sep-05 17:00 by kehsiao

ROM: System Bootstrap, Version 12.3(8r)T9, RELEASE SOFTWARE (fc1)

demi uptime is 2 hours, 37 minutes
System returned to ROM by power-on
System image file is "flash:c2801-adventerprisek9-mz.123-14.T4.bin"

Sau đó cấu hình router demi hoạt động như ssh server. Vào chế độ config mode.

demi#conf t
Enter configuration commands, one per line. End with CNTL/Z.

demi(config)#ip domain-name vnpro.org
demi(config)#crypto key generate ?
rsa Generate RSA keys

demi(config)#crypto key generate rsa ?
general-keys Generate a general purpose RSA key pair for signing and
encryption
usage-keys Generate separate RSA key pairs for signing and encryption

demi(config)#crypto key generate rsa gnereneral
demi(config)#crypto key generate rsa general-keys ?
exportable Allow the key to be exported
label Provide a label
modulus Provide number of modulus bits on the command line

demi(config)#crypto key generate rsa general-keys modulus 1024
The name for the keys will be: demi.vnpro.org

% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys ...[OK]

demi(config)#
*Dec 10 0324.763: %SSH-5-ENABLED: SSH 1.99 has been enabled

Cấu hình cho phép các line vty chạy ssh

demi#conf t
Enter configuration commands, one per line. End with CNTL/Z.
demi(config)#line vty 0 4
demi(config-line)#login local
demi(config-line)#transport input ssh

Khai báo username và password cục bộ

demi#conf t
Enter configuration commands, one per line. End with CNTL/Z.
demi(config)#username cisco password cisco


Cài đặt chương trình Putty làm ssh client


Sau đó chạy chương trình Putty


Nhập vào username và password đã khai báo trên router


Sau đó bạn có thể vào enable mode để cấu hình router bình thường


Trên router lúc này dùng lệnh show ssh

demi#show ssh
Connection Version Mode Encryption Hmac State Username
0 2.0 IN aes256-cbc hmac-sha1 Session started vnpro
0 2.0 OUT aes256-cbc hmac-sha1 Session started vnpro
%No SSHv1 server connections running.
    Blogger Comment
    Facebook Comment