實驗
實驗拓撲圖:
實驗環境:
在GNS3上搭建三臺路由器,使用VPCS模擬兩臺PC,並規劃上海和北京兩家公司局域網。
實驗要求:
在兩家公司網關路由器上做IPsec×××,使兩家公司內網可以相互通信,並使數據加密傳送達到信息安全的目的。
實驗步驟:
首先規劃路由器和PC機IP地址並在出口網關作做一條通向公網的默認路由:
R1:
R1(config)#int f0/1
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/0
R1(config-if)#ip add 12.0.0.1 255.255.255.252
R1(config-if)#no shut
R1(config-if)#ex
R1(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2
R2:
R2(config)#int f0/0
R2(config-if)#ip add 12.0.0.2 255.255.255.252
R2(config-if)#int f0/1
R2(config-if)#ip add 13.0.0.1 255.255.255.252
R2(config-if)#no shut
R3:
R3(config)#int f0/0
R3(config-if)#ip add 13.0.0.2 255.255.255.252
R3(config-if)#no shut
R3(config-if)#int f0/1
R3(config-if)#ip add 10.0.0.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#ex
R3(config)#ip route 0.0.0.0 0.0.0.0 13.0.0.1
PC:
接下來在網關路由器上做IPsec×××:
配置如下:
R1:
R1(config)#crypto isakmp policy 1 //配置安全策略級別
R1(config-isakmp)#encryption des //採用DES加密算法
R1(config-isakmp)#hash sha //指定SHA驗證功能
R1(config-isakmp)#authentication pre-share //設備方式的驗證
R1(config-isakmp)#group 2 //指定DH密鑰組
R1(config-isakmp)#lifetime 60 //配置爲60秒沒有流量將自動斷開連接
R1(config-isakmp)#crypto isakmp key 6 abc123 address 13.0.0.2 //設定共享密鑰的內容和對端設備的IP地址
R1(config)#access-list 101 permit ip host 192.168.10.100 host 10.0.0.2 //配置ACL指定需要保護的流量
R1(config)#crypto ipsec transform-set benet esp-sha-hmac esp-des //指定傳輸集名稱和選項
R1(cfg-crypto-trans)#crypto map ipsecmap 1 ipsec-isakmp //構建IPsec×××會話
R1(config-crypto-map)#match address 101 //調用ACL
R1(config-crypto-map)#set peer 13.0.0.2 //指定對端IP地址
R1(config-crypto-map)#set transform-set benet //調用傳輸集
R1(config-crypto-map)#ex
R1(config)#int f0/0
R1(config-if)#crypto map ipsecmap //應用在接口
R3與R1絕大部分配置相同,將對端地址互指即可:
R3(config)#crypto isakmp policy 1
R3(config-isakmp)#encryption des
R3(config-isakmp)#hash sha
R3(config-isakmp)#authentication pre-share
R3(config-isakmp)#group 2
R3(config-isakmp)#lifetime 60
R3(config-isakmp)#crypto isakmp key 6 abc123 address 12.0.0.1
R3(config)#access-list 101 permit ip host 10.0.0.2 host 192.168.10.100
R3(config)#crypto ipsec transform-set benet esp-sha-hmac esp-des
R3(cfg-crypto-trans)#ex
R3(config)#crypto map ipsecmap 1 ipsec-isakmp
R3(config-crypto-map)#match address 101
R3(config-crypto-map)#set peer 12.0.0.1
R3(config-crypto-map)#set transform-set benet
R3(config-crypto-map)#ex
R3(config)#int f0/0
R3(config-if)#crypto map ipsecmap
測試兩臺PC互通:
實驗完成