IPsec 威P恩實驗

在這裏插入圖片描述

1、完成基本路由

R1:

int f0/0
ip add 100.1.1.1 255.255.255.0
no shutdown
int lo 0
ip add 192.168.10.1 255.255.255.0
ip route 0.0.0.0 0.0.0.0 100.1.1.2

R2:

int f0/0
ip add 100.1.1.1 255.255.255.0
no shutdown
int f0/1
ip add 200.1.1.3 255.255.255.0
no shutdown

R3:

int f0/1
ip add 200.1.1.3 255.255.255.0
no shutdown
int lo 0
ip add 172.16.30.3 255.255.255.0
no shutdown

ip route 0.0.0.0 0.0.0.0 200.1.1.2
2、定義P1 policy

crypto isakmp policy 10 //定義P1協商參數, 10是序號,本地有效
encryption 3des //從5-6包開始的isakmp消息加密算法
hash sha //源認證用的散列算法
authentication pre-share //源認證使用預共享密鑰的方式
group 2 // DH組2 (1024bits)
crypto isakmp key 0 cisco123 address 200.1.1.3 //定義一個PSK,用於計算SKEYID互相認證,指定key用於哪個peer(因爲可能有多個peer用不同的key)
show crypto isakmp policy 可以看到除了自己定義的10,還有一個默認的模板。這個模板不會被直接使用,而是自定義policy中沒有指定的參數,會按照模板中的默認參數使用。
R3

crypto isakmp policy 10
	encryption 3des
	hash sha
	authentication pre-share
	group 2

crypto isakmp key 0 cisco123 address 100.1.1.1
3、定義P2 policy

R1
crypto ipsec transform-set TS esp-3des esp-sha-hmac //定義二階段SA中使用的加密算法和認證算法
mode [tunnel | transport] //默認tunnel模式
R3
crypto ipsec transform-set TS esp-3des esp-sha-hmac

4、定義感興趣流量

R1

ip access-list extend ACL
permit ip host 192.168.10.1 host 172.16.30.3
R3
ip access-list extend ACL
permit ip host 172.16.30.3 host 192.168.10.1
5、定義接口策略

R1
crypto map CMAP 10 ipsec-isakmp //一個接口只能調用一個map,所以用行號區分,使用isakmp來爲ipsec創建安全隧道
match address ACL //匹配感興趣列表的流量纔要做保護
set transform-set TS //調用轉換集,指定用什麼方法保護
set peer 200.1.1.3 //與誰協商
int f0/0
crypto map CMAP //調用到流量的出包接口
R3

crypto map CMAP 10 ipsec-isakmp
match address ACL
set transform-set TS
set peer 100.1.1.1
int f0/1
crypto map CMAP
6、激活VPN

R1
ping 172.16.30.3 source 192.168.10.1 通
//注意此時R2仍然沒有私網的路由,能通是因爲加密了,數據包外層的IP包頭裏,目的地址是加密點的地址。內層IP包頭纔是通訊點的地址。

7、查看
R1#show crypto isakmp sa
R1#show cry ipsec sa
R1# show crypto engine connections active
R1#show cry session
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章