인터넷을 사용하여 본사와 지사들 사이의 네트워크를 구축할 수있다.
인터넷은 사설 ip주소를 라우팅 시키지 못함
내부ip (사설iP) 10.0.1.0/24를
공인ip 58.149.232.82 로 변환시키는 과정 -> NAT
이 과정을 NAT대신 VPN으로
ex)10.0.4.0/24 의 내부 ip를 연결시킴
10.0.3.0/24
라우팅이 불가능한 패킷(내부ip)를 외부ip로 캡슐화 시켜서(내부에 넣어서) 전송하는 방식
GRE 헤더(외부ip) - 내부 ip(출발지,목적지) - 데이터
4바이트 길이 : GRE 헤더
GRE 터널
R1: Tunnel 12 - Tunnel 12 : R2
R1: Tunnel 13 - Tunnel 13 : R2
Tunnel 생성
내부 네트워크의 라우팅 : ospf
IPsec VPN
GRE VPN 보안 기능 없다. (IPsec + GRE)
VPN
암호화(DES,3DES,AES),인증(RSA,Pre-shared),무결성(MD5,SHA) 확인
DES, Pre-shared, SHA
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

UDP 터널을 생성 및 연결
R1
ip route 1.1.24.0 255.255.255.0 1.1.14.4
ip route 1.1.34.0 255.255.255.0 1.1.14.4
R2
ip route 1.1.14.0 255.255.255.0 1.1.24.4
R3
ip route 1.1.14.0 255.255.255.0 1.1.34.4
R2와 R3이 간 연결 설정 x
R1
interface Tunnel12
ip address 10.1.12.1 255.255.255.0
tunnel source GigabitEthernet0/0
tunnel destination 1.1.24.2 #목적지는 인터페이스 설정이 애매하므로 ip 입력
router ospf 1
net 10.1.12.0 0.0.0.255 area 0 #터널의 ip대역
net 192.168.10.0 0.0.0.255 area 0 #연결할 ip 대역
R2
interface Tunnel12
ip address 10.1.12.2 255.255.255.0
tunnel source GigabitEthernet2/0
tunnel destination 1.1.14.1
router ospf 1
net 10.1.12.0 0.0.0.255 area 0
net 192.168.20.0 0.0.0.255 area 0
PC1에서 PC3로 핑테스트
R1
interface Tunnel13
ip address 10.1.13.1 255.255.255.0
tunnel source GigabitEthernet0/0
tunnel destination 1.1.34.3
router ospf 1
network 10.1.13.0 0.0.0.255 area 0
R3
interface Tunnel13
ip address 10.1.13.2 255.255.255.0
tunnel source GigabitEthernet3/0
tunnel destination 1.1.14.1
router ospf 1
network 10.1.13.0 0.0.0.255 area 0
network 192.168.30.0 0.0.0.255 area 0
PC1에서 PC5로 핑테스트
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

위 설정이 다 되어있어야함
PC5 -> PC3 핑테스트가 가능해야 적용 가능
R1
crypto isakmp policy 10
encr aes
authentication pre-share
crypto isakmp key cisco address 1.1.24.2
crypto isakmp key cisco address 1.1.34.3
R2
crypto isakmp policy 10
encr aes
authentication pre-share
crypto isakmp key cisco address 1.1.14.1
R3
crypto isakmp policy 10
encr aes
authentication pre-share
crypto isakmp key cisco address 1.1.14.1
R1
crypto ipsec transform-set PHASE2 esp-aes esp-md5-hmac
R2
crypto ipsec transform-set PHASE2 esp-aes esp-md5-hmac
R3
crypto ipsec transform-set PHASE2 esp-aes esp-md5-hmac
R1에서 확인
sh crypto ipsec transform-set
R1
ip access-list extended R2
permit gre host 1.1.14.1 host 1.1.24.2
ip access-list extended R3
permit gre host 1.1.14.1 host 1.1.34.3
#보호대상 트래픽 지정
crypto map VPN 10 ipsec-isakmp
set peer 1.1.24.2
set transform-set PHASE2
match address R2
crypto map VPN 20 ipsec-isakmp
set peer 1.1.34.3
set transform-set PHASE2
match address R3
int g0/0 #설정할 포트 지정
crypto map VPN
R2
ip access-list extended R1
permit gre host 1.1.24.2 host 1.1.14.1
crypto map VPN 10 ipsec-isakmp
set peer 1.1.14.1
set transform-set PHASE2
match address R1
int g2/0
crypto map VPN
R3
ip access-list extended R1
permit gre host 1.1.34.3 host 1.1.14.1
crypto map VPN 10 ipsec-isakmp
set peer 1.1.14.1
set transform-set PHASE2
match address R1
int g3/0
crypto map VPN
R1
show crypto isakmp peers
sh crypto isakmp sa
1단계 터널 확인
show crypto ipsec sa
2단계 터널 확인
sh crypto session detail
sh crypto engine connections active
크립토 접속 확인
PC1 -> PC3 핑테스트
ESP는 Encapsulating Security Payload를 의미
캡슐화 하여 IPsec이 적용되고 있음을 보여줌