콘솔로 장비를 설정하고 통신이 가능한 상태가 되면 콘솔보단 원격에서 장비를 관리하게 된다.
원격으로 장비에 접근하려면 텔넷이나 SSH를 사용해야 하는데, 텔넷은 데이터를 암호화하지 않아 캡쳐될 경우 설정내역이 그대로 노출되게 된다.
실습망과 같이 상용네트웍이 아니라면 텔넷을 사용해도 문제가 없지만 보안이 요구되는 네트워크의 경우 매우 치명적이다.
데이터를 암호화하여 전송하는 SSH를 적용하고, 포트번호도 기본값에서 바꿔주면 데이터의 유출과 무분별한 접근을 차단할 수 있다.

요구사항
k9(crypto)기능이 포함된 Cisco IOS image.
ex) c3750e-universalk9-tar.122-35.SE5.tar

1. 호스트네임 설정
Router(config)#hostname keysco
keysco(config)#

2. 도메인네임 설정
keysco(config)#ip domain-name keysco.com
keysco(config)#

3. RSA 키 생성 (시스코 권고안에 따라 1024비트 사용)
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. 인증을 위한 계정 설정
keysco(config)#username cisco secret cisco
keysco(config)#enable secret cisco

5. 계정 인증 및 SSH 접근 설정
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)
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. 포트 변경
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. 검증
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:\~]$ 
SSH 기본포트인 22번이 차단되었다.

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# 
새로 지정한 포트인 2222로 SSH연결이 성립되었다.

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
라우터에서 확인


Posted by 비형랑#
:



Router(config)#hostname R1
R1(config)#
▲ 호스트 네임 설정은 기본중의 기본


R1(config)#no ip domain-lookup
▲ 프리빌리지 모드에서 명령을 잘못 입력하면 도메인 찾는다고 쿼리를 날리는데 시간을 꽤나 잡아먹습니다..


R1(config)#no cdp run
▲ 인접한 시스코장비를 찾아내는 프로토콜인데 보안에 굉장히 취약하므로 비활성화합니다.


R1(config)#vtp mode transparent
▲ VTP는 거의 사용하지 않으니 데이터를 교환하지 않는 transparent모드로 설정합니다.


R1(config)#line aux 0
R1(config-line)#no password
R1(config-line)#login
▲ 사용하지 않는 AUX라인은 사전에 접속을 차단합니다.


R1(config)#enable secret [password]
R1(config)#username [username] secret [password]

R1(config)#line con 0
R1(config-line)#login local

R1(config)#line vty 0 4
R1(config-line)#login local
R1(config-line)#transport input [all | ssh | telnet | none] 
▲ 관리자 계정 만들고 설정모드 암호를 만들고 암호화시킵니다. 원격접속시 텔넷을 쓸지 SSH를 쓸지 지정합니다.
보다 세부적인 SSH설정을 하고 싶다면

2016/11/27 - 시스코 장비 SSHv2 설정하기 - 임의 포트 부여



Posted by 비형랑#
:

VRRP - Virtual Router Redundancy Protocol

HSRP는 시스코 고유의 프로토콜이나, VRRP는 IETF 표준 RFC 2338로 정의된 표준 프로토콜이다.

HSRP와 설정방법이 거의 유사하지만 약간의 차이가 있다.


2016/08/16 - HSRP - Hot Standby Router Protocol - HSRP는 여기 참고

1. 액티브라우터가 아닌 마스터라우터이다.

2. HSRP Priority는 0-255, VRRP Priority는 1-254

3. 마스터라우터의 MAC은 0000.5e00.01XX, XX는 그룹번호

4. VRRP Advertisement는 1초마다

5. 인터페이스 트래킹을 별도의 트랙으로 설정해두어야 함. - 세부설정 가능!



위의 토플로지의 R1과 R2의 이더넷인터페이스에 VRRP를 적용하여 가상의 라우터를 만들되 R1이 마스터라우터가 되도록 설정한다.

또한 R1의 시리얼링크에 문제가 생길경우 R2가 마스터라우터가 되도록 한다.

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

R1설정

track 1 interface Serial2/0 line-protocol  "line-protocol"대신 "ip routing"으로 입력하면 L3감지
       
interface FastEthernet0/0
 ip address 192.168.10.252 255.255.255.0
 vrrp 10 ip 192.168.10.254
 vrrp 10 priority 110
 vrrp 10 track 1 decrement 100


R2설정

interface FastEthernet0/0
 ip address 192.168.10.253 255.255.255.0
 duplex auto
 speed auto
 vrrp 10 ip 192.168.10.254
 vrrp 10 priority 50


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

설정결과확인

R1#show vrrp
FastEthernet0/0 - Group 10
  State is Master 
  Virtual IP address is 192.168.10.254
  Virtual MAC address is 0000.5e00.010a
  Advertisement interval is 1.000 sec
  Preemption enabled
  Priority is 110
    Track object 1 state Up decrement 100
  Master Router is 192.168.10.252 (local), priority is 110
  Master Advertisement interval is 1.000 sec
  Master Down interval is 3.570 sec


R2#show vrrp
FastEthernet0/0 - Group 10
  State is Backup 
  Virtual IP address is 192.168.10.254
  Virtual MAC address is 0000.5e00.010a
  Advertisement interval is 1.000 sec
  Preemption enabled
  Priority is 50 
  Master Router is 192.168.10.252, priority is 110
  Master Advertisement interval is 1.000 sec
  Master Down interval is 3.804 sec (expires in 2.960 sec)

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

CASE1# R1의 F0를 shutdown

R1#show vrrp
FastEthernet0/0 - Group 10
  State is Init   
  Virtual IP address is 192.168.10.254
  Virtual MAC address is 0000.5e00.010a
  Advertisement interval is 1.000 sec
  Preemption enabled
  Priority is 110
    Track object 1 state Up decrement 100
  Master Router is unknown, priority is unknown
  Master Advertisement interval is unknown
  Master Down interval is unknown


R2#show vrrp
FastEthernet0/0 - Group 10
  State is Master 
  Virtual IP address is 192.168.10.254
  Virtual MAC address is 0000.5e00.010a
  Advertisement interval is 1.000 sec
  Preemption enabled
  Priority is 50 
  Master Router is 192.168.10.253 (local), priority is 50 
  Master Advertisement interval is 1.000 sec
  Master Down interval is 3.804 sec

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

CASE2# R3의 S0을 shutdown

R1#show vrrp
FastEthernet0/0 - Group 10
  State is Backup 
  Virtual IP address is 192.168.10.254
  Virtual MAC address is 0000.5e00.010a
  Advertisement interval is 1.000 sec
  Preemption enabled
  Priority is 10  (cfgd 110)
    Track object 1 state Down decrement 100
  Master Router is 192.168.10.253, priority is 50 
  Master Advertisement interval is 1.000 sec
  Master Down interval is 3.570 sec (expires in 3.090 sec)


R2#show vrrp
FastEthernet0/0 - Group 10
  State is Master 
  Virtual IP address is 192.168.10.254
  Virtual MAC address is 0000.5e00.010a
  Advertisement interval is 1.000 sec
  Preemption enabled
  Priority is 50 
  Master Router is 192.168.10.253 (local), priority is 50 
  Master Advertisement interval is 1.000 sec
  Master Down interval is 3.804 sec

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

다중 VRRP설정은 HSRP와 동일하므로 생략~

2016/08/16 - HSRP - Multiple Group Configuration


Reference.

http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipapp_fhrp/configuration/12-4/fhp-12-4-book/fhp-vrrp.html#GUID-A6F936CD-71DF-4407-A943-3BD35389049A

https://www.ietf.org/rfc/rfc2338.txt

https://tools.ietf.org/html/rfc5798 - VRRPv3

Posted by 비형랑#
:

2016/08/16 - HSRP - Hot Standby Router Protocol


이전글에서 제시한 HSRP에는 트래픽이 한곳으로만 집중된다는 문제점이 있다.

게이트웨이를 이중화하여 두개의 경로를 모두 사용하는것이 아니라,

하나의 경로를 사용하되, 장애에 대비한 백업경로를 두는 개념이기 때문이다.

이러한 문제점은 네트워크별로 여러개의 HSRP를 설정하여 액티브라우터를 분산시키면 해결된다.

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


위의 토플로지에서 PC1은 VLAN10에 연결되어있고, PC2는 VLAN20에 연결되어 있다.

VLAN10의 액티브라우터는 R1, VLAN20의 액티브라우터는 R2가 되도록 HSRP를 설정한다.


R1설정

interface FastEthernet0/0.10
 encapsulation dot1Q 10
 ip address 192.168.10.252 255.255.255.0
 standby 10 ip 192.168.10.254
 standby 10 priority 110
 standby 10 preempt
 standby 10 track Serial2/0 100
!
interface FastEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.20.252 255.255.255.0
 standby 20 ip 192.168.20.254
 standby 20 priority 50


R2설정

interface FastEthernet0/0.10
 encapsulation dot1Q 10
 ip address 192.168.10.253 255.255.255.0
 standby 10 ip 192.168.10.254
 standby 10 priority 50
!
interface FastEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.20.253 255.255.255.0
 standby 20 ip 192.168.20.254
 standby 20 priority 110
 standby 20 preempt
 standby 20 track Serial2/0 100

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

설정결과확인

R1#show stan
FastEthernet0/0.10 - Group 10
  State is Active
    2 state changes, last state change 02:04:49
  Virtual IP address is 192.168.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.368 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.10.253, priority 50 (expires in 9.368 sec)
  Priority 110 (configured 110)
    Track interface Serial2/0 state Up decrement 100
  IP redundancy name is "hsrp-Fa0/0.10-10" (default)
FastEthernet0/0.20 - Group 20
  State is Standby
    4 state changes, last state change 02:00:42
  Virtual IP address is 192.168.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.356 secs
  Preemption disabled
  Active router is 192.168.20.253, priority 110 (expires in 7.468 sec)
  Standby router is local
  Priority 50 (configured 50)
  IP redundancy name is "hsrp-Fa0/0.20-20" (default)


R2#show stan
FastEthernet0/0.10 - Group 10
  State is Standby
    4 state changes, last state change 02:03:48
  Virtual IP address is 192.168.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.808 secs
  Preemption disabled
  Active router is 192.168.10.252, priority 110 (expires in 8.864 sec)
  Standby router is local
  Priority 50 (configured 50)
  IP redundancy name is "hsrp-Fa0/0.10-10" (default)
FastEthernet0/0.20 - Group 20
  State is Active
    1 state change, last state change 02:02:39
  Virtual IP address is 192.168.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.808 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.20.252, priority 50 (expires in 7.500 sec)
  Priority 110 (configured 110)
    Track interface Serial2/0 state Up decrement 100
  IP redundancy name is "hsrp-Fa0/0.20-20" (default)


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


PC1은 R3로 가기위해 R1을 경유하나, R1이나 R1의 시리얼링크에 문제가 생긴경우 R2를 경유한다.

PC2는 R3로 가기위해 R2를 경유하나, R2나 R2의 시리얼링크에 문제가 생긴경우 R1을 경유한다.

Posted by 비형랑#
:

HSRP - Hot Standby Router Protocol

PC나 서버등의 호스트에는 게이트웨이를 하나만 지정할 수 있다.

(꼭 그런건 아니지만)

그래서 라우터를 여러대 놓아도 하나의 라우터만을 통해 바깥망으로 나가게 된다.

이에 대한 솔루션으로 여러대의 라우터에 가상의 단일주소를 부여하여

게이트웨이의 가용성을 높일 수 있다.

HSRP는 v1, v2가 있으며 Cisco 고유 프로토콜이다.

버전이 다를경우 동작하지 않으며, 그룹별로 다른 버전을 사용할 수 있다.


 

 목적지 주소

그룹번호

액티브라우터 MAC

 version 1

 224.0.0.2


CGMP와 동일주소, HSRP동시사용 불가

 0-255

 0000.0c07.acXX


XX는 그룹번호

 version 2

 224.0.0.102


중복주소 없음

 0-4095

 0000.0c9f.fXXX


XXX는 그룹번호



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


위의 토플로지에서 PC1은 R3로 가기위해 R1을 거칠수도 있고 R2를 거칠수도 있다.

평상시에는 R1을 거쳐가다가, R1이 죽거나 R1의 시리얼링크에 문제가 생길경우 R2를 거쳐가도록 하는 가상라우터 주소를 설정한다.


R1 설정

interface FastEthernet0

ip address 192.168.10.252 255.255.255.0

standby 1 ip 192.168.10.254  그룹번호:1, 가상라우터:192.168.10.254, 이 명령으로 HSRP동작 시작

standby 1 priority 110  (디폴트인 100보다 높은 값)

standby 1 preempt  (프리엠프트 - R1이 죽었다 살았을때 다시 액티브라우터가 되도록)

standby 1 track Serial0 decrement 100  (시리얼이 죽으면 Priority를 100감소, 110-100=10이 된다)


R2 설정

interface FastEthernet0

ip address 192.168.10.253 255.255.255.0

standby 1 ip 192.168.10.254

standby 1 priority 50


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


설정결과 확인


R1#show standby

FastEthernet0 - Group 1

State is Active

6 state changes, last state change 00:00:12

Virtual IP address is 192.168.10.254

Active virtual MAC address is 0000.0c07.ac01

Local virtual MAC address is 0000.0c07.ac01 (v1 default)

Hello time 3 sec, hold time 10 sec

Next hello sent in 2.056 secs

Preemption enabled

Active router is local

Standby router is 192.168.10.253, priority 10 (expires in 7.280 sec)

Priority 110 (configured 110)

Track interface Serial0 state Up decrement 100

IP redundancy name is "hsrp-Fa0-1" (default)


R2#show stand

FastEthernet0 - Group 1

State is Standby

4 state changes, last state change 00:11:30

Virtual IP address is 192.168.10.254

Active virtual MAC address is 0000.0c07.ac01

Local virtual MAC address is 0000.0c07.ac01 (v1 default)

Hello time 3 sec, hold time 10 sec

Next hello sent in 2.060 secs

Preemption disabled

Active router is 192.168.10.252, priority 110 (expires in 7.224 sec)

Standby router is local

Priority 50 (configured 50)

IP redundancy name is "hsrp-Fa0-1" (default)


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


CASE1# R1의 F0를 shutdown


R1#show stand

FastEthernet0 - Group 1

State is Init (interface down)

5 state changes, last state change 00:00:07

Virtual IP address is 192.168.10.254

Active virtual MAC address is unknown

Local virtual MAC address is 0000.0c07.ac01 (v1 default)

Hello time 3 sec, hold time 10 sec

Preemption enabled

Active router is unknown

Standby router is unknown

Priority 110 (configured 110)

Track interface Serial0 state Up decrement 100

IP redundancy name is "hsrp-Fa0-1" (default)


R2#show stand

FastEthernet0 - Group 1

State is Active

5 state changes, last state change 00:00:51

Virtual IP address is 192.168.10.254

Active virtual MAC address is 0000.0c07.ac01

Local virtual MAC address is 0000.0c07.ac01 (v1 default)

Hello time 3 sec, hold time 10 sec

Next hello sent in 2.848 secs

Preemption disabled

Active router is local

Standby router is unknown

Priority 50 (configured 50)

IP redundancy name is "hsrp-Fa0-1" (default)


CASE2# R3의 S0을 shutdown


R1#show stand

FastEthernet0 - Group 1

State is Active

4 state changes, last state change 00:13:29

Virtual IP address is 192.168.10.254

Active virtual MAC address is 0000.0c07.ac01

Local virtual MAC address is 0000.0c07.ac01 (v1 default)

Hello time 3 sec, hold time 10 sec

Next hello sent in 0.952 secs

Preemption enabled

Active router is local

Standby router is 192.168.10.253, priority 10 (expires in 7.792 sec)

Priority 10

Track interface Serial0 state Down decrement 100

IP redundancy name is "hsrp-Fa0-1" (default)


R2#show stand

FastEthernet0 - Group 1

State is Standby

4 state changes, last state change 00:14:26

Virtual IP address is 192.168.10.254

Active virtual MAC address is 0000.0c07.ac01

Local virtual MAC address is 0000.0c07.ac01 (v1 default)

Hello time 3 sec, hold time 10 sec

Next hello sent in 0.724 secs

Preemption disabled

Active router is 192.168.10.252, priority 5 (expires in 7.192 sec)

Standby router is local

Priority 50 (configured 50)

IP redundancy name is "hsrp-Fa0-1" (default)


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

R1: 액티브라우터

R2: 스탠바이라우터


R1의 이더넷이 죽으면 R2가 액티브라우터가 된다

(192.168.10.254의 패킷을 R2가 처리한다)


R1의 시리얼이 죽으면 R2가 액티브라우터가 되진 않지만,

R1의 Priority가 110-100=10으로 낮아짐에 따라

R2의 Priority가 더 높아진다

(192.168.10.254의 패킷을 R2가 처리한다)


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

Reference


http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3560/software/release/12-2_52_se/configuration/guide/3560scg/swhsrp.html


https://www.ietf.org/rfc/rfc2281.txt


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


HSRP 커맨드 입력시 순서가 매우 중요하다. priority 설정후 preempt를 적용하면 priority 설정이 날아가버리기 때문이다.


액티브라우터를 설정할경우 preempt, priority, ip 순으로 설정해야 한다.

'Cisco R&S' 카테고리의 다른 글

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
VPN(PPTP) Server Configuration  (0) 2015.12.25
CCNA Labsim 공부할 수 있는 곳  (0) 2015.04.27
ip default-network  (0) 2015.04.16
Port-security  (0) 2015.04.15
Posted by 비형랑#
: