一、主要参考资料:

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. 备忘-VSCODE、apache配置

    一个像素点的光标:https://files.cnblogs.com/files/zjfree/mouse.zip VSCODE配置备忘: { "editor.fontLigatures&q ...

  2. EasyNVR网页Chrome无插件播放安防摄像机视频流是怎么做到web浏览器延时一秒内

    背景说明 由于互联网的飞速发展,传统安防摄像头的视频监控直播与互联网直播相结合是大势所趋.传统安防的直播大多在一个局域网内,在播放的客户端上也是有所限制,一般都需要OCX Web插件进行直播.对于安防 ...

  3. net ads join 和net rpc join命令的区别

    要将主机加入Active Directory(AD),请输入: #net ads加入-U administrator 输入管理员密码:Passw0rd 使用短域名 - SAMDOM 加入'M1'到dn ...

  4. Postgresql集群解决方案测试报告

    1 测试主体 本次测试的主体有3个,分别为: GreenPlum集群,下文简称为GP Postgres-XC集群,下文简称为XC Postgresql单数据库实例,下文简称为pgsql GP和XC都选 ...

  5. centos7 intall nvidia driver

    此教程是介绍于 CentOS 7 以上的 Linux 系统中安装 NVIDIA 显卡驱动和 CUDA Toolkit .此文中以 CentOS 7.4 64 bit 为例,显卡型号为 NVIDIA T ...

  6. linux线程间同步方式总结梳理

    线程间一般无需特别的手段进行通信,由于线程间能够共享数据结构,也就是一个全局变量能够被两个线程同时使用.只是要注意的是线程间须要做好同步! 使用多线程的理由: 1. 一个是和进程相比,它是一种非常&q ...

  7. 09 Spring的依赖注入

    1.依赖注入(Dependency Injection) (1)IOC的作用: 降低程序间的耦合(依赖关系)(2)依赖关系的管理: 以后都交给spring来维护 在当前类需要用到其他类的对象,由spr ...

  8. DolphinPHP(海豚框架)初步学习

    由于工作原因需要学习DolphinPHP框架,在此记录一下! 首先交代下环境,我用的是phpStudy集成环境,然后海豚框架是最新的1.4.2版本 ok,接下来我们开始学习,最基础的,是我们需要将我们 ...

  9. DjangoRestFramework学习二之序列化组件、视图组件

    本节目录 一 序列化组件 二 视图组件 三 xxx 四 xxx 五 xxx 六 xxx 七 xxx 八 xxx 一 序列化组件 首先按照restful规范咱们创建一些api接口,按照下面这些形式写吧: ...

  10. Go语言( 运算符)

    运算符用于在程序运行时执行数学或逻辑运算. 运算符 Go 语言内置的运算符有: 算术运算符 关系运算符 逻辑运算符 位运算符 赋值运算符 算数运算符 运算符 描述 + 相加 - 相减 * 相乘 / 相 ...