Router:sam-i-am(××× Server)

Current configuration:

!

version 12.2

service timestamps debug uptime

service timestamps log up time

no service password-encryption

!

hostname sam-i-am

!

ip subnet-zero

!--- IKE配置



sam-i-am(config)#crypto isakmp policy 1 //定义策略为1

sam-i-am(isakmp)#hash md5 //定义MD5散列算法

sam-i-am(isakmp)#authentication pre-share //定义为预共享密钥认证方式

sam-i-am(config)#crypto isakmp key cisco123 address 0.0.0.0 0.0.0.0

!--- 配置预共享密钥为cisco123,对等端为所有IP

!--- IPSec协议配置

sam-i-am(config)#crypto ipsec transform-set rtpset esp-des esp-md5-hmac

!--- 创建变换集 esp-des esp-md5-hmac

sam-i-am(config)#crypto dynamic-map rtpmap 10 //创建动态保密图rtpmap 10

san-i-am(crypto-map)#set transform-set rtpset //使用上面的定义的变换集rtpset

san-i-am(crypto-map)#match address 115 //援引访问列表确定受保护的流量

sam-i-am(config)#crypto map rtptrans 10 ipsec-isakmp dynamic rtpmap

!--- 将动态保密图集加入到正规的图集中

!

interface Ethernet0

ip address 10.2.2.3 255.255.255.0

no ip directed-broadcast

ip nat inside

no mop enabled

!

interface Serial0

ip address 99.99.99.1 255.255.255.0

no ip directed-broadcast

ip nat outside

crypto map rtptrans //将保密映射应用到S0接口上

!

ip nat inside source route-map nonat interface Serial0 overload

!--- 这个NAT配置启用了路由策略,内容为10.2.2.0到10.1.1.0的访问不进行地址翻译

!--- 到其他网络的访问都翻译成SO接口的IP地址ip classless

ip route 0.0.0.0 0.0.0.0 Serial0 //配置静态路由协议

no ip http server

!

access-list 115 permit ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255

access-list 115 deny ip 10.2.2.0 0.0.0.255 any

!

access-list 120 deny ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255

access-list 120 permit ip 10.2.2.0 0.0.0.255 any

!

sam-i-am(config)#route-map nonat permit 10 //使用路由策略

sam-i-am(router-map)#match ip address 120

!

line con 0

transport input none

line aux 0

line vty 0 4

password ww

login

!

end

Router:dr_whoovie(××× Client)

Current configuration:

!

version 12.2

service timestamps debug uptime

service timestamps log uptime

no service password-encryption

!

hostname dr_whoovie

!

ip subnet-zero

!

dr_whoovie(config)#crypto isakmp policy 1 //定义策略为1

dr_whoovie(isakmp)#hash md5 //定义MD5散列算法

dr_whoovie(isakmp)#authentication pre-share //定义为预共享密钥认证方式

dr_whoovie(config)#crypto isakmp key cisco123 address 99.99.99.1

!--- 配置预共享密钥为cisco123,对等端为服务器端IP99.99.99.1

!--- IPSec协议配置

dr_whoovie(config)#crypto ipsec transform-set rtpset esp-des esp-md5-hmac

!--- 创建变换集 esp-des esp-md5-hmac

dr_whoovie(config)#crypto map rtp 1 ipsec-isakmp



!--- 使用IKE创建保密图rtp 1

dr_whoovie(crypto-map)#set peer 99.99.99.1 //确定远程对等端


dr_whoovie(crypto-map)#set transform-set rtpset //使用上面的定义的变换集rtpset

dr_whoovie(crypto-map)#match address 115 //援引访问列表确定受保护的流量

!

interface Ethernet0
ip address 10.1.1.1 255.255.255.0

no ip directed-broadcast

ip nat inside

no mop enabled

!

interface Serial0

ip address negotiated //IP地址自动获取

no ip directed-broadcast

ip nat outside

encapsulation ppp //S0接口封装ppp协议

no ip mroute-cache

no ip route-cache

crypto map rtp //将保密映射应用到S0接口上

!

ip nat inside source route-map nonat interface Serial0 overload

!--- 这个NAT配置启用了路由策略,内容为10.1.1.0到10.2.2.0的访问不进行地址翻译

!--- 到其他网络的访问都翻译成SO接口的IP地址

ip classless

ip route 0.0.0.0 0.0.0.0 Serial0 //配置静态路由协议

no ip http server

!

access-list 115 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255

access-list 115 deny ip 10.1.1.0 0.0.0.255 any

access-list 120 deny ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255

access-list 120 permit ip 10.1.1.0 0.0.0.255 any

!

dialer-list 1 protocol ip permit

dialer-list 1 protocol ipx permit

route-map nonat permit 10 //使用路由策略

match ip address 120

!

line con 0

transport input none

line aux 0

line vty 0 4

password ww

login

!

end
 
出自:[url]http://bbs.315safe.com/thread-3576-1-1.html[/url]
本文出自 51CTO.COM技术博客