On ccna
Cấu hình VPN Site to Site trên router Cisco ( cli )

1.Topology




2.Yên cầu 

Cấu hình VPN cho phép 2 LAN ở router HQ và router Branch liên lạc được với nhau.
3.Cấu hình: 


a. Cấu hình  cơ bản trên các router 

-Router ISP: chỉ cấu hình hostname và IP của các interface như mô hình trên
- Router HQ: cấu hình hostname và ip theo mô hình, sau đó cấu hình default route. 

HQ(config)#ip route 0.0.0.0 0.0.0.0 113.114.115.2 

- Router Branch: cấu hình hostname và ip theo mô hình, sau đó cấu hình default route. 

Branch(config)#ip route 0.0.0.0 0.0.0.0 115.114.113.2

 b.Cấu hình VPN theo các bước sau:

Trên router HQ 

Bước1: Tạo Internet Key Exchange (IKE) key policy.

HQ(config)#crypto isakmp policy 9

HQ(config-isakmp)#hash md5

HQ(config-isakmp)#authentication pre-share

Bước 2: Tạo shared key để sử dụng cho kết nối VPN

HQ(config)#crypto isakmp key VPNKEY address 115.114.113.1    (ip của router branch)


Bước3: Quy định lifetime 

HQ(config)#crypto ipsec security-association lifetime seconds 86400

Bước4: Cấu hình ACL dãy IP có thể VPN.

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

Bước 5:  Define the transformations set that will be used for this VPN connection

HQ(config)#crypto ipsec transform-set SETNAME esp-3des esp-md5-hmac


Bước6:  Tạo cypto-map cho các transform, setname

HQ(config)#crypto map MAPNAME 10 ipsec-isakmp

HQ(config-crypto-map)#set peer 115.114.113.1   (ip của router branch)

HQ(config-crypto-map)#set transform-set SETNAME  ( setname ở bước 5)

HQ(config-crypto-map)#match address 100  (100 : acl-number ở bước 4 )

Bước7: Gán vào interface

HQ(config)#inter s0/0/0
HQ(config-if)#crypto map MAPNAME  (mapname ở bước 6)

Trên router Branch


Thực hiện tương tự theo 7 bước như trên router HQ.
Có một số thay đổi nho nhỏ ở các bước sau:
- bước 2:
Branch(config)#crypto isakmp key VPNKEY address 113.114.115.1 (ip của router HQ)

- bước 4:
Branch(config)#access-list 100 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255

- bước 6:
 Branch(config-crypto-map)#set peer 113.114.115.1   (ip của router HQ)


Phần trên các router cấu hình đến đây đã xong!

Kết quả: ping từ LAN 192.168.1.0/24 sang LAN 192.168.2.0 /24 đã thành công!




  
---------------

Một số lệnh kiểm tra cấu hình vpn


show crypto isakmp sa

show crypto ipsec sa

show crypto engine connections active

and show crypto map

-----------

Mô hình tôi làm trên packer tracer 5.3 + config files : download

CHÚC CÁC BẠN THỰC HIỆN THÀNH CÔNG! 

Copyright by http://www.lecuong.info