1. VPN site to site giữa ASA và Draytek
Hôm nay mượn được con draytek nên làm vài bài lab cho phê
I. Sơ đồ và yêu cầu
1. Sơ đồ
2. Yêu cầu
- Thực hiện VPN site to site giữa ASA và Draytek (mình dùng con Vigor 2920 vì mình mới
được cho mượn con này xài )
- Client truy cập lẫn nhau được
II. Triển khai
1. Cấu hình Draytek
- Thiết lập IP WAN cho Vigor 2920 trên interface WAN 2 có IP: 200.0.0.2/24
3. - Cấu hình VPN trên Draytek
- Vào mục VPN and Remote Access >> LAN to LAN >> Click chọn index 1.
- Chọn cấu hình dial in hoặc dial out tùy mục địch config của bạn. Và kết nối VPN bằng
interface WAN2.
Profile Name: đặt tên profile để tiện việc quản lý.
4. Enable: để kích hoạt Profile.
Dial-out: để báo cho router biết chức năng của nó là Dial-out, và chút nữa
chúng ta chỉ cần quan tâm phần cấu hình Dial-out trong profile này.
- Chuyển xuống mục Dial-out settings (bỏ qua phần Dial-in setting). Chọn IPSec Tunnel
để thiết lập kênh VPN theo giao thức IPsec.
- Chú ý chọn chỗ mũi tên số 1 (pre-share key giữa ASA và draytek phải giống nhau) và số 2
(kiểu mã hóa, thuật toán băm và chứng thực phải giống với ASA) nếu không nó sẽ ko chạy
được
5. - Pharse 1 mình sẽ chọn
main mode
Mã hóa theo thuật toán 3DES
Thuật toán băm là MD5
Thuật toán trao đổi khóa diffie hellman là group 2
- Các bạn chú chọn cho đúng để chút config bên ASA phải giống nếu không nó không chạy
được lại khổ
6. - Tiếp tục xuống phần TCP/IP settings (Bỏ qua các mục cấu hình khác)
Ở phần này ta sẽ báo cho Router biết mạng local ở đầu xa có địa chỉ là bao
nhiêu.
Điền 192.168.1.0 vào khung Remote Network IP ( Địa chỉ mạng ở đầu xa - IP
inside của ASA).
Điền 255.255.255.0 vào khung Remote Network Mask.
Điền 10.1.1.0 vào khung Local Network IP.
Click OK để lưu các mục vừa cấu hình.
2. Cấu hình ASA
- Cấu hình IP cho ASA
7. ciscoasa(config)# interface g0
ciscoasa(config-if)# nameif outside
ciscoasa(config-if)# ip address 200.0.0.1 255.255.255.0
ciscoasa(config-if)# no shutdown
ciscoasa(config-if)# int g1
ciscoasa(config-if)# nameif inside
ciscoasa(config-if)# ip address 192.168.1.1 255.255.255.0
ciscoasa(config-if)# no shutdown
- Cấu hình VPN cho ASA
ciscoasa(config)# crypto ikev1 policy 10
ciscoasa(config-ikev1-policy)# authentication pre-share
ciscoasa(config-ikev1-policy)# encryption 3des
ciscoasa(config-ikev1-policy)# hash md5
ciscoasa(config-ikev1-policy)# group 2
ciscoasa(config-ikev1-policy)# lifetime 86400
ciscoasa(config)# crypto ikev1 enable outside
ciscoasa(config-ikev1-policy)# crypto ipsec ikev1 transform-set SVUIT esp-3des esp-md5-hmac
ciscoasa(config)# object network INSIDE-ASA
ciscoasa(config-network-object)# subnet 192.168.1.0 255.255.255.0
ciscoasa(config-network-object)# object network INSIDE-Draytek
ciscoasa(config-network-object)# subnet 10.2.2.0 255.255.255.0
ciscoasa(config)# access-list VPN-TRAFFIC permit ip object INSIDE-ASA object INSIDE-Draytek
ciscoasa(config)# crypto map ASA-VPN 10 match address VPN-TRAFFIC
ciscoasa(config)# crypto map ASA-VPN 10 set peer 200.0.0.2
ciscoasa(config)# crypto map ASA-VPN 10 set ikev1 transform-set SVUIT
ciscoasa(config)# crypto map ASA-VPN interface outside
ciscoasa(config)# tunnel-group 200.0.0.2 type ipsec-l2l
ciscoasa(config)# tunnel-group 200.0.0.2 ipsec-attributes
ciscoasa(config-tunnel-ipsec)# ikev1 pre-shared-key svuit.com
3. Kiểm tra
- Client trong Draytek thực hiện truy cập web server trong vùng inside của ASA thành công
8.
9. 4. Kiếm tra và Lỗi
- Nếu VPN thành công bạn hãy kiểm tra trạng thái Crypto ikev1
Code:
ciscoasa# sh crypto ikev1 sa
IKEv1 SAs:
Active SA: 1
Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
Total IKE SA: 1
10. 1 IKE Peer: 200.0.0.2
Type : L2L Role : responder
Rekey : no State : MM_ACTIVE
- Trạng thái IPsec
Code:
ciscoasa# sh ipsec sa
interface: outside
Crypto map tag: ASA-VPN, seq num: 10, local addr: 200.0.0.1
access-list VPN-TRAFFIC extended permit ip 192.168.1.0 255.255.255.0 10.1.1.0
255.255.255.0
local ident (addr/mask/prot/port): (192.168.1.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/0/0)
current_peer: 200.0.0.2
#pkts encaps: 6, #pkts encrypt: 6, #pkts digest: 6
#pkts decaps: 238, #pkts decrypt: 238, #pkts verify: 238
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 6, #pkts comp failed: 0, #pkts decomp failed: 0
#pre-frag successes: 0, #pre-frag failures: 0, #fragments created: 0
#PMTUs sent: 0, #PMTUs rcvd: 0, #decapsulated frgs needing reassembly: 0
#send errors: 0, #recv errors: 228
local crypto endpt.: 200.0.0.1/0, remote crypto endpt.: 200.0.0.2/0
path mtu 1500, ipsec overhead 58, media mtu 1500
current outbound spi: 8251B9F0
current inbound spi : 8595387F
inbound esp sas:
spi: 0x8595387F (2241149055)
transform: esp-3des esp-md5-hmac no compression
in use settings ={L2L, Tunnel, }
slot: 0, conn_id: 16384, crypto-map: ASA-VPN
sa timing: remaining key lifetime (sec): 28614
IV size: 8 bytes
replay detection support: Y
Anti replay bitmap:
0xFFFFFFFF 0xFFFFFFFF
outbound esp sas:
spi: 0x8251B9F0 (2186394096)
transform: esp-3des esp-md5-hmac no compression
in use settings ={L2L, Tunnel, }
slot: 0, conn_id: 16384, crypto-map: ASA-VPN
sa timing: remaining key lifetime (sec): 28614
IV size: 8 bytes
replay detection support: Y
Anti replay bitmap:
0x00000000 0x00000001
- Nếu bạn VPN không thành công thì hãy thử debug xem nó thế nào nhé
11. ciscoasa# debug crypto ikev1 255
- Ví dụ như lỗi ở hình dưới đây là do ở pharse 1 việc chọn thuật toán mã hõa, băm hoặc
group diffi không đúng nên vpn thất bại