IPsec - VPN配置大全 联系客服

发布时间 : 星期四 文章IPsec - VPN配置大全更新完毕开始阅读702266eaaeaad1f346933ff0

CISCO IPsec VPN配置大全

红头发(aka CCIE#15101) http://www.91lab.com

纽爱科网络实验室社区2 S! ^2 u! ~! U M) `. u6 H$ y+ k8 j

一.基于PSK的IPsec VPN配置

首先IOS带k的就可以了,支持加密特性,拓扑如下:

, S1 f\X! M

1.R1基本配置:

R1(config)#interface loopback0

R1(config-if)#ip address 10.1.1.1 255.255.255.0R1(config-if)#no shutdown

2 A9 T- u! ]& w0 v\y. gwww.91lab.com1 J1 g I1 g; ^

R1(config-if)#interface serial0/0

R1(config-if)#ip address 192.168.1.1 255.255.255.252R1(config-if)#clock rate 56000 R1(config-if)#no shutdownR1(config-if)#exit

2.定义感兴趣流量与路由协议:

R1(config)#access-list 100 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255 R1(config)#ip route 0.0.0.0 0.0.0.0 serial0/0

8 ]6 T1 P4 p( `1 d& G' h9 u# K9 e3 h1 O\i* J3 2 g' E6 g* g( m; ~$ k' e; R纽爱科网络实验室社区+ l6 m7 Q$ G6 K2 j1 G7 D1 |

. |' ]% D3 ~. y6 u\i$ X3.全局启用ISAKMP并定义对等体及其PSK(预共享密钥):

R1(config)#crypto isakmp enable

www.91lab.com/ v- P# M! d7 o/ y8 V F

R1(config)#crypto isakmp key 91lab address 192.168.1.2

3 X6 i1 }7 K1 c' @4 I: v

4.定义IKE策略:

R1(config)#crypto isakmp policy 10

4 V) f2 v( F* H. w8 K. j: b* v! F

$ Y5 r8 b5 i' W2 F- e, b/ VR1(config-isakmp)#encryption aes 128 /---默认是DES加密---/R1(config-isakmp)#hash sha /---默认是SHA-1---/ R1(config-isakmp)#authentication pre-share

5 R- f% p3 T# d9 q# @\ h

R1(config-isakmp)#group 2 /---默认是768位的DH1---/ R1(config-isakmp)#lifetime 3600 /---默认是86400秒---/R1(config-isakmp)#exit

3 d( x9 J$ c' www.91lab.com4 c+ N/ Y+ M! T( a& D; |5 n

5.定义IPSec转换集(transform set):

4 n: T/ J3 |7 Z4 n& x. _! K

R1(config)#crypto ipsec transform-set tt esp-aes 128 esp-sha-hmac R1(cfg-crypto-trans)#mode tunnel R1(cfg-crypto-trans)#exit

6.定义crypto map并应用在接口上:

R1(config)#crypto map cisco 10 ipsec-isakmp R1(config-crypto-map)#match address 100

R1(config-crypto-map)#set peer 192.168.1.2 /---定义要应用crypto map的对等体地址---/

R1(config-crypto-map)#set transform-set tt /---定义crypto map要应用的IPsec转换集---/

R1(config-crypto-map)#exit R1(config)#interface serial0/0

www.91lab.com' U# g+ B1 I# h2 j v3 M, j纽爱科网络实验室社区; K, y1 G( [( q\ [

R1(config-if)#crypto map cisco

*Mar 1 00:08:31.131: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON

( U b\X% W+ N1 _6 X\

8 F* a9 d3 D1 JR1(config-if)#end R1#

纽爱科网络实验室社区. j- l* {' P2 r

R1配置完成.

同理,R2相关配置如下:!

纽爱科网络实验室社区 p$ `0 B& u, Q5 K

!

4 q: g6 B1 Z! Ecrypto isakmp policy 10

9 m7 ~5 {6 q& s5 x6 sencr aes

$ n9 V! d+ Q5 N\k' ]6 ? `:

www.91lab.com4 i( |5 }' o x5 M' ] U2 v( \\authentication pre-sharegroup 2

crypto isakmp key 91lab address 192.168.1.1!!

8 b9 H0 K1 s, P' ]: w, a! Q( f) p& c- X2 R/ A5 x9 s1 [1 D) o

纽爱科网络实验室社区& {$ `1 U' M5 crypto ipsec transform-set tt esp-aes esp-sha-hmac !

$ j) x# y. E# U/ }- M+ E

纽爱科网络实验室社区\' u# z9 q1 _& wcrypto map cisco 10 ipsec-isakmp set peer 192.168.1.1

2 I( _: ^; U& w b4 Y2 T% l& B

set transform-set tt match address 100!

4 s0 Z. A8 S9 f0 W纽爱科网络实验室社区0 |- ?. I. I' _' j

!

纽爱科网络实验室社区' Z l2 M, a1 l3 G# _' D$ ^' P3 q4 {

!

8 d1 b. P7 [4 @* z!

* h1 U& D4 ]9 l$ h2 z! I& f

interface Loopback0

ip address 10.2.2.1 255.255.255.0 !

www.91lab.com8 V+ s5 L: A! o( Y% K/ E

interface Serial0/0

ip address 192.168.1.2 255.255.255.252 crypto map cisco!

ip route 0.0.0.0 0.0.0.0 Serial0/0 !

access-list 100 permit ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255!

1 l; ~/ Q [\ `5 }0 {9 c/ q纽爱科网络实验室社区 W. a; m' Q$ R\ ?7 h: J' |

二.采用积极模式并PSK的IPsec VPN配置

www.91lab.com: M$ M- {% T9 O/ X3 N3 H z& S4 {! u/ U4 t- W) r+ G' E% U( d\

- F! W( Z3 c7 h1.R1基本配置:

R1(config)#interface loopback0

1 o- D8 @) Z& S, b( s/ G4 Z

\ m, c% m: g5 i% H9 K4 NR1(config-if)#ip address 10.1.1.1 255.255.255.0R1(config-if)#no shutdown

. }! s8 M\H/ S

R1(config-if)#interface serial0/0

R1(config-if)#ip address 192.168.1.1 255.255.255.252

! U' W) R& T3 ?0 B) HR1(config-if)#clock rate 56000 R1(config-if)#no shutdown R1(config-if)#exit

2.定义感兴趣流量与路由协议:

R1(config)#access-list 100 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255 R1(config)#ip route 0.0.0.0 0.0.0.0 serial0/0

3.全局启用ISAKMP并定义对等体及其PSK(预共享密钥),采用积极模式: R1(config)#crypto isakmp enable

纽爱科网络实验室社区$ F- D\K! {* X1 P# i& n\

R1(config)#crypto isakmp peer address 192.168.1.2 R1(config-isakmp-peer)#set 192.168.1.1

R1(config-isakmp-peer)#set aggressive-mode password 91lab

4.定义IKE策略:

aggressive-mode

client-endpoint

ipv4-address