int f0/0 //内网接口
ip ad 10.1.1.1 255.255.255.0
ip nat inside
int f0/1 //外网接口
ip ad 202.202.202.1 255.255.255.240
ip nat outside
crypto map xxxtrans //应用map
ip route 0.0.0.0 0.0.0.0 int f0/1 //默认路由指向外网出口
ip nat pool tele 202.202.202.2 202.202.202.6 netmask 255.255.255.240
ip nat inside source route-map nonat pool tele overload //路由策略指定进行具体NAT转换的数据
access-list 185 permit ip 10.1.1.0 0.0.0.255 192.168.1.0 0.0.0.255 //指定与分支办公室连接的IP数据流,符合条件的进行VPN传输
access-list 190 deny ip 10.1.1.0 0.0.0.255 192.168.1.0 0.0.0.255
access-list 190 permit ip 10.1.1.0 0.0.0.255 any
//指定与分支办公室连接的IP数据流,符合条件的进行NAT转换,第一句将到远程站点的访问否定了,不让其进行地址转换
route-map nonat permit 10 //定义route-map,为NAT转换服务
match ip address 190
crypto map xxxmap 1 ipsec-isakmp //创建正规map
set peer 202.202.202.1 //定义总部IP
set transform-set xxxset //使用上面定义的变换集xxxset
match address 185 //援引访问列表定义的敏感流量,即进行VPN转换的流量
int f0/0
ip ad 192.168.1.0 255.255.255.0
ip nat inside
int f0/1
ip ad 99.99.99.1 255.255.255.0 //这里很有可能是动态IP
ip nat outside
crypto map xxxmap
ip route 0.0.0.0 0.0.0.0 f0/1 //默认路由指向出口
access-list 185 permit ip 192.168.1.0 0.0.0.255 10.1.1.0 0.0.0.255
// 指定需进行VPN转换的数据流
access-list 190 deny ip 192.168.1.0 0.0.0.255 10.1.1.0 0.0.0.255
access-list 190 permit ip 192.168.1.0 0.0.0.255 any
// 指定需进行正常NAT转换的数据流,符合条件的直接从出口访问公网,不符合的不做NAT转换,直接进行VPN加密并输送至公司总部端
route-map nonat permit 10
match ip address 190
vpdn enable //以下是ADSL拨号配置
int f0/1
pppoe enable
pppoe-client dialer-pool-number 1 //定义dialer-pool
int dialer1
mtu 1492 //VPN连接中许多问题是MTU造成的
ip address negotiated //IP地址与对端协商,ISP随机提供动态IP
encapsulation ppp
dialer pool 1 //引用dialer pool
dialer-group 1 //引用敏感流量,符合条件的触发ADSL拨号
ppp authentication pap callin //定义pap明文密码传输
ppp pap sent-username xxxx2223030 password 7 ******