美文网首页Android架构师
阿里云部署Cisco CSR1Kv实现Anyconnect SS

阿里云部署Cisco CSR1Kv实现Anyconnect SS

作者: 小岳_ | 来源:发表于2021-01-22 21:59 被阅读0次

    一、目标

    • 本篇基于前两篇:阿里云部署H3C vSR1000路由器本地Cisco与云端H3C建立GRE over IPsec
    • 阿里云部署Cisco CSR1000v路由器,并配置Anyconnect SSL VPN实现与企业内网互通;
    • 为提升安全性(避免终端拨VPN时提示安全警告),本例中为Anyconnect SSL VPN使用公网证书;
    • 为了测试,本例拓扑相对复杂,实际应用中云端部署一台路由器即可。

    二、拓扑

    image.png
    • 云端部署H3C vSR1000和Cisco CSR1000v路由器,其中vSR1000用于与企业内网旁挂的Cisco VPN路由器建立GRE over IPsec隧道;
    • vSR1000和CSR1000v建立普通GRE隧道;
    • Cisco VPN路由器、vSR1000和CSR1000v运行OSPF动态路由协议;
    • Cisco VPN路由器与核心交换机已运行EIGRP动态路由协议;
    • CSR1000v配置Anyconnect SSL VPN,实现终端通过互联网远程拨入SSL VPN,最终达到访问企业内网的目的。
    • 注意:
      1、本例部署的Cisco CSR1000v版本为:16.12.04a,此版本为当前官方推荐使用的版本;
      2、阿里云部署Cisco CSR1000v与前两篇的部署H3C vSR1000同理,但是需注意阿里云部署时CSR1000v可能会存在CSR1000v无接口现象,此处建议选不同实例多部署几次尝试,或者部署到腾讯云(腾讯云无此问题);
      3、Cisco CSR1000v默认为全功能激活,但是转发性能限制为1000kbps。CSR1000v为Smart License许可模型,如果有Cisco Smart Account,可以为CSR1000v申请Demo License。
    sv#show platform hardware throughput level 
    The current throughput level is 1000 kb/s
    

    三、配置

    3.1 Cisco CSR1000v配置

    3.1.1 为CSR1000v申请公网证书

    hostname sv
    ip domain name yuezq.com
    
    创建私钥:
    crypto key generate rsa general-keys label svprivatekey exportable modulus 2048
    % The key modulus size is 2048 bits
    % Generating 2048 bit RSA keys, keys will be exportable...
    [OK] (elapsed time was 0 seconds)
    
    配置PKI信任点:
    crypto pki trustpoint sv
     enrollment terminal
     serial-number none
     ip-address none
     subject-name cn=sv.yuezq.com,o=yue,ou=yuetech,l=Haidian,st=Beijng,c=CN
     subject-alt-name sv.yuezq.com
     revocation-check none
     rsakeypair svprivatekey
     exit
    
    • 生成CSR(证书注册请求)文件:
    csr(config)#crypto pki enroll sv
    % Start certificate enrollment .. 
    
    % The subject name in the certificate will include: cn=sv.yuezq.com,o=yue,ou=yuetech,l=Haidian,st=Beijng,c=CN
    % The subject name in the certificate will include: csr.yuezq.com
    Display Certificate Request to terminal? [yes/no]: yes 
    Certificate Request follows:
    
    MIIB5zCCAVACAQAwgYUxCzAJBgNVBAYTAkNOMQ8wDQYDVQQIEwZCZWlqbmcxEDAO
    BgNVBAcTB0hhaWRpYW4xEDAOBgNVBAsTB3l1ZXRlY2gxDDAKBgNVBAoTA3l1ZTEV
    MBMGA1UEAxMMc3YueXVlenEuY29tMRwwGgYJKoZIhvcNAQkCFg1jc3IueXVlenEu
    Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzh5WAt6M1gWdhbDQL+ZK8
    PE0P4kmMJrgWfFQ4YfKyXxKiml+Hbb0RX9UKSq7ygpiPtAByXcjt/cnXo5Fd4rFx
    arVxqpPhP9RfvMBrKbSrcQGWavhULfgS1PiIDeYEyPs3/EyeaH+aLPvWXVXbNqIv
    yMKF/gavk5DDu+SlejEHswIDAsdsdsdEwHwYJKoZIhvcNAQkOMRIwEDAOBgNVHQ8B
    Af8EBAMCBaAwDQYJKoZIhvcNAQEFBQADgYEAWriZBxwl+V9qltXNkDdhjlC36okI
    Zce2Q8t9Zz6NkbtPhE2T5krDiHyUjYOFr6GFq+7Q7RsM6jaLBUqT22V2SoBQlVxC
    uL0Hf+MSwvrERvgYs+jIRP2nM9NcyCTTpx9672j59WjZPSJhwT06wNXYU7Y3a8cA
    rmfti1KzLVYgNd4=
    
    ---End - This line not part of the certificate request---
    
    • 添加"Begin"和"End"标识之后的CSR为:
    -----BEGIN CERTIFICATE REQUEST-----
    MIIB5zCCAVACAQAwgYUxCzAJBgNVBAYTAkNOMQ8wDQYDVQQIEwZCZWlqbmcxEDAO
    BgNVBAcTB0hhaWRpYW4xEDAOBgNVBAsTB3l1ZXRlY2gxDDAKBgNVBAoTA3l1ZTEV
    MBMGA1UEAxMMc3YueXVlenEuY29tMRwwGgYJKoZIhvcNAQkCFg1jc3IueXVlenEu
    Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzh5WAt6M1gWdhbDQL+ZK8
    PE0P4kmMJrgWfFQ4YfKyXxKiml+Hbb0RX9UKSq7ygpiPtAByXcjt/cnXo5Fd4rFx
    arVxqpPhP9RfvMBrKbSrcQGWavhULfgS1PiIDeYEyPs3/EyeaH+aLPvWXVXbNqIv
    yMKF/gavk5DDu+SlejEHswIDAQABoCEwHwYJKoZIhvcNAQkOMRIwEDAOBgNVHQ8B
    Af8EBAMCBaAwDQYJKoZIhvcNAQEFBQADgYEAWriZBxwl+V9qltXNkDdhjlC36okI
    Zce2Q8t9Zz6NkbtPhE2T5krDiHyUjYOFr6GFq+7Q7RsM6jaLBUqT22V2SoBQlVxC
    uL0Hf+MSwvrERvgYs+jIRP2nM9NcyCTTpx9672j59WjZPSJhwT06wNXYU7Y3a8cA
    rmfti1KzLVYgNd4=
    -----END CERTIFICATE REQUEST-----
    
    • CSR解析验证,用于验证CSR的有效性(可利用搜索引擎搜索"CSR解析"查找CSR验证网站):


      image.png
    • 在"freessl.cn"申请证书:


      image.png
    image.png image.png image.png
    • "txt"解析添加完毕后,即可进行验证


      image.png
    • 验证通过后即可查看颁发的证书。

    • 为CSR1000v导入CA根证书:
      命令:crypto pki authenticate sv
      复制"freessl.cn"显示的CA证书,直接粘贴到CSR1000v即可,根据提示输入"quit"并敲回车实现CA根证书导入。

    • 为CSR1000v导入用户证书:
      命令:crypto pki import sv certificate
      复制"freessl.cn"显示的用户证书,直接粘贴到CSR1000v即可,根据提示输入"quit"并敲回车实现用户证书导入。

    • 查看已导入的公网证书:

    sv#show crypto  pki certificates sv
    Certificate
      Status: Available
      Certificate Serial Number (hex): 0387892EB10CF59091F3D871DDBB7F1F7E4D
      Certificate Usage: General Purpose
      Issuer: 
        cn=R3
        o=Let's Encrypt
        c=US
      Subject:
        Name: sv.yuezq.com
        cn=sv.yuezq.com
      Validity Date: 
        start date: 09:36:54 CST Jan 22 2021
        end   date: 09:36:54 CST Apr 22 2021
      Associated Trustpoints: sv 
      Storage: nvram:R3#7E4D.cer
    
    CA Certificate
      Status: Available
      Certificate Serial Number (hex): 400175048314A4C8218C84A90C16CDDF
      Certificate Usage: Signature
      Issuer: 
        cn=DST Root CA X3
        o=Digital Signature Trust Co.
      Subject: 
        cn=R3
        o=Let's Encrypt
        c=US
      CRL Distribution Points: 
        http://crl.identrust.com/DSTROOTCAX3CRL.crl
      Validity Date: 
        start date: 03:21:40 CST Oct 8 2020
        end   date: 03:21:40 CST Sep 30 2021
      Associated Trustpoints: sv 
      Storage: nvram:DSTRootCAX3#CDDFCA.cer
    
    
    • 以上即完成了公网证书的申请和导入。

    3.1.2 配置Anyconnect SSL VPN

    配置AAA,用于终端拨SSL VPN时的登录认证和授权:
    aaa new-model
    aaa authentication suppress null-username
    aaa authentication login sslvpn local
    aaa authorization network sslvpn local 
    
    关闭路由器的HTTPS服务(或修改HTTPS的服务端口),以避免与SSL VPN端口冲突:
    no ip http secure-server
    
    配置终端拨入后获取的IP地址段:
    ip local pool sslpool 10.1.2.10 10.1.2.100
    
    配置终端拨入后获取的加密访问路由(隧道分离路由),注意不要使用扩展ACL,否则隧道分离路由无法正常下发:
    ip access-list standard split_acl
     10 permit 172.16.100.0 0.0.1.255
    
    配置SSL提议:
    crypto ssl proposal sslvpn_proposal 
     protection rsa-3des-ede-sha1 rsa-rc4128-md5 rsa-aes128-sha1 rsa-aes256-sha1
    
    配置SSL授权策略(指定终端拨入后获取的IP段、掩码、隧道分离路由等信息):
    crypto ssl authorization policy sslvpn_author_policy 
     netmask 255.255.255.0
     include-local-lan
     pool sslpool
     def-domain yuezq.com
     route set access-list split_acl
    
    配置SSL策略(关联SSL提议、关联公网证书,另由于443端口未开放,此处使用4433端口):
    crypto ssl policy sslvpn_policy 
     ssl proposal sslvpn_proposal
     pki trustpoint sv sign
     ip address local 172.25.25.104 port 4433
    
    配置SSL Profile(关联SSL策略、关联认证SSL VPN用户认证&授权方案):
    crypto ssl profile sslvpn_profile 
     match policy sslvpn_policy 
     aaa authentication user-pass list sslvpn 
     aaa authorization group user-pass list sslvpn sslvpn_author_policy 
     authentication remote user-pass 
     max-users 500
     
    调用Anyconnect VPN镜像(需先把镜像复制到bootflash内):
    crypto vpn anyconnect bootflash:/anyconnect-win-4.8.01090-webdeploy-k9.pkg sequence 1
    crypto vpn anyconnect bootflash:/anyconnect-macos-4.8.01090-webdeploy-k9.pkg sequence 2
    
    创建SSL VPN用户:
    username sv1 secret xxxxx
    
    

    3.1.3 配置GRE和路由

    配置到H3C vSR1000的GRE隧道:
    interface Tunnel20
     ip address 10.101.101.2 255.255.255.252
     ip ospf network point-to-point
     tunnel source 172.25.25.104
     tunnel destination 172.25.25.88
    
    router ospf 10
     router-id 172.25.25.104
     network 10.101.101.0 0.0.0.3 area 0
    

    3.2 H3C vSR1000配置

    3.2.1 配置GRE和路由

    interface Tunnel10
     ospf network-type p2p
    
    配置到Cisco CSR1000v的GRE隧道:
    interface Tunnel20 mode gre
     ip address 10.101.101.1 255.255.255.252
     ospf network-type p2p
     source 172.25.25.88
     destination 172.25.25.104
    
    
    ospf 10 router-id 10.195.195.1
     area 0.0.0.0
      network 10.100.100.0 0.0.0.3
      network 10.101.101.0 0.0.0.3
    
     ip route-static 10.1.2.0 24 10.101.101.2
    

    3.3 Cisco VPN路由器配置

    3.3.1 配置路由

    interface Tunnel10
     ip ospf network point-to-point
    
    ip prefix-list e2o seq 5 permit 172.16.100.0/24
    ip prefix-list e2o seq 10 permit 172.16.101.0/24
    
    route-map e2o permit 10
     match ip address prefix-list e2o
    
    172.16.100.0/23已被宣告在EIGRP中,所以此处将EIGRP引入到OSPF中
    router ospf 10
     router-id 10.195.195.2
     redistribute eigrp 100 metric 80 metric-type 1 subnets route-map e2o
     network 10.100.100.0 0.0.0.3 area 0
    
    ip route 10.1.2.0 255.255.255.0 10.100.100.1
    

    3.4 核心交换机配置

    3.4.1 配置路由

    ip route 10.1.2.0 255.255.255.0 172.16.101.101
    

    四、验证

    • 查看vSR1000上OSPF邻居:
    [VSR1K]dis ospf peer
    
             OSPF Process 10 with Router ID 10.195.195.1
                   Neighbor Brief Information
    
     Area: 0.0.0.0        
     Router ID       Address         Pri Dead-Time  State             Interface
     10.195.195.2    10.100.100.2    1   38         Full/ -           Tun10
     172.25.25.104   10.101.101.2    1   34         Full/ -           Tun20
    
    • 查看vSR1000上路由表:
    [VSR1K]dis ip routing-table 
    
    Destinations : 25       Routes : 25
    
    Destination/Mask   Proto   Pre Cost        NextHop         Interface
    0.0.0.0/0          Static  60  0           172.25.25.1     GE1/0
    0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
    10.1.2.0/24        Static  60  0           10.101.101.2    Tun20
    10.100.100.0/30    Direct  0   0           10.100.100.1    Tun10
    10.100.100.0/32    Direct  0   0           10.100.100.1    Tun10
    10.100.100.1/32    Direct  0   0           127.0.0.1       InLoop0
    10.100.100.3/32    Direct  0   0           10.100.100.1    Tun10
    10.101.101.0/30    Direct  0   0           10.101.101.1    Tun20
    10.101.101.0/32    Direct  0   0           10.101.101.1    Tun20
    10.101.101.1/32    Direct  0   0           127.0.0.1       InLoop0
    10.101.101.3/32    Direct  0   0           10.101.101.1    Tun20
    10.195.195.1/32    Direct  0   0           127.0.0.1       InLoop0
    127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
    127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
    127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
    127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
    172.16.100.0/24    O_ASE1  150 1642        10.100.100.2    Tun10
    172.16.101.0/24    O_ASE1  150 1642        10.100.100.2    Tun10
    172.25.25.0/25     Direct  0   0           172.25.25.88    GE1/0
    172.25.25.0/32     Direct  0   0           172.25.25.88    GE1/0
    172.25.25.88/32    Direct  0   0           127.0.0.1       InLoop0
    172.25.25.127/32   Direct  0   0           172.25.25.88    GE1/0
    224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
    224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
    255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
    
    • 远程终端拨Anyconnect SSL VPN:


      image.png
    image.png image.png
    • 查看隧道分离路由:


      image.png
    • 查看终端获取的IP:

    c:\>ipconfig /all
    以太网适配器 以太网 2:
    
       连接特定的 DNS 后缀 . . . . . . . : yuezq.com
       描述. . . . . . . . . . . . . . . : Cisco AnyConnect Secure Mobility Client Virtual Miniport Adapter for Windows x64
       物理地址. . . . . . . . . . . . . : 00-05-9A-3C-7A-00
       DHCP 已启用 . . . . . . . . . . . : 否
       自动配置已启用. . . . . . . . . . : 是
       本地链接 IPv6 地址. . . . . . . . : fe80::474:6ab6:3ea1:1365%26(首选)
       本地链接 IPv6 地址. . . . . . . . : fe80::5b93:51c4:d999:35a5%26(首选)
       IPv4 地址 . . . . . . . . . . . . : 10.1.2.21(首选)
       子网掩码  . . . . . . . . . . . . : 255.255.255.0
       默认网关. . . . . . . . . . . . . : ::
       DHCPv6 IAID . . . . . . . . . . . : 452986266
       DHCPv6 客户端 DUID  . . . . . . . : 00-01-00-01-27-57-F5-A7-E8-6A-64-CC-95-AF
       DNS 服务器  . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       TCPIP 上的 NetBIOS  . . . . . . . : 已启用
    
    • 查看终端路由表(已删减):
    c:\>route print
    IPv4 路由表
    ===========================================================================
    活动路由:
    网络目标        网络掩码          网关       接口   跃点数
              0.0.0.0          0.0.0.0        10.87.0.1     10.87.15.117     35
         172.16.100.0    255.255.254.0         10.1.2.1        10.1.2.21      2
    
    • 访问企业内网:
    c:\>ping 172.16.100.254
    
    正在 Ping 172.16.100.254 具有 32 字节的数据:
    来自 172.16.100.254 的回复: 字节=32 时间=20ms TTL=251
    来自 172.16.100.254 的回复: 字节=32 时间=21ms TTL=251
    来自 172.16.100.254 的回复: 字节=32 时间=19ms TTL=251
    来自 172.16.100.254 的回复: 字节=32 时间=19ms TTL=251
    
    172.16.100.254 的 Ping 统计信息:
        数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
    往返行程的估计时间(以毫秒为单位):
        最短 = 19ms,最长 = 21ms,平均 = 19ms
    
    c:\>ping 172.16.101.254
    
    正在 Ping 172.16.101.254 具有 32 字节的数据:
    来自 172.16.101.254 的回复: 字节=32 时间=19ms TTL=251
    来自 172.16.101.254 的回复: 字节=32 时间=22ms TTL=251
    来自 172.16.101.254 的回复: 字节=32 时间=24ms TTL=251
    来自 172.16.101.254 的回复: 字节=32 时间=21ms TTL=251
    
    172.16.101.254 的 Ping 统计信息:
        数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
    往返行程的估计时间(以毫秒为单位):
        最短 = 19ms,最长 = 24ms,平均 = 21ms
    

    相关文章

      网友评论

        本文标题:阿里云部署Cisco CSR1Kv实现Anyconnect SS

        本文链接:https://www.haomeiwen.com/subject/uoqezktx.html