시스코 장비에 텔넷보다 안전한 SSH 구현하기(포트설정 포함)
Cisco R&S 2018. 9. 4. 15:14 |콘솔로 장비를 설정하고 통신이 가능한 상태가 되면 콘솔보단 원격에서 장비를 관리하게 된다.
원격으로 장비에 접근하려면 텔넷이나 SSH를 사용해야 하는데, 텔넷은 데이터를 암호화하지 않아 캡쳐될 경우 설정내역이 그대로 노출되게 된다.실습망과 같이 상용네트웍이 아니라면 텔넷을 사용해도 문제가 없지만 보안이 요구되는 네트워크의 경우 매우 치명적이다.
데이터를 암호화하여 전송하는 SSH를 적용하고, 포트번호도 기본값에서 바꿔주면 데이터의 유출과 무분별한 접근을 차단할 수 있다.
요구사항
k9(crypto)기능이 포함된 Cisco IOS image.
ex) c3750e-universalk9-tar.122-35.SE5.tar
1. 호스트네임 설정
1 2 | Router(config)#hostname keysco keysco(config)# |
2. 도메인네임 설정
1 2 | keysco(config)#ip domain-name keysco.com keysco(config)# |
3. RSA 키 생성 (시스코 권고안에 따라 1024비트 사용)
1 2 3 4 5 6 7 8 9 10 11 12 | keysco(config)#crypto key generate rsa The name for the keys will be: keysco.keysco.com Choose the size of the key modulus in the range of 360 to 2048 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] keysco(config)# *Mar 1 00:02:18.263: %SSH-5-ENABLED: SSH 1.99 has been enabled keysco(config)# |
4. 인증을 위한 계정 설정
1 2 | keysco(config)#username cisco secret cisco keysco(config)#enable secret cisco |
5. 계정 인증 및 SSH 접근 설정
1 2 3 4 | keysco(config)#line vty 0 4 keysco(config-line)#login local keysco(config-line)#transport input ssh keysco(config-line)# |
6. SSH 파라미터 설정 (v1보다 보안이 강력한 v2적용. v1+v2: no ip ssh version)
1 2 3 4 5 6 7 8 9 10 | keysco(config)#ip ssh version 2 keysco(config)#ip ssh time-out ? <1-120> SSH time-out interval (secs) keysco(config)#ip ssh time-out 30 keysco(config)#ip ssh authentication-retries ? <0-5> Number of authentication retries keysco(config)#ip ssh authentication-retries 3 keysco(config)# |
7. 포트 변경
1 2 3 4 5 6 7 | keysco(config)#ip ssh port 2222 rotary 1 keysco(config)#ip access-list extended sshBlock keysco(config-ext-nacl)#permit tcp any any eq 2222 keysco(config-ext-nacl)#exit keysco(config)#line vty 0 4 keysco(config-line)#rotary 1 keysco(config-line)#access-class sshBlock in |
8. 검증
1 2 3 4 5 6 7 8 9 10 11 12 | Xshell 5 (Build 1339) Copyright (c) 2002-2017 NetSarang Computer, Inc. All rights reserved. Type `help' to learn how to use Xshell prompt. [c:\~]$ ssh 1.0.0.150 22 Connecting to 1.0.0.150:22... Could not connect to '1.0.0.150' (port 22): Connection failed. Type `help' to learn how to use Xshell prompt. [c:\~]$ |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Xshell 5 (Build 1339) Copyright (c) 2002-2017 NetSarang Computer, Inc. All rights reserved. Type `help' to learn how to use Xshell prompt. [c:\~]$ ssh 1.0.0.150 2222 Connecting to 1.0.0.150:2222... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. keysco>en Password: keysco# |
1 2 3 4 5 6 7 8 9 | keysco#show ssh Connection Version Mode Encryption Hmac State Username 99 2.0 IN aes128-cbc hmac-sha1 Session started cisco 99 2.0 OUT aes128-cbc hmac-sha1 Session started cisco %No SSHv1 server connections running. keysco# keysco#show ip ssh SSH Enabled - version 2.0 Authentication timeout: 30 secs; Authentication retries: 3 |
'Cisco R&S' 카테고리의 다른 글
시스코 스위치 가상으로 구현하기 - IOU, GNS3 v2.1.11 (2) | 2018.10.21 |
---|---|
시스코 장비 기본설정 (0) | 2018.08.05 |
시스코 카탈리스트 스위치 가상으로 구현하기 - IOU, GNS3 v1.5.3 (0) | 2017.01.20 |
LACP & PAgP (0) | 2016.08.25 |
GLBP - Gateway Load Balancing Protocol (0) | 2016.08.20 |
VRRP - Virtual Router Redundancy Protocol (0) | 2016.08.16 |
HSRP - Multiple Group Configuration (0) | 2016.08.16 |
HSRP - Hot Standby Router Protocol (0) | 2016.08.16 |