Lab cấu hình VPN site to site sử dụng IP Sec bằng CLI

1. Mô hình:


2. Yêu cầu:
Thực hiện IPSec- VPN giữa hai chi nhánh (hai site) đảm bảo hai site phải giao tiếp được với nhau qua IPSec Tunnel.

3. Các bước cấu hình:
- Cấu hình chính sách ISAKMP/IKE phase 1
- Cấu hình IPSec Transform-set( ISAKMP/IKE phase 2)
- Tạo Access control list ACL
- Cấu hình crypto map
- Đưa crypto map lên interface
4. Triển khai chi tiết:

Bước 1: Cấu hình cơ bản trên từng Router:
-Router ISP: chỉ cấu hình hostname và IP của các interface như mô hình trên
R2(config)#hostname ISP
ISP(config)#interface s1/1
ISP(config-if)#ip address 150.1.1.2 255.255.255.0
ISP(config-if)#no shutdown
ISP(config)#interface s1/2
ISP(config-if)#ip address 151.1.1.2 255.255.255.0
ISP(config-if)#no shutdown

-Router SG và VT, cấu hình hostname và ip theo mô hình, sau đó cấu hình default route. 
R1(config)#hostname SG
SG(config)#interface s1/0
SG(config-if)#ip address 150.1.1.1 255.255.255.0
SG(config-if)#no shutdown
SG(config)#interface fa0/0
SG(config-if)#ip address 192.168.1.1 255.255.255.0
SG(config)#ip route 0.0.0.0 0.0.0.0 150.1.1.2

R3(config)#hostname VT
VT(config)#interface s1/3
VT(config-if)#ip address 151.1.1.1 255.255.255.0
VT(config-if)#no shutdown
VT(config)#interface fa0/1
VT(config-if)#ip address 192.168.2.1 255.255.255.0
VT(config)#ip route 0.0.0.0 0.0.0.0 151.1.1.2

Bước 2: Cấu hình ISAKMP/IKE phase 1
Ở bước này ta quy định các thông số bảo mật của ISAKMP SA gồm:
- Phương pháp chứng thực
- Thuật toán hash
- Thuật toán mã hóa
- Số nhóm khóa Diffie-Hellman (version của Diffie-Hellman)

Trên router SG:

SG(config)#
crypto isakmp policy 10
SG(config-isakmp)#hash md5 // thuật toán hash
SG(config-isakmp)#encryption des // thuật toán mã hoá
SG(config-isakmp)#group 2 // số nhóm (version) Diffie-Hellman
SG(config-isakmp)#authentication pre-share // Phương thức chứng thực
SG(config)#crypto isakmp key 0 VPN123 address 151.1.1.1 // Xác định thông tin key và peer

Kết quả khi “ show crypto isakmp policy”:



Trên router VT:

VT(config)#
crypto isakmp policy 10
VT(config-isakmp)#hash md5
VT(config-isakmp)#encryption des
VT(config-isakmp)#group 2
VT(config-isakmp)#authentication pre-share
VT(config)#crypto isakmp key 0 VPN123 address 150.1.1.1

Kết quả khi “ show crypto isakmp policy”:


Bước 3: Cấu hình chính sách IPSec (IKE phase 2)
Thiết lập IPSec SA dựa trên những thông số của phase 1

SG(config)#crypto ipsec transform-set MYSET esp-md5-hmac esp-des //chọn giao thức ESP để đóng gói dữ liệu
SG(config)#crypto ipsec security-association lifetime seconds 1800 //thời gian tồn tại của IPSec SA

VT(config)#crypto ipsec transform-set MYSET esp-md5-hmac esp-des
VT(config)#crypto ipsec security-association lifetime seconds 1800

Bước 4: Tạo Access control list ACL
Xác định luồng dữ liệu nào sẽ được mã hoá bảo vệ
SG(config)#access-list 100 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255

VT(config)#access-list 100 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255

Bước 5: Cấu hình Crypto map

SG(config)#crypto map MYMAP 10 ipsec-isakmp 
% NOTE: This new crypto map will remain disabled until a peer
and a valid access list have been configured.
SG(config-crypto-map)#set peer 151.1.1.1
SG(config-crypto-map)#set transform-set MYSET
SG(config-crypto-map)#match address 100

VT(config)#crypto map MYMAP 10 ipsec-isakmp 
% NOTE: This new crypto map will remain disabled until a peer
and a valid access list have been configured.
VT(config-crypto-map)#set peer 150.1.1.1
VT(config-crypto-map)#set transform-set MYSET
VT(config-crypto-map)#match address 100

Bước 6: Đưa crypto map vào interface

SG(config)#interface s1/0
SG(config-if)#crypto map MYMAP 

VT(config)#interface s1/3
VT(config-if)#crypto map MYMAP 
5. Kiểm tra:
5.1. Kiểm tra kết nối giữa 2 LAN 192.168.1.0/24 và 192.168.2.0/24






Như vậy 2 LAN .168.1.0/24 và 192.168.2.0/24 đã có thể giao tiếp được với nhau.
5.2. Kiểm tra crypto map:


5.3. Kiểm tra ISAKMP SA: 


5.4. Kiểm tra IPSec SA:



---Hết---

Nếu thấy hay vui lòng nhấn g+1  bên dưới để chia sẽ cho mọi người.

Share on Google Plus

About Lý Hoàng Đông

Hy vọng các bạn thích bài viết này và chia sẽ đến với những người khác. Xin cảm ơn các bạn!
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment