bxm's IT Story
VPN 이중화 본문
공통]
conf t
no ip domain lookup
line c 0
logg sy
exec-timeout 0
exit
line vty 0 4
pass cisco
end
wr
HQ]
conf t
int lo0
no shut
ip add 10.1.1.1 255.255.255.0
exit
int f0/0
no shut
ip add 10.1.10.1 255.255.255.252
exit
int f0/1
no shut
ip add 10.1.10.5 255.255.255.252
end
wr
HQ_VPN1]
conf t
int f0/0
no shut
ip add 10.1.10.2 255.255.255.252
exit
int f0/1
no shut
ip add 1.1.123.1 255.255.255.248
end
wr
HQ_VPN2]
conf t
int f0/0
no shut
ip add 10.1.10.6 255.255.255.252
exit
int f0/1
no shut
ip add 1.1.123.2 255.255.255.248
end
wr
CE]
conf t
int f0/0
no shut
ip add 1.1.123.3 255.255.255.248
exit
int f0/1
no shut
ip add 1.1.100.1 255.255.255.252
end
wr
ISP]
conf t
int f0/0
no shut
ip add 1.1.100.2 255.255.255.252
exit
int f0/1
no shut
ip add 1.1.100.5 255.255.255.252
exit
int f1/0
no shut
ip add 1.1.100.9 255.255.255.252
end
wr
Branch1]
conf t
int f0/0
no shut
ip add 1.1.100.6 255.255.255.252
exit
int f0/1
no shut
ip add 10.2.2.2 255.255.255.0
end
wr
Branch2]
conf t
int f0/0
no shut
ip add 1.1.100.10 255.255.255.252
exit
int f0/1
no shut
ip add 10.3.3.3 255.255.255.0
end
wr
## Next-hop Ping Test ##
HQ]
ping 10.1.10.2
ping 10.1.10.6
HQ_VPN1]
ping 1.1.123.3
HQ_VPN2]
ping 1.1.123.3
CE]
ping 1.1.100.2
ISP]
ping 1.1.100.6
ping 1.1.100.10
## OSPF ##
HQ]
conf t
router ospf 1
router-id 1.1.1.1
network 10.1.1.1 0.0.0.0 area 0
network 10.1.10.1 0.0.0.0 area 0
network 10.1.10.5 0.0.0.0 area 0
end
wr
HQ_VPN1]
conf t
router ospf 1
router-id 2.2.2.2
network 10.1.10.2 0.0.0.0 area 0
exit
ip route 0.0.0.0 0.0.0.0 f0/1 1.1.123.3
end
wr
HQ_VPN2]
conf t
router ospf 1
router-id 3.3.3.3
network 10.1.10.6 0.0.0.0 area 0
exit
ip route 0.0.0.0 0.0.0.0 f0/1 1.1.123.3
end
wr
CE]
conf t
ip route 0.0.0.0 0.0.0.0 f0/1 1.1.100.2
end
wr
ISP] - ISP에서는 1.1.123.X 대역을 모름.
conf t
ip route 1.1.123.0 255.255.255.248 f0/0 1.1.100.1
end
wr
Branch1]
conf t
ip route 0.0.0.0 0.0.0.0 f0/0 1.1.100.5
end
wr
Branch2]
conf t
ip route 0.0.0.0 0.0.0.0 f0/0 1.1.100.9
end
wr
## Direct Encapsulation IPSec Failover ##
- Direct Encapsulation IPSec VPN의 경우, Dynamic Routing Protocol이 지원되지 않기 때문에 이중화 구성이 조금 복잡.
HSRP와 RRI(Reverse Route Injection)를 사용하여 별도의 이중화 구성을 해야한다.
만약 Dynamic Routing Protocol이 지원되는 경우에는, 관리자가 별도로 이중화를 고려하지 않아도 자동으로 이중화
구성이 가능하다.
→ GRE(앞으로 배울 것임) over IPSec // DMVPN 등은 Dynamic Routing Protocol을 지원한다.
1) HSRP Configuration
- <HQ_VPN1>과 <HQ_VPN2> 장비 사이에 Virtual Rout (1.1.123.4)를 설정하시오.
Active : <HQ_VPN1> // Standby : <HQ_VPN2>
HQ_VPN1]
conf t
int f0/1
standby 10 ip 1.1.123.4 ## Virtual IP를 1.1.123.4로 잡음.
standby 10 priority 110
standby 10 track f0/0 50
standby 10 preempt delay minimum 30
standby 10 authentication md5 key-string cisco123 ## HSRP를 암호화해서 주고받자!
standby 10 name VPN_Failover ## HSRP 이중화 이름을 정할 수 있음!!
end
wr
HQ_VPN2]
conf t
int f0/1
standby 10 ip 1.1.123.4
standby 10 preempt ## preempt만 주면 된다.
standby 10 authentication md5 key-string cisco123
standby 10 name VPN_Failover
end
wr
## 장비가 원할하게 돌아가는지 확인한 후에 VPN 설정 하기 ##
HQ]
show ip ospf nei
HQ_VPN1]
ping 1.1.123.3 (아까 Ping test 했지만 또 ㅎㅎ..)
ping 1.1.100.2
HQ_VPN2]
ping 1.1.123.3
ping 1.1.100.2
## HQ에서 바깥으로는 현재 재분배를 해주지 않았기 때문에 통신이 되지 않는다!!
## 인증 방식 : Pre-share // 암호화 : aes // 무결성 검사 : sha // group number : 2 // Lifetime : 7200
2) IPSec VPN 설정
HQ_VPN1]
crypto isakmp policy 1
authentication pre-share
encryption aes
hash sha
group 2
lifetime 7200
exit
crypto isakmp key cisco123 address 1.1.100.6
crypto isakmp key cisco123 address 1.1.100.10
crypto isakmp keepalive 10
## Set a keepalive interval for use with IOS peers (Neighbor Membership이 유효한 시간이 10초이다.)
## DPD(Dead Peer Detection라고 함) 설정.
반대편 VPN Peer 장비의 장애 여부를 빠르게 확인할 수 있다. 10초 간격으로 keepalive 메시지를 전송하고,
3번 연속 응답을 수신하지 못하는 경우 VPN 연결을 끊는다. (반드시 양쪽 장비 모두 설정해야 한다.)
## 이제 무결성 검증을 해야한다.
crypto ipsec transform-set IPSEC_SA esp-aes esp-sha-hmac
mode tunnel
exit
## HQ_VPN1과 Branch2 두 곳에서 오는 경우가 있음.
ip access-list extended HQ->Branch1
permit ip 10.1.0.0 0.0.255.255 10.2.2.0 0.0.0.255
permit ip 10.3.3.0 0.0.0.255 10.2.2.0 0.0.0.255
exit
ip access-list extended HQ->Branch2
permit ip 10.1.0.0 0.0.255.255 10.3.3.0 0.0.0.255
permit ip 10.2.2.0 0.0.0.255 10.3.3.0 0.0.0.255
exit
## Crypto map을 만든 이후에 적용해야함.
crypto map VPN_T 1 ipsec-isakmp
match address HQ->Branch1
set transform-set IPSEC_SA
set peer 1.1.100.6
reverse-route
exit
crypto map VPN_T 2 ipsec-isakmp
match address HQ->Branch2
set transform-set IPSEC_SA
set peer 1.1.100.10
reverse-route
exit
## [Reverse-route] 명령어는 'RRI(Reverse Route Injection)' 기능을 활성화시킨다. 위와 같이 RRI가 설정된
상대방 VPN 장비와 VPN Session이 수립될 경우, 'Crypto map' 정보를 기반으로 상대방 내부 네트워크로
향하는 Static Route를 Routing Table에 등록하게 된다. (VPN Session이 연결된 상태에서만 동작한다.)
ex) Branch1 입장에서는 OSPF 1 안의 것들을 모르는데, Session에 등록되면 10.1.10 Network가 등록된다!!
## OSPF 재분배 해주기.
router ospf 1
redistribute static subnets ## Static Route를 재분배
default-information originate metric-type 1 ## E1으로 Default를 뿌리겠다는 뜻. E1은 변동 Cost // 2는 E2임.
exit
int f0/1
crypto map VPN_T redundancy VPN_Failover
end
wr
## 이전까지 했던 <HQ_VPN1> 과 똑같이 해주면 된다!!
HQ_VPN2]
conf t
crypto isakmp policy 1
authen pre-share
enc aes
hash sha
group 2
lifetime 7200
exit
crypto isakmp key cisco123 address 1.1.100.6
crypto isakmp key cisco123 address 1.1.100.10
crypto isakmp keepalive 10
crypto ipsec transform-set IPSEC_SA esp-aes esp-sha-hmac
ip access-list extended HQ->Branch1
permit ip 10.1.0.0 0.0.255.255 10.2.2.0 0.0.0.255
permit ip 10.3.3.0 0.0.0.255 10.2.2.0 0.0.0.255
exit
ip access-list extended HQ->Branch2
permit ip 10.1.0.0 0.0.255.255 10.3.3.0 0.0.0.255
permit ip 10.2.2.0 0.0.0.255 10.3.3.0 0.0.0.255
exit
crypto map VPN_T 1 ipsec-isakmp
match address HQ->Branch1
set transform-set IPSEC_SA
set peer 1.1.100.6
reverse-route
exit
crypto map VPN_T 2 ipsec-isakmp
match address HQ->Branch2
set transform-set IPSEC_SA
set peer 1.1.100.10
reverse-route
exit
router ospf 1
redistribute static subnet
default-information originate always metric-type 2 ## always까지만 쓰면 metric 기본값은 2임.
exit
int f0/1
crypto map VPN_T redundancy VPN_Failover
end
wr


나 머 지 는 내 일 이 어 서 . . .
Branch1]
conf t
crypto isakmp policy 1
authen pre-share
encryption aes
hash sha
group 2
lifetime 7200
exit
crypto isakmp key cisco123 address 1.1.123.4
crypto isakmp keepalive 10
crypto ipsec transform-set IPSEC_SA esp-aes esp-sha-hmac
ip access-list extended Branch1->HQ
permit ip 10.2.2.0 0.0.0.255 10.1.0.0 0.0.255.255 ## HQ
permit ip 10.2.2.0 0.0.0.255 10.3.3.0 0.0.0.255 ## Branch2로도 가야함
exit
crypto map VPN_T 1 ipsec-isakmp
match address Branch1->HQ
set transform-set IPSEC_SA
set peer 1.1.123.4 ## HSRP가 돌아가고 있으니까 peer는 가상 IP임!!
exit
int f0/0
crypto map VPN_T
end
wr
Branch2]
conf t
crypto isakmp policy 1
authen pre-share ## 인증방식 pre-share
encryption aes ## 암호화 방식 aes
hash sha ## 무결성 검증 sha
group 2
lifetime 7200
exit
crypto isakmp key cisco123 address 1.1.123.4
crypto isakmp keepalive 10
crypto ipsec transform-set IPSEC_SA esp-aes esp-sha-hmac
## access-list 만들기
ip access-list extended Branch2->HQ
permit ip 10.3.3.0 0.0.0.255 10.1.0.0 0.0.255.255
permit ip 10.3.3.0 0.0.0.255 10.2.2.0 0.0.0.255
exit
crypto map VPN_T 1 ipsec-isakmp
match address Branch2->HQ
set transform-set IPSEC_SA
set peer 1.1.123.4
exit
int f0/0
crypto map VPN_T
end
wr
## Peer 맺기 전에 Routing Table 확인 및 Peer가 맺어졌나 확인 ##
HQ_VPN1]
show crypto isakmp sa
HQ]
show ip route
Branch1, 2]
## source Ping 날리기
ping 10.1.1.1 source f0/1
HQ_VPN1]
## Session을 맺어주면 임시 Routing Table이 만들어짐
show ip route
Branch1]
show crypto isakmp sa
Branch2]
show crypto isakmp sa
HQ]
show ip route
## 이제 HQ에서 HQ_VPN1을 경유하여 Branch1로 가는지 확인해보자!!
HQ]
ping 10.2.2.2 source lo0
ping 10.3.3.3 source lo0
HQ_VPN1]
show crypto isakmp sa
conf t
int f0/1
shut
end
HQ]
ping 10.2.2.2 source lo0
끝 났 음.


## 모두 저장 후, 종료한 뒤에 재시작 <방금까지의 상황 동작원리!!> ##
- VPN Session이 맺어지기 전 비어있는 이사캠프 테이블 확인.
HQ_VPN1]
show crypto isakmp
HQ] // Active 장비쪽으로 향해 있는 OSPF 경로
show ip route
## O*E1 0.0.0.0/0 [110/2] via 10.1.10.2, FastEthernet 0/0 으로 나타날 것임.
ping 10.2.2.2
Branch1]
ping 10.1.1.1 source f0/1
- VPN Session이 맺어지자 'RRI(Reverse Route Injection)'에 의해 'Crypto map' 정보를 기반으로 상대방 내부
네트워크로 향하는 Static Route가 Routing Table에 등록되었다.
HQ_VPN1]
show ip route
## S 10.2.2.0/24 [1/0] via 1.1.100.6
show crypto isakmp sa
##
dst src state conn-id
1.1.123.4 1.1.100.6 QM_IDLE 1001
##
- HQ_VPN1에서 RRI에 의해 생성된 'Static Route'가 OSPF로 재분배되어 HQ로 넘어가 있다.
HQ]
show ip route
## O E2 10.2.2.0/24 [110/20] via 10.1.10.2, f0/0
- 이제 HQ에서 Branch2로 통신을 시도해본다.
HQ]
ping 10.3.3.3
- HQ_VPN2에서 RRI에 의해 생성된 'Static Route'가 OSPF로 재분배되어 HQ로 넘어가 있다.
HQ]
show ip route
## O E2 10.3.3.0/24 [110/20] via 10.1.10.2, f0/0
- 이제 Branch2까지 등록되어 있다.
HQ_VPN1]
show crypto isakmp sa
##
dst src state conn-id
1.1.123.4 1.1.100.6 QM_IDLE 1001
1.1.100.10 1.1.100.6 QM_IDLE 1002
##
- 이중화가 되었는지 확인해보자.
HQ_VPN1]
conf t
int f0/1
shut
## *MAR 1 00:30:29:283: %HSRP-5 ACTIVE->INIT 어쩌구..
## 여기서 중요한 것은, 트래킹 대상을 끊지 않았음에도 Hello가 오가지 않으므로, Active->Standby로 돌아선다.
Branch1]
ping 10.1.1.1
!!!!! 성공
HQ]
show ip route
## O* E2 0.0.0.0/0 [110/1] via 10.1.10.6, FastEthernet0/0
동작원리 끝. 이중화는 여기까지.


'Network > VPN (KEDU)' 카테고리의 다른 글
Easy_VPN (Final Version-Split tunnel) (0) | 2021.08.20 |
---|---|
VPN (DMVPN_Dynamic Multipoint VPN) - 기본, Crypto profile, 이중화 (1) | 2021.08.20 |
VPN (GRE over IPSec) (2) | 2021.08.19 |
VPN (Virtual Private Network, 가상 사설망) - Static VPN, Dynamic VPN (0) | 2021.08.18 |