Cisco 路由器上VPN的實現:
1、軟件要求:
需要ENTERPRISE PLUS IPSEC 56的IOS,目前使用的比較穩定版本是12.07T
2、硬件要求:
8 MB Flash and 40 MB RAM
在Download IOS版本時,會提示所Download的IOS版本
的軟硬件要求。
3、IPSec手工方式的注意事項:
?。?)加密通道一旦建立,就不再斷開
?。?)Manual Key不提供anti-replay的功能
?。?)在Manual Key方式時,aclearcase/" target="_blank" >ccess-list中只有1條permit起作用,其他都被忽略。
?。?)在Manual Key方式下,兩邊的transform set的名字必須一樣。
4、VPN手工方式需要的主要命令:
?。?)access-list
設置access-list,有對符合什么樣條件的IP包進行加密。
?。?)crypto isakmp
默認是使用crypto isakmp方式,所以在手工方式下,需要禁止此選項。
?。?)crypto ipsec
配置IPSec的加密方式,選擇manual方式
?。?)crypto map
配置IPSec的加密方式
a)set peer
設置遠程VPN網關
b)set security-association
設置安全聯盟,主要有inbound和outbound
c)set transform-set
設置加密形式
d)match address
對匹配access-list的進行加密。
5、VPN的手工實現方式:
?。?)配置access-list,對哪些包建立VPN連接。
access-list 101 permit ip host 192.168.0.1 host
192.168.1.1
?。?)取消VPN的自動協商方式
no crypto isakmp enable
?。?)建立一個IPSec的封裝方式―兩邊的路由器需要一樣的名稱。在舉例中是encry-des
crypto ipsec transform-set encry-desesp-des
?。?)建立一個VPN連接需要的各種條件―這里是ipsec-manual方式
crypto map vpntest 8 ipsec-manual
?。?)在上一步用crypto map進入crypto配置模式
a) 配置遠程的VPN網關
set peer 202.106.185.2
b) 配置進出的安全聯盟
set security-association inbound esp 1000 cipher 21 authenticator 01
配置入境聯盟 加密方式 順序號
set security-association outbound esp 1001 cipher 12 authenticator 01
c)設置IPSec的加密方式
set transform-set encry-des
d)對匹配地址進行加密
match address 101
?。?)在路由器外部網口上綁定加密方式
int e 0/1
ip addr 202.106.185.1 255.255.255.0
crypto map vpntest
6、注意事項
?。?)在兩端的access-list要互為相反,如在A路由器上寫:
access-list 101 permit ip host 192.168.0.1 host 192.168.1.1
則在B路由器上寫:
access-list 101 permit ip host 192.168.1.1 host 192.168.0.1
?。?)在兩端的transform set名稱要一致
如都寫crypto ipsec transform-set encry-des esp-des
?。?)在一端的inbound就是另一端的outboud,一端的outbound是另一端的inboud。因此他們的序列好應該相反。
如在A路由器上寫:
set security-association inbound esp 1000 cipher 21 authenticator 01
set security-association outbound esp 1001 cipher 12 authenticator 01
則在B路由器上寫:
set security-association inbound esp 1001 cipher 12 authenticator 01
set security-association outbound esp 1000 cipher 21 authenticator 01
?。?)總之在使用手工方式時,在兩端的配置應該盡量一樣或相對。
7、應用條件
我認為在路由器上做VPN主要有以下幾種應用:
?。?)可以使用在電信中二級節點和一級節點進行遠程管理認證時使用。而一級節點和骨干節點由于通訊量比較大,不建議使用VPN方式。而且為了減低負載只有在傳輸特殊應用時建議使用VPN,不是只是簡單地判斷Source IP,Destination IP。
?。?)移動用戶在跟自己公司的服務器進行連接時使用。
?。?)對于分公司、母公司這種形式在相互通信過程中使用。
8、用VPN的好處
?。?)節約成本,因為不要在做大量投資,購買專業設備,只需用現有的路由器即可。
?。?)實現了加密,保證重要數據在傳輸過程中的安全性。
?。?)靈活性強。如果用戶通過路由器接入Inte.net,則可以自己配置保證安全性。不過對于ISP來說用處不大。
9、VPN應用舉例:
在路由器R1上配置如下:
no crypto isakmp enable
crypto ipsec transform-set encry-des esp-des
crypto map vpntest 8 ipsec-manual
set peer 202.106.185.2
set security-association inbound esp 1000 cipher 21 authenticator 01
set security-association outbound esp 1001 cipher 12 authenticator 01
set transform-set encry-des match address 101
interface Ethernet0/0
ip address 192.168.0.1 255.255.255.0
interface Ethernet0/1
ip address 202.106.185.1 255.255.255.0
crypto map vpntest
ip route 0.0.0.0 0.0.0.0 202.106.185.2
access-list 101 permit ip host 192.168.0.1 host 192.168.1.1
在路由器R2上配置如下:
no crypto isakmp enable
crypto ipsec transform-set encry-des esp-des
crypto map vpntest 8 ipsec-manual set peer 202.106.185.1
set security-association inbound esp 1001 cipher 12 authenticator 01
set security-association outbound esp 1000 cipher 21 authenticator 01
set transform-set encry-des match address 101
interface Ethernet0/0
ip address 192.168.1.1 255.255.255.0
interface Ethernet0/1
ip address 202.106.185.2 255.255.255.0
crypto map vpntest
ip route 0.0.0.0 0.0.0.0 202.106.185.1
access-list 101 permit ip host 192.168.1.1 host 192.168.0.1
IKE方式的實現
1、IKE使用UPD 500
2、支持CA
3、支持移動用戶
IKE包括的組件:
1、DES
2、Diffie-Hellman-preshare key
3、RSA signatures(CA)and RSA encrypted nonces
IKE配置內容:
1、enable IKE―default enable
2、accesslist
3、transformset
4、crypto map
5、binding interface
IKE Policy―兩邊的號碼可以不一樣,匹配:
authentication、hash、diff-herman、encrytpion,lifetime(取最小值)
1、authentication
?。?)RSA signature
?。?)RSA non
?。?)Preshare Key
2、encryption
IKE配置
?。?)配置accesslist
?。?)crypto isakmp enable(默認打開,但為了避免,還是寫上)
?。?)crypto isakmp policy 10
a)encryption algorithm:DES
b)hash algorithm:SHA1
c)authentication method:RSA sig
d)Diffie-Hellman group:1
e)Lifetime:86400
?。?)crypto isakmp key test address 202.106.100.2
?。?)crypto ipsec transform-set set2 ah-sha-hmac
esp-des esp-sha-hmac
?。?)crypto map IKE ipsec-isakmp
a)set peer remote IP
b)set transform-set
c)set pfs group2
d)match address
?。?)dir
使用RSA的-encr方式
ip domain-name
crypto key generate rsa
sh crypto key mypubkey rsa
crypto key pubkey-chain rsa
key-string
什么時候使用手工方式,什么時候使用IKE方式