ipsec各种场景配置方法

场景1

192.168.28.213<192.168.28.213>[+S=C]...192.168.28.214[+S=C]===162.168.1.0/24

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #test BEGIN  
  2. conn test  
  3.     left=192.168.28.213  
  4.     right=%any            
  5.     rightsubnet=vhost:%no,%priv  
  6.     auto=add                    
  7.     authby=secret  
  8.     ike=3des-md5!  
  9.     ikelifetime=3600s  
  10.     type=transport  
  11.     esp=3des-md5!  
  12.     keylife=28800s      
  13.     pfs=no     
  14. #test END  
[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #ipsec_1 BEGIN  
  2. conn ipsec_1  
  3.     left=192.168.28.214  
  4.     leftsubnet=162.168.1.0/24  
  5.     right=192.168.28.213  
  6.     auto=add  
  7.     authby=secret  
  8.     leftid=192.168.28.214  
  9.     rightid=192.168.28.213  
  10.     ike=3des-md5  
  11.     ikelifetime=3600s  
  12.     type=transport  
  13.     esp=3des-md5  
  14.     keylife=28800s  
  15.     pfs=no  
  16. #ipsec_1 END  


场景2

192.168.28.213<192.168.28.213>[+S=C]...192.168.28.214[+S=C]

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #test BEGIN  
  2. conn test  
  3.     left=192.168.28.213  
  4.     right=%any            
  5.     rightsubnet=vhost:%no,%priv  
  6.     auto=add                    
  7.     authby=secret  
  8.     ike=3des-md5!  
  9.     ikelifetime=3600s  
  10.     type=transport  
  11.     esp=3des-md5!  
  12.     keylife=28800s      
  13.     pfs=no     
  14. #test END  
[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #ipsec_1 BEGIN  
  2. conn ipsec_1  
  3.     left=192.168.28.214  
  4.     right=192.168.28.213  
  5.     auto=add  
  6.     authby=secret  
  7.     leftid=192.168.28.214  
  8.     rightid=192.168.28.213  
  9.     ike=3des-md5  
  10.     ikelifetime=3600s  
  11.     type=transport  
  12.     esp=3des-md5  
  13.     keylife=28800s  
  14.     pfs=no  
  15. #ipsec_1 END  


场景3

网络拓扑
   192.165.1.1/24   192.168.252.8              192.168.252.5    / vlan1 192.166.1.1/24                                                                   
                  +------+                                          +------+  /
                  |  S    +===================|  C   +-X
                  +------+                                          +------+  \
                                                                                      \ vlan2 192.167.1.0/24


S端配置
[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #lantolan2 BEGIN  
  2. conn lantolan2  
  3.     left=192.168.252.8  
  4.     leftsubnet=192.165.1.0/24  
  5.     right=%any  
  6.     rightsubnet=vhost:%no,%priv  
  7.     auto=add  
  8.     authby=secret  
  9.     leftid=192.168.252.8  
  10.     rightid=192.168.252.5  
  11.     ike=des-md5-modp1024!  
  12.     ikelifetime=3600s  
  13.     type=tunnel  
  14.     esp=des-md5!  
  15.     keylife=28800s  
  16.     pfs=no  
  17. #lantolan2 END  
C端配置
[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #lantolan1 BEGIN  
  2. conn lantolan1  
  3.     left=192.168.252.5  
  4.     leftsubnet=192.166.1.0/24  
  5.     right=192.168.252.8  
  6.     rightsubnet=192.165.1.0/24  
  7.     auto=add  
  8.     authby=secret  
  9.     leftid=192.168.252.5  
  10.     rightid=192.168.252.8  
  11.     ike=des-md5-modp1024!  
  12.     ikelifetime=3600s  
  13.     type=tunnel  
  14.     esp=des-md5!  
  15.     keylife=28800s  
  16.     pfs=no  
  17. #lantolan1 END  
  18.   
  19. #test BEGIN  
  20. conn test  
  21.     left=192.168.252.5  
  22.     leftsubnet=192.167.1.0/24  
  23.     right=192.168.252.8  
  24.     rightsubnet=192.165.1.0/24  
  25.     auto=add  
  26.     authby=secret  
  27.     leftid=192.168.252.5  
  28.     rightid=192.168.252.8  
  29.     ike=des-md5-modp1024!  
  30.     ikelifetime=3600s  
  31.     type=tunnel  
  32.     esp=des-md5!  
  33.     keylife=28800s  
  34. pfs=no  
  35. #test END  


场景4

网络拓扑 (注意网络拓扑)

    10.61.2.1/24
        PC1
           \          10.61.2.254/8                                                                10.61.48.254/24
            \_________________                         
                                           \ +--------+                                            +--------+        10.61.48.1/24
                                              |   S     |====================|   C     |---------PC3
             _________________/ +--------+                                            +--------+
            /       
           /          10.61.1.254/8
         PC2
    10.61.1.1/24

注意
PC1和PC2的IP地址,如果PC1和PC2的IP地址为10.61.0.0/8这个网段就不能互通了,因为PC会建立一条这个网段到本地的一条路由

S端配置
[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. conn ss  
  2.     left=192.168.28.213  
  3.     leftsubnet=10.61.0.0/16  
  4.     right=192.168.28.214  
  5.     rightsubnet=10.61.48.0/24  
  6.     auto=add  
  7.     authby=secret  
  8.     leftid=192.168.28.213  
  9.     rightid=192.168.28.214  
  10.     ike=3des-md5!  
  11.     ikelifetime=3600s  
  12.     type=tunnel  
  13.     esp=3des-md5!  
  14.     keylife=28800s  
  15. pfs=no  
C端配置
[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. conn s1200  
  2.     left=192.168.28.214  
  3.     leftsubnet=10.61.48.0/24  
  4.     right=192.168.28.213  
  5.     rightsubnet=10.61.0.0/16  
  6.     auto=add  
  7.     authby=secret  
  8.     leftid=192.168.28.214  
  9.     rightid=192.168.28.213  
  10.     ike=3des-md5  
  11.     ikelifetime=3600s  
  12.     type=tunnel  
  13.     esp=3des-md5  
  14.     keylife=28800s  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值