1、VPN配置VPN配置手册Vpn Access ServerVPN 配置之一:vpn access server 网络拓扑: PC-Router-Router PC配置: IP Address:10.1.1.1/24 Default Gateway:10.1.1.254 R1接口ip: (VPN Access Server) FastEthernet 0/0:20.1.1.254/24 Serial 1/0:172.16.1.1/24 R2接口ip: (Private Network) Serial 1/0:172.16.1.2/24 FastEthernet 0/0:10.1.1.254/24
2、 2610的IOS为c2600-jk8o3s-mz.122-8.T5.bin R1步骤: 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 con
3、figuration 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 tr
4、ansform-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 v
5、pnmap client configuration address respond (响应client分配地址的请求) 说明几点: (1)vpn client使用的ip pool地址不能与Router内部网络ip地址重叠。 (2)172.16.1.0 网段模拟公网地址,10.1.1.0、20.1.1.0 网段用于内部地址,192.168.1.0 网段用于vpn通道。 R1的配置: r1# r1#sh run Building configuration. Current configuration : 1521 bytes ! version 12.2 service timestamps
6、debug uptime service timestamps log uptime no service password-encryption ! hostname r1 ! Enable Password cisco ! 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 p
7、ool192 ! crypto isakmp client configuration group vclient-group key vclient-key-cisco pool vclient-pool ! 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 m
8、ap 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 FastEthernet0/0 ip address 20.1.1.254 255.255.255.0 ! interface Serial1/0 ip address 172.16.1.1 255.255.255.0 crypto map vpn
9、map no fair-queue ! ip local pool vclient-pool 192.168.1.1 192.168.1.254 ip classless ip route 0.0.0.0 0.0.0.0 Serial1/0 no ip http server ip pim bidir-enable ! call rsvp-sync ! mgcp profile default ! dial-peer cor custom ! line con 0 login pass cisco line aux 0 line vty 0 4 login pass cisco ! end r
10、1# R2的配置: r2# r2#sh run Building configuration. Current configuration : 714 bytes ! version 12.2 service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname r2 ! Enable Password cisco ! ip subnet-zero ! call rsvp-sync ! interface FastEthernet0/0 ip address
11、 10.1.1.254 255.255.255.0 ! interface Serial1/0 ip address 172.16.1.2 255.255.255.0 clockrate 64000 ! ip classless ip route 0.0.0.0 0.0.0.0 Serial1/0 ip http server ! dial-peer cor custom ! line con 0 login pass cisco line aux 0 line vty 0 4 login pass cisco ! end r2# VPN Client 4.01的配置: 建一个connecti
12、on entry,参数配置: name:任意起一个 host:填入vpn access server的s0/0地址 172.16.1.1 group auahentication: name:vclient-group password:vclient-key-cisco 测试: (1) 在pc上运行VPN client,连接vpn access server。 (2) ipconfig/all,查看获取到的ip地址与其他参数。 (3) 在router,show cry isa sa,看连接是否成功。 (4) 从router,ping client已经获取到的ip地址,通过。 (5) 从cli
13、ent,ping r2的e0/0配置的地址172.16.2.1,通过。 (6) 查看vpn client软件的status-statistics,可以看到加密与解密的数据量。 (7) R1上show cry ip sa, 也可以查看加密与解密的数据量。 常用调试命令: show crypto isakmp sa show crypto ipsec sa clear crypto sa clear crypto isakmp debug crypto isakmp debug crypto ipsecsite to site vpn的配置(采用pre-share) 实验网络拓扑: Router-
14、Router R1接口ip: s1/0:192.168.1.1/24 f0/0:172.16.1.2/24 R2接口ip: s1/0:192.168.1.2/24 f0/0:172.16.2.1/24 2610的IOS为c2600-jk9s-mz.122-17.bin 步骤: 以R1为例进行配置 1.配置路由 2.定义加密数据的acl access 101 permit ip 172.16.1.0 0.0.0.255 172.16.2.0 0.0.0.255 3.定义isakmp policy crypto isakmp policy 1 authentication pre-share (采
15、用pre-share key进行验证) (authentication参数必须配置,其他参数如group、hash、encr、lifetime等, 如果进行配置,需要注意两个路由器上的对应参数配置必须相同。) 4.定义pre-share key crypto isakmp key pre-share-key address 192.168.1.2 (其中pre-share-key 为key,两个路由器上要一样,其中192.168.1.2为peer路由器的ip地址。 ) 5.定义transform-set crypto ipsec transform-set vpn-tfs esp-3des e
16、sp-sha-hmac (其中vpn-tfs为transform-set name,后面两项为加密传输的算法) (mode transport/tunnel tunnel为默认值,此配置可选) 6.定义crypto map entry cry map vpn-map 10 ipsec-isakmp (其中vpn-map为map name,10 是entry 号码,ipsec-isakmp表示采用isakmp进行密钥管理) match address 101 (定义进行加密传输的数据,与第二步对应) set peer 192.168.1.2 (定义peer路由器的ip) set transfor
17、m-set vpn-tfs (与第五步对应) (如果一个接口上要对应多个vpn peer,可以定义多个entry,每个entry对应一个peer) 7.将crypto map应用到接口上 inter f0 (vpn通道入口) cry map vpn-map 8.同样方法配置r2路由器。 R1的完整配置: r1#sh run Building configuration. Current configuration : 1064 bytes ! version 12.2 service timestamps debug uptime service timestamps log uptime n
18、o service password-encryption ! hostname r1 ! ip subnet-zero ! no ip domain-lookup ! crypto isakmp policy 1 authentication pre-share crypto isakmp key pre-share-key address 192.168.1.2 ! crypto ipsec transform-set vpn-tfs esp-3des esp-sha-hmac ! crypto map vpn-map 10 ipsec-isakmp set peer 192.168.1.
19、2 set transform-set vpn-tfs match address 101 ! call rsvp-sync ! interface Ethernet0/0 ip address 172.16.1.1 255.255.255.0 no keepalive half-duplex ! interface Serial1/0 ip address 192.168.1.1 255.255.255.0 ! router ospf 100 log-adjacency-changes network 172.16.1.0 0.0.0.255 area 0 network 192.168.1
20、.0 0.0.0.255 area 0 ! ip classless no ip http server ! access-list 101 permit ip 172.16.1.0 0.0.0.255 172.16.2.0 0.0.0.255 ! dial-peer cor custom ! line con 0 line aux 0 line vty 0 4 login ! end r1# R2的完整配置: r2#sh run Building configuration. Current configuration : 1103 bytes ! version 12.2 service
21、timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname r2 ! username r1 password 0 cisco ip subnet-zero ! crypto isakmp policy 1 authentication pre-share crypto isakmp key pre-share-key address 192.168.1.1 ! crypto ipsec transform-set vpn-tfs esp-3des esp-sha
22、-hmac ! crypto map vpn-map 10 ipsec-isakmp set peer 192.168.1.1 set transform-set vpn-tfs match address 101 ! call rsvp-sync ! ! interface Ethernet0/0 ip address 172.16.2.1 255.255.255.0 no keepalive half-duplex ! interface Serial1/0 ip address 192.168.1.2 255.255.255.0 clockrate 64000 crypto map vp
23、n-map ! router ospf 100 log-adjacency-changes network 172.16.2.0 0.0.0.255 area 0 network 192.168.1.0 0.0.0.255 area 0 ! ip classless no ip http server ! access-list 101 permit ip 172.16.2.0 0.0.0.255 172.16.1.0 0.0.0.255 ! dial-peer cor custom ! line con 0 line aux 0 line vty 0 4 ! End r2# 测试: (1)未
24、将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 destina
25、tion 172.16.2.1,通过。查看show cry ip sa,可以看到数据通过vpn 通道进行传输。 (4)在r2上同样进行测试。site to site vpn(采用rsa-encrypted) 实验网络拓扑: Router-Router R1接口ip: s1/0:192.168.1.1/24 f0/0:172.16.1.2/24 R2接口ip: s1/0:192.168.1.2/24 f0/0:172.16.2.1/24 2610的IOS为c2600-jk9s-mz.122-17.bin 步骤: 以R2为例进行配置 1.配置路由 2.定义加密数据的acl access 101 p
26、ermit ip 172.16.1.0 0.0.0.255 172.16.2.0 0.0.0.255 3.生成rsa key cry key generate rsa general-keys (生成General Purpose rsa Key ) 或者 cry key generate rsa usage-keys (分别生成rsa signing key和rsa encryption key) 这里 统一用general purpose key 4.复制peer router的public key到本地router中 (1)在R1上生成general purpose key (2)在R1
27、上show cry key mypubkey rsa,(复制其中的General Purpose Key ) (3)在R2上,crypto key pubkey-chain rsa (设置public key) addressed-key 10.130.23.244 (设置关联10.130.23.244ip地址的key ) key-string (定义key串 ) 粘贴从R2上复制的(General Purpose Key ) (如果第三步生成了两种key,则这里复制粘贴的,应该是Encryption Key(三个key中的第二个)(双方都要互相配置) 5.定义isakmp policy cr
28、ypto isakmp policy 1 authentication rsa-encr (采用rsa Encryption key进行验证 ) (authentication参数必须配置,其他参数如group、hash、encr、lifetime等,如果进行配置,需要注意两个路由器上的对应参数配置必须相同。) 6.定义transform-set crypto ipsec transform-set vpn-tfs esp-3des esp-sha-hmac (其中vpn-tfs为transform-set name,后面两项为加密传输的算法 ) mode transport/tunnel (
29、tunnel为默认值,此配置可选 ) 7.定义crypto map entry crypto map vpn-map 10 ipsec-isakmp (其中vpn-map为map name,10 是entry 号码,ipsec-isakmp表示采用isakmp进行密钥管理 ) match address 101 (定义进行加密传输的数据,与第二步对应 ) set peer 192.168.1.1 (定义peer路由器的ip ) set transform-set vpn-tfs (与第五步对应) (如果一个接口上要对应多个vpn peer,可以定义多个entry,每个entry对应一个peer
30、;同样,pubkey 也要对应进行设置。 8.将crypto map应用到接口上 inter S1/0 (vpn通道入口 ) crypto map vpn-map 9.同样方法配置R2路由器。 R1完整配置: r1# r1#sh run Building configuration. Current configuration : 1379 bytes ! version 12.2 service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname r1 ! ip subnet-zero
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1