7. Bước 6: Xác định luồng dữ liệu sẽ được mã hóa hay bảo vệ
Tại router SAIGON:
Tại router BINHPHUOC:
8. Bước 7: Cấu hình crypto map
Tại router SAIGON:
Tại router BINHPHUOC:
9. Bước 8:Cấu hình crypto map lên cổng:
Tại router SAIGON:
Tại router BINHPHUOC:
10. Bước 9: Tiến hành kiểm tra
Kích hoạt tunnel dựa vào lưu lượng được xác định trên acl 100 Từ client_saigon ping qua gateway của BINHPHUOC
.jpg)
Sau khi tunnel được thiết lập có thể kiểm tra thông tin pha 1 và pha 2:
Trạng thái ISAKMP SA:
Trạng thái IPSEC SA:
SAIGON#show crypto session detail
Số lượng kết nối mở (1 cho IKE và 2 cho Ipsec)
SAIGON#show crypto engine connections active
Có thể xóa kết nối với dòng lệnh:
Trong quá trình cấu hình, có thể dùng câu lệnh debug crypto isakmp để kiểm tra quá trình thiết lập
Tại router SAIGON:
Code:
SAIGON(config)#access-list 100 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
Code:
BINHPHUOC(config)#access-list 100 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
Tại router SAIGON:
Code:
SAIGON(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 SAIGON(config-crypto-map)#set peer 151.1.1.1 SAIGON(config-crypto-map)#set transform-set MYSET SAIGON(config-crypto-map)#match address 100
Code:
BINHPHUOC(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 BINHPHUOC(config-crypto-map)#set peer 151.1.1.1 BINHPHUOC(config-crypto-map)#set transform-set MYSET BINHPHUOC(config-crypto-map)#match address 100
Tại router SAIGON:
Code:
SAIGON(config)#interface s0/0 SAIGON(config-if)#crypto map MYMAP
Code:
BINHPHUOC(config)#interface s0/0 BINHPHUOC(config-if)#crypto map MYMAP
Kích hoạt tunnel dựa vào lưu lượng được xác định trên acl 100 Từ client_saigon ping qua gateway của BINHPHUOC
.jpg)
Sau khi tunnel được thiết lập có thể kiểm tra thông tin pha 1 và pha 2:
Trạng thái ISAKMP SA:
Code:
SAIGON#show crypto isakmp sa dst src state conn-id slot status 151.1.1.1 150.1.1.1 QM_IDLE 1 0 ACTIVE
Code:
SAIGON#show crypto ipsec sa
interface: Serial0/0
Crypto map tag: MYMAP, local addr 150.1.1.1
protected vrf: (none)
local ident (addr/mask/prot/port): (192.168.1.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (192.168.2.0/255.255.255.0/0/0)
current_peer 151.1.1.1 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 7, #pkts encrypt: 7, #pkts digest: 7 => Gói được mã hóa
#pkts decaps: 7, #pkts decrypt: 7, #pkts verify: 7 => Gói được mã hóa
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 1, #recv errors 0
Code:
local crypto endpt.: 150.1.1.1, remote crypto endpt.: 151.1.1.1
path mtu 1500, ip mtu 1500
current outbound spi: 0x6DA11B48(1839274824)
inbound esp sas: => SA sử dụng cho gói đi vào
spi: 0xC9EFAA55(3387927125) => Tương ứng với outbound của peer
transform: esp-des esp-md5-hmac ,
in use settings ={Tunnel, }
conn id: 2001, flow_id: SW:1, crypto map: MYMAP
sa timing: remaining key lifetime (k/sec): (4457799/3252)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
inbound ah sas:
inbound pcp sas:
outbound esp sas: => SA sử dụng cho gói đi ra
Code:
spi: 0x6DA11B48(1839274824) => Tương ứng với inbound của peer
transform: esp-des esp-md5-hmac ,
in use settings ={Tunnel, }
conn id: 2002, flow_id: SW:2, crypto map: MYMAP
sa timing: remaining key lifetime (k/sec): (4457799/3225)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
outbound ah sas:
outbound pcp sas:
Code:
Crypto session current status Code: C - IKE Configuration mode, D - Dead Peer Detection K - Keepalives, N - NAT-traversal, X - IKE Extended Authentication Interface: Serial0/0 Session status: UP-ACTIVE => Trạng thái của session Peer: 151.1.1.1 port 500 fvrf: (none) ivrf: (none) Phase1_id: 151.1.1.1 Desc: (none) IKE SA: local 150.1.1.1/500 remote 151.1.1.1/500 Active Capabilities none) connid:1 lifetime:23:49:20 IPSEC FLOW: permit ip 192.168.1.0/255.255.255.0 192.168.2.0/255.255.255.0 => Dữ liệu được bảo vệ Active SAs: 2, origin: crypto map Inbound: #pkts dec'ed 11 drop 0 life (KB/Sec) 4457798/2961 Outbound: #pkts enc'ed 11 drop 1 life (KB/Sec) 4457798/2961
SAIGON#show crypto engine connections active
Code:
ID Interface IP-Address State Algorithm Encrypt Decrypt 1 Serial0/0 150.1.1.1 set HMAC_MD5+DES_56_CB 0 0 2001 Serial0/0 150.1.1.1 set DES+MD5 0 11 2002 Serial0/0 150.1.1.1 set DES+MD5 11 0
Code:
SAIGON#clear crypto session SAIGON#show crypto isakmp sa dst src state conn-id slot status 151.1.1.1 150.1.1.1 MM_NO_STATE 1 0 ACTIVE (deleted)
Trần Huỳnh Hiệp – VnPro