一、主要参考资料:

https://openwrt.org/docs/guide-user/services/vpn/ipsec/strongswan/roadwarrior

https://openwrt.org/docs/guide-user/services/vpn/ipsec/strongswan/basic

https://openwrt.org/docs/guide-user/services/vpn/ipsec/strongswan/site2site

https://openwrt.org/docs/guide-user/services/vpn/ipsec/strongswan/basics

https://oldwiki.archive.openwrt.org/inbox/strongswan.howto

https://www.xiaocan.me/linux-strongswan-cilent/

https://wiki.strongswan.org/projects/strongswan/wiki/ConnSection

https://www.strongswan.org/testing/testresults/ikev1/net2net-psk/

https://wiki.strongswan.org/issues/2071

http://blog.sina.com.cn/s/blog_517c21c00102wvij.html

二、具体笔记

1、安装strongswan:

opkg update
opkg install strongswan-ipsec strongswan-mod-kernel-libipsec kmod-tun

2、修改/tmp/ipsec/ipsec.conf

root@OpenWrt:/tmp/ipsec# cat ipsec.conf
# generated by /etc/init.d/ipsec
version 2 conn dmz
left=%any
right=111.111.111.111 #主端的公网IP地址
leftsubnet=192.168.23.0/24 #本地LAN端的IP地址段
ikelifetime=3h
lifetime=1h
margintime=9m
keyingtries=3
dpdaction=none
dpddelay=30s
leftauth=psk
rightauth=psk
rightsubnet=192.168.10.0/24 #主端的内网IP地址段
auto=route #这个参数定义IPSEC隧道的启动方式,可选add\route\start
leftid=IPSEC-TEST #这个ID根据主端的IPSEC配置来匹配
keyexchange=ikev1
type=tunnel
esp=3des-md5-modp1024 #IPSEC第二阶段的协商加密协议,需与主端匹配,注意dh2对应是modp1024的写法,其它dh组对应值查看上面资料
ike=3des-md5-modp1024 #IPSEC第一阶段的协商加密协议,需与主商匹配
forceencaps = yes #据说是udp包的封装,yes后可以适配更多的网关转发,需视情况yes/no

2、修改/etc/firewall.user

iptables -I INPUT  -m policy --dir in --pol ipsec --proto esp -j ACCEPT
iptables -I FORWARD -m policy --dir in --pol ipsec --proto esp -j ACCEPT
iptables -I FORWARD -m policy --dir out --pol ipsec --proto esp -j ACCEPT
iptables -I OUTPUT -m policy --dir out --pol ipsec --proto esp -j ACCEPT

3、/etc/config/ipsec(无用的,可以无视之)

config 'ipsec'
list listen ''
option 'debug' '0'
option 'interface' 'eth0.3' config 'remote' 'aaa'
option 'enabled' '1'
option 'gateway' '1.1.1.1'
option 'pre_shared_key' 'aaaaaaaaaa'
option 'exchange_mode' 'main'
option 'authentication_method' 'psk'
option 'local_identifier' 'IPSEC-TEST-1'
list 'p1_proposal' 'pre_g2_des_sha1' list 'tunnel' 'aaa_dmz'
list 'tunnel' 'aaa_lan' config 'p1_proposal' 'pre_g2_des_sha1'
option 'encryption_algorithm' 'des'
option 'hash_algorithm' 'sha1'
option 'dh_group' '2' config 'tunnel' 'aaa_lan'
option 'local_subnet' '192.168.23.0/24'
option 'remote_subnet' '192.168.10.0/24'
option 'p2_proposal' 'g2_des_sha1'
option 'keyexchange' 'ikev1' config 'tunnel' 'aaa_dmz'
option 'local_subnet' '192.168.23.0/24'
option 'remote_subnet' '192.168.15.0/24'
option 'p2_proposal' 'g2_des_sha1'
option 'keyexchange' 'ikev1' config 'p2_proposal' 'g2_des_sha1'
option 'pfs_group' '2'
option 'encryption_algorithm' 'des'
option 'authentication_algorithm' 'sha1'

4、手动启动命令

/usr/sbin/ipsec start      #启动IPSEC进程
/usr/sbin/ipsec up dmz #手动启动dmz隧道(当上面的auto=add或route时)
/usr/sbin/ipsec statusall #查看ipsec的配置及运行状态等 ifconfig ipsec0 #查看隧道打通后是否产生ipsec0这个虚拟网卡

5、添加路由:

route add -net 192.168.10.0/24 dev ipsec0

6、最后发现:

hillstone的垃圾只可以一个连接,当第二个IPSEC连上去会把第一个IPSEC踢掉!!!!!!

openwrt配置strongswan对接hillstone ipsec的笔记的更多相关文章

  1. ipsec配置strongswan.conf和ipsec.conf

    配置strongswan.conf vi /usr/local/etc/strongswan.conf # strongswan.conf - strongSwan configuration fil ...

  2. 架设基于StrongSwan的L2tp/IPSec VPN服务器

    架设基于StrongSwan的L2tp/IPSec VPN服务器 参考: http://agit8.turbulent.ca/bwp/2011/01/setting-up-a-vpn-server-w ...

  3. Ubuntu下配置python完成爬虫任务(笔记一)

    Ubuntu下配置python完成爬虫任务(笔记一) 目标: 作为一个.NET汪,是时候去学习一下Linux下的操作了.为此选择了python来边学习Linux,边学python,熟能生巧嘛. 前期目 ...

  4. [ipsec][strongswan] 使用VTI配置基于路由的ipsec

    之前写的一个:[dev][ipsec] 基于路由的VPrivateN 一 我们默认用strongswan的时候基于策略的. 也就是policy. 基于策略的ipsec中, policy承担了两部分功能 ...

  5. 【转】CentOS上部署PPTP和L2TP over IPSec简要笔记

    PPTP部署 安装 PPTP 需要 MPPE 和较高版本的 ppp ( > 2.4.3 ) 支持,不过 CentOS 5.0/RHEL 5 的 2.6.18 内核已经集成了 MPPE 和高版本的 ...

  6. Openwrt配置小记

    手中有台Netgear WNR2000v3,一直想尝试Openwrt,于是刷机.官方最新固件的稳定版本为15.05.1,该版本自带luci,BUT,不能保存配置,上网查了很久,得出结论,是由于WNR2 ...

  7. IPsec学习笔记

    IPsec是什么 IPsec(IP Security)是一系列为IP通信提供安全性的协议和服务的集合,工作在IP层,可以为上层协议和应用提供透明的安全服务.IPsec提供两种安全机制:认证和加密. 认 ...

  8. openwrt 配置rsync服务

    一: rsyn简介 remote synchronize顾名思意就知道它是一款实现远程同步功能的软件,它在同步文件的同时,可以保持原来文件的权限.时间.软硬链接等附加信息. rsync是用 “rsyn ...

  9. ASP.NET MVC 学习笔记-7.自定义配置信息 ASP.NET MVC 学习笔记-6.异步控制器 ASP.NET MVC 学习笔记-5.Controller与View的数据传递 ASP.NET MVC 学习笔记-4.ASP.NET MVC中Ajax的应用 ASP.NET MVC 学习笔记-3.面向对象设计原则

    ASP.NET MVC 学习笔记-7.自定义配置信息   ASP.NET程序中的web.config文件中,在appSettings这个配置节中能够保存一些配置,比如, 1 <appSettin ...

随机推荐

  1. LD SCore计算基因多效性、遗传度、遗传相关性(the LD Score regression intercept, heritability and genetic correlation)

    这篇文章是对之前啊啊救救我,为何我的QQ图那么飘(全基因组关联分析)这篇文章的一个补坑. LD SCore除了查看显著SNP位点对表型是否为基因多效性外,还额外补充了怎么计算表型的遗传度和遗传相关性. ...

  2. Swift编码总结8

    1.判断当前控制器是否在显示: // 判断当前控制器是否在显示 func isCurrentViewControllerVisible() -> Bool { return (self.isVi ...

  3. 使用 Fiddler 代理调试本地手机页面

    文件下载:http://files.cnblogs.com/files/dtdxrk/fiddler4_4.6.2.0_setup.rar 从事前端开发的同学一定对 Fiddler 不陌生,它是一个非 ...

  4. [LeetCode] 79. Word Search 单词搜索

    Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from l ...

  5. [LeetCode] 637. Average of Levels in Binary Tree 二叉树的层平均值

    Given a non-empty binary tree, return the average value of the nodes on each level in the form of an ...

  6. Consul服务告警之Watch机制

    熔断保护在Consul和Ocelot中都有实现,意思就是当一个服务不正常时(比如我们的一个服务实例挂了,Consul的健康检查机制检测到了),应该给系统维护人员给以告警.在Consul中,服务告警也是 ...

  7. C/c++语言开源项目总结

    值得学习的C语言开源项目 -1. Webbench Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性 ...

  8. Locust性能测试_百度案例

    一.安装: 1.Locust在PyPI上可用,可以通过pip或easy_install安装:pip install locustio                2.查看Locust可用选项:loc ...

  9. 使用lxml解析HTML代码

    做个参考,转自:https://blog.csdn.net/qq_42281053/article/details/80658018

  10. DevOps 什么是 CI/CD?

    CI/CD 是一种通过在应用开发阶段引入自动化来频繁向客户交付应用的方法.CI/CD 的核心概念是持续集成.持续交付和持续部署.作为一个面向开发和运营团队的解决方案,CI/CD 主要针对在集成新代码时 ...