路由器配置基礎(chǔ):配置IPsec語句學(xué)習(xí)筆記
很多人對配置IPsec語句的意思還不是很明白,沒有關(guān)系,下面我們就針對這個(gè)問題進(jìn)行詳細(xì)的說明。隨道Internet的不斷普及,低廉的上網(wǎng)費(fèi)用促使越來越多的企業(yè)選擇了通過VPN來實(shí)現(xiàn)遠(yuǎn)程連接,相比專線、幀中繼、ATM等傳統(tǒng)廣域網(wǎng)連接,VPN不但成本要低出很多,而且安全性方面也不亞于它們,今天我們主要來介紹一下利用路由器來實(shí)現(xiàn)配置IPsec語句站點(diǎn)到站點(diǎn)的遠(yuǎn)程連接,同時(shí)利用NAT實(shí)現(xiàn)上Internet。
一、配置IPsec語句
R1路由:
R1(config)#int f0/0
R1(config-if)#ip address 13.0.0.1 255.0.0.0 配置接口IP地址
R1(config-if)#no shutdown
R1(config)#int loopback 0
R1(config-if)#ip address 192.168.1.1 255.255.255.0 配置回環(huán)地址供測試
R1(config)#ip route 0.0.0.0 0.0.0.0 13.0.0.3 設(shè)置默認(rèn)靜態(tài)路由出去
R3路由:
R3(config)#int f0/0
R3(config-if)#ip address 13.0.0.3 255.0.0.0 配置接口IP地址
R3(config-if)#no shutdown
R3(config)#int f0/1
R3(config-if)#ip add 23.0.0.3 255.0.0.0 配置接口IP地址
R3(config-if)#no shutdown
R2路由:
R2(config)#int f0/0
R2(config-if)#ip address 23.0.0.2 255.0.0.0 配置接口IP地址
R2(config-if)#no shutdown
R2(config)#int loopback 0
R2(config-if)#ip address 172.16.1.1 255.255.0.0 配置回環(huán)地址供測試
R2(config)#ip route 0.0.0.0 0.0.0.0 23.0.0.3 設(shè)置默認(rèn)靜態(tài)路由出去
二、VPN配置
第一步 配置IKE協(xié)商
R1(config)#crypto isakmp policy 100 建立IKE協(xié)商策略
R1(config-isakmap)# authentication pre-share 設(shè)置路由要使用的預(yù)先共享的密鑰
R1(config)# crypto isakmp key jxxh address 23.0.0.2 設(shè)置共享密鑰和對端地址 jxxh是密鑰
R2(config)#crypto isakmp policy 100 建立IKE協(xié)商策略
R2(config-isakmap)# authentication pre-share 路由器設(shè)置要使用的預(yù)先共享的密鑰
R2(config)# crypto isakmp key jxxh address 13.0.0.1 設(shè)置共享密鑰和對端地址 jxxh是密鑰
第二步 配置IPSEC語句相關(guān)參數(shù)
R1(config)# crypto ipsec transform-set jxxhset esp-des
R1(config)# access-list 101 permit ip 192.168.1.0 0.0.0.255 172.16.0.0 0.0.255.255這里是定義訪問控制列表
R2(config)# crypto ipsec transform-set jxxhset esp-des 兩邊的傳輸模式的名字要一樣
R2(config)# access-list 101 permit ip 172.16.0.0 0.0.255.255 192.168.1.0 0.0.0.255
第三步 應(yīng)用配置到接口
R1(config)#crypto map jxxhmap 110 ipsec-isakmp 采用IKE協(xié)商,優(yōu)先級為110
R1(config-crypto-map)#set peer 23.0.0.2 指定VPN鏈路對端的IP地址
R1(config-crypto-map)#set transform-set jxxhset指定先前所定義的傳輸模式
R1(config-crypto-map)#match address 101 指定使用的反問控制列表,這里的MATCH是匹配的意思
R1(config)# int f0/0
R1(config-if)# crypto map jxxhmap 應(yīng)用此表到端口
R2(config)#crypto map jxxhmap 110 配置IPsec語句采用IKE協(xié)商,優(yōu)先級為110 這里的jxxhmap是一個(gè)表的名字
R2(config-crypto-map)#set peer 13.0.0.1 指定VPN鏈路對端的IP地址
R2(config-crypto-map)#set transform-set jxxhset指定先前所定義的傳輸模式
R2(config-crypto-map)#match address 101 指定使用的反問控制列表,這里的MATCH是匹配的意思
R2(config)# int f0/0
R2(config-if)# crypto map jxxhmap 應(yīng)用此表到端口
NAT配置
R1(config)#access list 102 deny ip 192.168.1.0 0.0.0.255 172.16.0.0 0.0.255.255
R1(config)#access list 102 permit ip any any
R1(config)#ip nat inside source list 102 int f0/0 overload 配置NAT
R1(config)#int f0/0
R1(config)#ip nat outside
R1(config)#int lo 0 真實(shí)環(huán)境建議用物理接口
R1(config)#ip nat inside
R2(config)#access list 102 deny ip 172.16.0.0 0.0.255.255 192.168.1.0.0.0.0.255
R2(config)#access list 102 permit ip any any
R2(config)#ip nat inside source list 102 int f0/0 overload 配置NAT
R2(config)#int f0/0
R2(config)#ip nat outside
R2(config)#int lo 0 真實(shí)環(huán)境建議用物理接口
R2(config)#ip nat inside