第一步: IPsec对接
set security ike proposal TO-SZHP description TO-SZHP
set security ike proposal TO-SZHP authentication-method pre-shared-keys
set security ike proposal TO-SZHP dh-group group2
set security ike proposal TO-SZHP authentication-algorithm sha1
set security ike proposal TO-SZHP encryption-algorithm 3des-cbc
set security ike proposal TO-SZHP lifetime-seconds 28800
set security ike policy TO-SZHP mode main
set security ike policy TO-SZHP description TO-SZHP
set security ike policy TO-SZHP proposals TO-SZHP
set security ike policy TO-SZHP pre-shared-key ascii-text "$9$pl/BBhreK8db2EcvLNboaFn/"
set security ike gateway TO-SZHP ike-policy TO-SZHP
set security ike gateway TO-SZHP address 121.15.213.x #这里是对端深圳公网地址
set security ike gateway TO-SZHP dead-peer-detection always-send
set security ike gateway TO-SZHP dead-peer-detection interval 10
set security ike gateway TO-SZHP dead-peer-detection threshold 5
set security ike gateway TO-SZHP no-nat-traversal
set security ike gateway TO-SZHP local-identity inet 183.63.36.x #这里是本端惠州公网地址
set security ike gateway TO-SZHP external-interface ge-0/0/2.0
set security ike gateway TO-SZHP version v1-only
第二阶段
set security ipsec policy TO-SZHP2 description TO-SZHP
set security ipsec policy TO-SZHP2 proposal-set standard #第二阶段用了“采用标准的协议,jun自定义没有某公司对于的协议”
下面是“取流”
set security ipsec vpn TOSZHP bind-interface st0.0
set security ipsec vpn TOSZHP ike gateway TO-SZHP
set security ipsec vpn TOSZHP ike proxy-identity local 100.100.100.0/24 #本段ip sec的私网逻辑隧道地址段
set security ipsec vpn TOSZHP ike proxy-identity remote 200.200.200.0/24 #对段ip sec的私网逻辑隧道地址段
set security ipsec vpn TOSZHP ike ipsec-policy TO-SZHP2
set security ipsec vpn TOSZHP establish-tunnels immediately
放行安全区域
set security zones security-zone VPN interfaces st0.0 host-inbound-traffic system-services all
set security zones security-zone VPN interfaces st0.0 host-inbound-traffic protocols all
第二步: 设置GRE隧道(利用回环接口IP进行IP封装)
设置GRE隧道接口(源目,接口地址)
set interfaces gr-0/0/0 unit 0 tunnel source 100.100.100.x #本段ip sec的私网逻辑隧道地址
set interfaces gr-0/0/0 unit 0 tunnel destination 200.200.200.x #对段ip sec的私网隧道逻辑地址
set interfaces gr-0/0/0 unit 0 family inet address 172.16.10.2/24 #gre隧道私网地址,宣告ospf路由用
set interfaces lo0 unit 0 family inet address 100.100.100.x/24 #本段ip sec的私网逻辑隧道地址
设置GRE封装流量的路由指向IPSEC隧道接口
set routing-options static route 200.200.200.0/24 next-hop st0.0 #对段ip sec的私网隧道地址策略路由
设置安全区域放行
set security zones security-zone VPN interfaces lo0.0 host-inbound-traffic system-services all
set security zones security-zone VPN interfaces lo0.0 host-inbound-traffic protocols all
set security zones security-zone VPN interfaces gr-0/0/0.0 host-inbound-traffic system-services all
set security zones security-zone VPN interfaces gr-0/0/0.0 host-inbound-traffic protocols all
第三步:发布OSPF路由
set protocols ospf area 0.0.0.0 interface gr-0/0/0.0 metric 3 #宣告ospf路由在子接口,并修改开销
先在vlan中配置号逻辑地址。
ipsec 配置
取流
ike配置
某公司这里ipsec vpn sa超时时间必须要写3600S,(某公司使用过默认的28800秒,惠州端也配置了28800S,但是1小时候vpn会断,又重连,查看抓包分析数据包是jun防火墙SA更新导致,客户是生产环境,很敏感,排查了一天,不停测试修改协议)最终,测试对端jun防火墙第二阶段使用默认的协议“standard”来对接某公司,这里的sa时间默认是3600s ,不能修改时间。最后发现隧道正常,不会再出现1小时断开的情况。(PS:第二阶段jun防火墙采用过自定义修改算法,但是某公司没有对应协议加密算法)。
此时ip sec vpn隧道建立起来,两端私网逻辑地址能正常通信。
科普一个知识,GRE隧道如果单单在公网跑,他是明文的,可以被第三方直接获取,监听,很不安全。
这里咱们开始配置GRE隧道,目的是:配置gre隧道 嵌入到ipsec vpn中。
接口宣告:宣告gre隧道的私网地址172.16.10.0/24
宣告完路由,接口会自动出现gre隧道 tunnel1 的路由配置,点击修改位开销3即可。
最后一步验证路由,查看路由,是否有去对端的私网地址的vpntun路由。下一跳是到100.100.100.0的逻辑tunnel1的隧道口出去,从而访问真正的惠州私网地址“