Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

Bowen catalog
what a, Easy virtual private network needs to solve the problem is?
Second, how to implement Easy VPN on the router?
Third, the router configuration to achieve Easy Virtual Private Network

As the "Virtual Private Network" (see the first letter, you know what cough) is a sensitive \ sense of words, so use its Chinese name "virtual private network" in the blog post instead.

Prior written a virtual private network principles and the detailed configuration of Cisco routers IPSec ; implement IPSec virtual private networks on Cisco's ASA firewalls and routers . These two posts are used to achieve the establishment of a virtual private network between the head office and branches, so there is a lot of use cases, that is, on a business trip who want to access the corporate network resources within it? As the traveler just a single client, and it is not the same as the previous two Bowen, Bowen set up the first two virtual private network, both devices are routers or firewalls, a fixed IP address, so, can not be achieved on a business trip personnel access, this blog's purpose is to achieve a business trip can access the company's intranet resources, this technique is called - the Easy virtual private network .

First, what Easy virtual private network needs to solve the problem is?

As shown below, when the flow rate matches the flow rate of Crypto ACL communication occurs between the two routers, IPSec will trigger a virtual private network connection. In the L2L IPSec virtual private network setup process, the connection is established through two stages.

1, Phase 1 - an administrative connection

  • Administrative connection manner in which the use of negotiation.

  • Sharing key information by DH algorithm.

  • Peers authenticate each other.

Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

2, Phase 2 - establish a data connection

  • Define what traffic between peer protection.

  • Defined security protocol to protect data.

  • The definition of transmission mode.

Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
To establish a connection for remote access virtual private network will have some problems in accordance with the process described above. Remote access virtual private networks in general, one end is a hardware device, such as routers, firewalls and so on; the other end is the client devices, such as desktops, laptops and so on. Then security on the client side will be some problems. Can imagine, the company's device and the PC gateway level security management level is certainly different, not to mention many employees might need access to corporate resources from home, the computer will be added with the presence of more security risks. The entire IPSec VPN encrypted transmission is simply pre-configured pre-shared key on the device, once the key is compromised, the entire IPSec virtual private network-wide efforts will be in vain. And just consider providing IPSec tunneling through a secure mechanism, and does not introduce any mechanism to verify the username / password, so when IPSec is applied to remote virtual private network, there will be a big risk on security issues .

Another problem is that the establishment of L2L IPSec virtual private network, the two sides have a fixed IP address, so that we can have as may be specified in each other's peer crypto map configuration when will it be possible to configure crypto ACL to define which traffic will trigger connection establishment. But for remote access virtual private network, IP on the client side is not possible fixed, so if we still L2L accordance with the idea to establish a connection is not possible.

Second, how to implement Easy VPN on the router?

1, do user authentication using XAUTH

IPSec protocol initial design did not consider the issue of user authentication. So IETF (Internet Engineering Task Force, Intel-Mesh Engineering Task Department) introduced a draft --XAUTH RFC's. It is a virtual private network gateway enhancements, user names and passwords provide a way to authenticate users. Since this process is between two connection is established, it was dubbed the "stage 1.5." (On the introduction of two phases, refer to Cisco router IPSec virtual private network principles and detailed configuration , a detailed description).

Speaking user authentication will naturally involve storage of user names and passwords, there are usually two ways:

  • Stored in the internal database virtual private network gateway device.

  • On third-party equipment, such as a station AAA server storage.

2、AAA的定义(在之前的博文有过介绍,今天就简单写一下了就)

AAA是Authentication(验证)、Authorization(授权)和Accounting(统计)的缩写,提供了在网络设备上配置访问控制的基本框架。

1)验证:用户是谁?
对用户的合法性进行验证,包括用户名、密码等信息的验证。

2)授权:用户可以做什么?
在用户通过验证后,为用户指定其能够使用的服务等权限。

3)统计:用户做过什么?
在用户验证、授权成功后,记录用户的操作等信息,以便于记账、审计和报告。

实现AAA服务器主要 使用RADIUS协议和TACACS+协议。

  • RADIUS(Remote Authentication Dial In User Service,远程验证拨入用户服务)是一个全开放的标准协议,厂商或用户可以灵活地修改RADIUS。

  • TACACS+(Terminal Access Controller System,终端访问控制器访问控制系统)是Cisco设计的私有协议。基本不再使用。

3、组策略

由于与虚拟专用网网关建立连接的客户端可能会很多,所以peer的IP地址就不会固定,crypto acl也不会唯一。最好的解决办法就是让虚拟专用网网关“推送”这些策略给客户端。但是很多情况下客户端的这些策略可能是相同的,因此在远程访问虚拟专用网中引入组的概念,将这些具有相同策略的客户端划分在一个组里,在虚拟专用网网关上一次性地为一组客户端配置策略,这样在配置过程和管理过程中都将大大节省工作量。

1)地址池
可以使虚拟专用网设备像DHCP服务器一样为每个通过验证的客户端“推送”IP地址。这样,由于客户端的IP地址是虚拟专用网网关动态分配的,虚拟专用网设备自然也就知道该与哪个IP建立虚拟专用网连接。如下图所示:
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

2)DNS和网关
正像DHCP服务器一样,除了给客户端分配IP地址以外,还会分配网关和DNS,虚拟专用网网关也会给客户端推送网关和DNS,这样客户端就拥有了内网的IP、网关及DNS等必备的资源,真正成为内网的一员,如下图所示:
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

3)共享密钥
在L2L的过程中,需要根据预共享密钥演算出用于加密、身份验证、完整性验证的密钥,支持后续虚拟专用网连接的建立及数据通信。在远程访问虚拟专用网中,虚拟专用网网关需要与多组客户端“共享密钥”,因此在配置虚拟专用网网关时需要为每组客户端设置不同的共享密钥,客户端的密钥并不是虚拟专用网网关推送的,而是需要用户通过客户端软件配置在主机上,而这个过程一般是由公司的网络管理员来实现的,那么这个密钥自然是保存在客户端主机本地了,因此才有了“阶段1.5”的存在,如下图所示:
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

4)分离隧道
默认情况下,客户端与虚拟专用网网关建立隧道后,只能访问内网授权的资源,这是因为隧道会允许所有的流量,也就是说所有的流量必须经过隧道到达公司内网,自然也就不允许任何流量访问外网,但对于客户端而言,访问外网,是再正常不过的需求了,所以需要针对远程访问虚拟专用网配置ACL来分离隧道。

通过配置ACL,所有“permit”的流量都被加密传输,所有“deny”的流量都被明文传输,而加密的流量就是通过隧道访问公司内网的流量,明文的流量就是访问Internet的流量,将这个ACL应用到组策略中即可实现需求,如下图所示:
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

5)分离DNS
当客户端主机通过远程访问虚拟专用网连接到公司内网,即使隧道分离后,客户端访问Internet的web服务器时,也需要使用公司内网的DNS解析,但这不是一个合理的过程,细想一下,客户端每次访问外网的某一个域名,都需要不同地区公司内部进行DNS解析,其实是没有必要的;但如果客户端访问的是公司内网的Web服务器就需要通过内网的NDS解析。若要实现访问不同的域名使用不同的DNS,使用的最佳方案是分离DNS。如下图所示:
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

4、动态Crypto Map

因为我们无法实现在虚拟专用网设备的静态crypto map中指定客户端的地址(客户端的地址由虚拟专用网的DHCP服务分发,不是固定的),所以需要将静态crypto map中需要的参数被动态填充,使用动态crypto map 必须采用ISAKMP/IKE发起协商,而且在实现远程访问虚拟专用网的时候通常在虚拟专用网网关上同时配置静态和动态的crypto map,因为只有一台具有静态配置的设备可以发起IPSec的隧道,也正是如此,动态的crypto map很少被用于L2L(局域网to局域网)会话建立。

在实现远程访问虚拟局域网的时候,一般会先配置transform-set,因为指定传输集与peer的IP地址无关,可以将传输集直接应用到动态crypto map;由于在接口上只能配置一个crypto map,且虚拟专用网网关上必须有静态crypto map,所以需将动态crypto map 应用到静态的crypto map中,再将静态crypto map应用到接口上,这就是配置crypto map的一般思路,如下图所示:
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

三、配置路由器上实现Easy 虚拟专用网

1、网络环境如下:

Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

2、环境分析:

1)在公司网关路由器上配置虚拟专用网,客户端(出差人员)可以连接到虚拟专用网,并访问内网提供的DNS服务,使用该域名访问,内网中的DNS负责解析该域名)。
2)客户端连接到虚拟专用网后,还要实现出差员工可以访问ISP路由器的loop back 0接口(模拟Internet网)和访问R1的loop back 0接口(模拟HTTP服务)。
3)R4上要开启DHCP服务,给客户端自动下发IP地址网关及DNS。
3)自行配置正确的路由器接口及各个服务器的IP、网关、路由(服务器配置相应的网关,路由器R1只需配置接口IP及一条默认路由指向R2路由器即可,R2路由器除了接口IP以外什么都不要配置,尤其是路由表,否则可能测试不出来虚拟专用网的效果)。
4)客户端需要安装Cisco提供的客户端软件进行连接。

3、配置前准备:

1)下载客户端使用的软件,并安装在客户端,用来连接虚拟专用网(我这里提供的是windows 7的client安装包。Cisco客户端软件包

4、开始配置:

1)配置基本网络参数:

1)  R1配置如下:
R1(config)#int loo0     #开启loop back 0接口
R1(config-if)#ip add 1.1.1.1 255.255.255.0  #配置IP地址
R1(config-if)#no shutdown   #启用接口
R1(config-if)#exit
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit
R1(config)#line vty 0 4   #配置vty,允许5个终端访问
R1(config-line)#password pwd@123   #配置telnet密码
R1(config-line)#login   #保存
R1(config-line)#exit
R1(config)#enable password pwd@123  #配置全局密码 

2)  Easy配置如下:
Easy(config)#int f0/0
Easy(config-if)#ip add 192.168.10.254 255.255.255.0
Easy(config-if)#no shutdown 
Easy(config-if)#exit 
Easy(config)#int f1/0
Easy(config-if)#ip add 192.168.20.254 255.255.255.0
Easy(config-if)#no shutdown 
Easy(config-if)#exit
Easy(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.1    #配置去往ISP的路由
Easy(config)#ip route 1.1.1.0 255.255.255.0 192.168.10.1  #配置去往R1的loop back 0接口的路由

3)  ISP配置如下:
ISP(config)#int f1/0
ISP(config-if)#ip add 192.168.20.1 255.255.255.0
ISP(config-if)#no shutdown 
ISP(config-if)#exit
ISP(config)#int f0/0  
ISP(config-if)#ip add 192.168.30.1 255.255.255.0
ISP(config-if)#no shutdown 
ISP(config-if)#exit
ISP(config)#int loo0
ISP(config-if)#ip add 2.2.2.2 255.255.255.0
ISP(config-if)#no shutdown 
ISP(config-if)#exit
ISP(config)#line vty 0 4
ISP(config-line)#password pwd@123
ISP(config-line)#login
ISP(config-line)#exit
ISP(config)#enable password pwd@123

4)  R4配置如下:
R4(config)#int f0/0
R4(config-if)#ip add 192.168.30.254 255.255.255.0
R4(config-if)#no shutdown 
R4(config-if)#exit
R4(config)#int f1/0
R4(config-if)#ip add 192.168.40.254 255.255.255.0
R4(config-if)#no shutdown 
R4(config-if)#exit
R4(config)#ip route 0.0.0.0 0.0.0.0 192.168.30.1   #配置去往ISP的路由
R4(config)#ip dhcp pool LAN    #开启DHCP服务
R4(dhcp-config)#network 192.168.40.0 255.255.255.0   #下发网段
R4(dhcp-config)#default-router 192.168.40.254    #下发网关
R4(dhcp-config)#dns-server 202.96.0.10 202.96.0.20   #下发首选DNS和备份DNS
R4(config)#access-list 10 permit any    
R4(config)#ip nat inside source list 10 interface f0/0 overload 
R4(config)#int f0/0 
R4(config-if)#ip nat outside 
R4(config-if)#int f1/0
R4(config-if)#ip nat inside 
R4(config-if)#exit

Easy-虚拟专用网路由器配置如下:

Easy(config)#aaa new-model    #启用AAA验证
Easy(config)#aaa authentication login authen local group radius#配置AAA验证使用radius验证,名字为authen
Easy(config)#aaa authorization network author local group radius #配置AAA授权使用radius授权资源访问,授权的名字是author
Easy(config)#username benet password pwd@123 #创建easy虚拟专用网验证的账户名和密码
    #配置IPSec 虚拟专用网阶段一
Easy(config)#crypto isakmp policy 1  #策略序列号为“1”
Easy(config-isakmp)#encryption aes   #配置加密算法
Easy(config-isakmp)#hash sha       #hash命令指定验证过程中采用的散列算法
Easy(config-isakmp)#group 2       #配置加密共享密钥方式使用dh算法
Easy(config-isakmp)#lifetime 86400     #配置保持时间,默认保持时间为24小时
Easy(config-isakmp)#authentication pre-share    #配置共享密钥的方式为“预先共享密钥”
Easy(config-isakmp)#exit
Easy(config)#crypto ipsec transform-set bj-set esp-aes esp-sha-hmac #配置传输集地址池使用动态map调用传输集
Easy(cfg-crypto-trans)#exit
Easy(config)#ip local pool ez虚拟专用网 192.168.10.100 192.168.10.200#创建地址池,地址池的名字为ez虚拟专用网
Easy(config)#crypto dynamic-map dy-map 1#创建动态map,动态map的名字为dy-map
Easy(config-crypto-map)#reverse-route   #配置反转路由
Easy(config-crypto-map)#set transform-set bj-set  #动态map调用传输集
Easy(config-crypto-map)#exit
Easy(config)#crypto isakmp client configuration group remote虚拟专用网# 创建用户组,名字为remote虚拟专用网
Easy(config-isakmp-group)#key pwd@123 #设置访问密码
Easy(config-isakmp-group)#pool ez虚拟专用网  #用户组调用地址池
Easy(config-isakmp-group)#dns 2.2.2.2   #给虚拟专用网客户端下发dns
Easy(config-isakmp-group)#domain benet.com  #给客户端下发域名,名字为benet.com
Easy(config-isakmp-group)#exit
Easy(config)#crypto map st-map client configuration address respond #创建静态map,名字为st-map
Easy(config)#crypto map st-map client authentication list authen #静态map调用验证,验证的名字是authen
Easy(config)#crypto map st-map isakmp authorization list author#静态map调用授权,授权的名字是author
Easy(config)#crypto map st-map 1 ipsec-isakmp dynamic dy-map  #静态map调用动态map
Easy(config)#exit
Easy(config)#int f1/0   #进入接口
Easy(config-if)#crypto map st-map   #应用静态map到接口
Easy(config-if)#exit

至此Easy虚拟专用网就已经配置完成了,接下来客户端安装client软件就可以开始验证咯。

2)客户端配置如下:
将我提供的压缩包解压后安装虚拟专用网的客户端软件。
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
语言保持默认下一步就OK
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
继续下一步
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
选择安装路径,我这里就保持默认,继续下一步
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
点击next,开始安装
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
保持默认,结束就可以了
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
yes,重启电脑
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
按照图片步骤打开即可
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)

5、配置隧道分离,(桥接主机访问R1loop back0接口走隧道分离而不是走Easy-虚拟专用网)

1)  创建ACL抓取要走隧道分离的流量
Easy-***(config)#access-list 100 permit ip 1.1.1.0 0.0.0.255 any
Easy-***(config)#access-list 100 permit ip 192.168.10.0 0.0.0.255 any
2)应用隧道分离
Easy-***(config)#crypto isakmp client configuration group remote***
Easy-***(config-isakmp-group)#acl 100
Easy-***(config-isakmp-group)#exit

Verify split tunneling, while bridging the host can access the ISP's R1 and loop back 0 Interface (Note *** To disconnect reconnect it) I would simply verify, you can verify by ping command.
Easy to configure virtual private network router Cisco (staff travel to solve access the company's intranet)
So far, the effect is achieved, the client can only access the company's intranet service (R1 of loop back 0 Interface), you can also access Internet services.

---- This concludes the article, thanks for reading ----

Guess you like

Origin blog.51cto.com/14156658/2438108