测试:
(1)未将map应用到接口之前,在r1,扩展ping,source 192.168.1.1 destination 172.16.2.1,通过。扩展ping,source 172.16.1.1 destination 172.16.2.1,通过。
(2)map应用到接口之后,在r1,扩展ping,source 192.168.1.1 destination 172.16.2.1,通过。
查看show crypto ipsec sa ,可以看到数据没有通过vpn 通道进行传输,因为不符合acl 101。
(3)map应用到接口之后,在r1,扩展ping,source 172.16.1.1 destination 172.16.2.1,通过。查看show cry ip sa,可以看到数据通过vpn 通道进行传输。
(4)在r2上同样进行测试。
vpn client(network-extension mode)
实验网络拓扑:
PC----Switch-----Router<R1>------Router<R2>
|
|
Router<R3>
VPN Client R3 接口IP:
f0/0: 10.1.1.2/24
f0/1: 10.2.2.1/24
VPN Access Server R1 接口IP:
e0/0:10.1.1.100/24
s1/0:172.16.1.1/24
Private Network R2 接口IP:
s1/0: 172.16.1.2/24
f0/0: 172.16.2.1/24
PC配置:
IP: 10.1.1.1/28
GW: 10.1.1.100
R1、R2的IOS为c2600-jk8o3s-mz.122-8.T5.bin
R3 的IOS为c2600-jk9s-mz.122-15.T7.bin
步骤:
配置R1路由器设置为vpn server。
1.配置isakmp policy:
crypto isakmp policy 1
hash md5
authentication pre-share
group 2
2.配置vpn client地址池
crypto isakmp client configuration address-pool local pool192
ip local pool pool192 192.168.1.1 192.168.1.254
3.配置vpn client有关参数
crypto isakmp client configuration group vclient-group
(vclient-group就是在vpn client的连接配置中需要输入的group authentication name。)
key vclient-key
(vclient-key就是在vpn client的连接配置中需要输入的group authentication password。)
pool pool192 (client的ip地址从这里选取 )
(以上两个参数必须配置,其他参数还包括domain、dns、wins等,根据情况进行配置。)
4.配置ipsec transform-set
crypto ipsec transform-set vclient-tfs esp-des esp-md5-hmac
5.配置map模板
cry dynamic-map template-map 1
set transform-set vclient-tfs (和第四步对应)
6.配置vpnmap
cry map vpnmap 1 ipsec-isakmp dynamic template-map
(使用第五步配置的map模板 )
crypto map vpnmap isakmp authorization list vclient-group
(使用第三步配置的参数authorization)
crypto map vpnmap client configuration address respond
(响应client分配地址的请求)
7.配置静态路由
ip route 192.168.1.0 255.255.255.0 fastethernet0
配置R3路由器,设置vpn client参数
1.crypto ipsec client ezvpn vclient
(定义crypto-ezvpn name)
mode network-extension
(设置为网络扩展模式)
group vclient-group key vclient-key
(设置登录vpn server的组名与组口令)
peer 10.1.1.100
(设置vpn server的ip地址,如果启用dns,则可以用hostname)
connect auto
(设置为自动连接。如果设为手动,则必须使用cry ip client
ezvpn connect vclient (命令来启动vpn通道。)
local-address f0/0
(设置vpn通道本地地址,选用f0/0,可以保证vpn server找到它)
2.定义加密数据入口,这里为f0/1
inter f0/1
cry ip client ezvpn vclient inside
3.定义加密数据出口,这里为连接vpn server的f0/0
inter f0/0
cry ip client ezvpn vclient outside
4.设置ip dhcp服务
(cisco推荐使用dhcp来进行本地网络ip的分配。此步骤可选。)
service dhcp (启动dhcp 服务)
ip dhcp pool dhcppool (定义dhcp pool name)
network 10.2.2.1/24 (定义可分配的IP地址段)
default-router 10.2.2.1 (定义dhcp client的默认网关)
lease 1 0 0 (设置ip保留时间)
import all (如果配置了上级dhcp server,则接受其所有参数)
ip dhcp excluded-address 10.2.2.1 (将router上的地址排除)
R1的配置:
r1#
r1#sh run
Building configuration...
Current configuration : 1521 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname r1
!
ip subnet-zero
!
ip audit notify log
ip audit po max-events 100
!
crypto isakmp policy 1
hash md5
authentication pre-share
group 2
crypto isakmp client configuration address-pool local pool192
!
crypto isakmp client configuration group vclient-group
key vclient-key
pool pool192
!
crypto ipsec transform-set vclient-tfs esp-des esp-md5-hmac
!
crypto dynamic-map template-map 1
set transform-set vclient-tfs
!
crypto map vpnmap isakmp authorization list vclient-group
crypto map vpnmap client configuration address respond
crypto map vpnmap 1 ipsec-isakmp dynamic template-map
!
fax interface-type fax-mail
mta receive maximum-recipients 0
!
interface Ethernet0/0
ip address 10.1.1.100 255.255.255.0
half-duplex
crypto map vpnmap
!
interface Serial1/0
ip address 172.16.1.1 255.255.255.0
no fair-queue
!
router ospf 100
log-adjacency-changes
redistribute static
network 10.1.1.0 0.0.0.255 area 0
network 172.16.1.0 0.0.0.255 area 0
!
ip local pool pool192 192.168.1.1 192.168.1.254
ip classless
ip route 192.168.1.0 255.255.255.0 Ethernet0/0
ip http server
ip pim bidir-enable
!
call rsvp-sync
!
mgcp profile default
!
dial-peer cor custom
!
line con 0
line aux 0
line vty 0 4
login
!
end
r1#
R2的配置:
r2>en
r2#sh run
Building configuration...
Current configuration : 743 bytes
!
! Last configuration change at 09:45:04 UTC Thu Nov 4 2004
! NVRAM config last updated at 09:47:55 UTC Thu Nov 4 2004
!
version 12.3
service config
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r2
!
boot-start-marker
boot-end-marker
!
no aaa new-model
ip subnet-zero
!
ip cef
!
interface FastEthernet0
ip address 172.16.2.1 255.255.255.0
speed auto
no keepalive
!
interface Serial0
ip address 172.16.1.2 255.255.255.0
clockrate 64000
no fair-queue
!
router ospf 100
log-adjacency-changes
network 172.16.1.0 0.0.0.255 area 0
network 172.16.2.0 0.0.0.255 area 0
!
ip classless
no ip http server
!
line con 0
line aux 0
line vty 0 4
login
!
end
r2#
R3的配置:
r3#sh run
Building configuration...
Current configuration : 1391 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r3
!
logging queue-limit 100
!
ip subnet-zero
!
ip dhcp excluded-address 10.2.2.1
!
ip dhcp pool dhcppool
import all
network 10.2.2.0 255.255.255.0
default-router 10.2.2.1
!
mpls ldp logging neighbor-changes
!
crypto ipsec client ezvpn vclient
connect auto
group vclient-group key vclient-key
local-address FastEthernet0/0
mode network-extension
peer 10.1.1.100
!
no voice hpi capture buffer
no voice hpi capture destination
!
mta receive maximum-recipients 0
!
interface FastEthernet0/0
ip address 10.1.1.2 255.255.255.0
speed auto
half-duplex
crypto ipsec client ezvpn vclient
!
interface FastEthernet0/1
ip address 10.2.2.1 255.255.255.0
duplex auto
speed auto
no keepalive
crypto ipsec client ezvpn vclient inside
!
router ospf 100
log-adjacency-changes
network 10.1.1.0 0.0.0.255 area 0
network 10.2.2.0 0.0.0.255 area 0
!
router ospf 100
log-adjacency-changes
network 10.1.1.0 0.0.0.255 area 0
network 10.2.2.0 0.0.0.255 area 0
!
ip http server
no ip http secure-server
ip classless
!
call rsvp-sync
!
mgcp profile default
!
dial-peer cor custom
!
line con 0
line aux 0
line vty 0 4
login
!
!
end
r3#
测试:
1. 配置好R3上的vpn client后,自动进行vpn连接。可以通过debug cry isa、deb cry ip client ezvpn、deb cry ip等debug命令输出的信息查看过程与结果。
2. 在R1上扩展ping,source 10.1.1.100 destination 10.2.2.1,通过。
查看show cry ip sa,可以发现数据没有进行加密。
3. 在R1上扩展ping,source 172.16.1.1 destination 10.2.2.1,通过。
查看show cry ip sa,可以发现数据通过加密进行传输。
4. 在R3上扩展ping,source 10.2.2.1 destination 172.16.1.1,通过。
查看show cry ip sa,可以发现数据通过加密进行传输。
5. 在R3上扩展ping,source 10.1.1.2 destination 172.16.1.1,?通过。
查看show cry ip sa,可以发现数据不通过加密。
6. 启动pc vpn client,ping 172.16.1.1,通过。
在1720上查看show cry ip sa,可以看到数据通过加密进行传输。
7. 在pc vpn client,ping 10.2.2.1,通过。
在R1和R3上查看show cry ip sa,可以看到数据通过加密进行传输。在R1上show cry isa sa,可以看到两个vpn连接。
8. 在R3上扩展ping,source 10.2.2.1 destination 192.168.1.10(pc vpn client获得的ip),通过。查看show cry ip sa,可以发现数据通过加密进行传输。