openwrt配置strongswan对接hillstone ipsec的笔记
一、主要参考资料:
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的笔记的更多相关文章
- ipsec配置strongswan.conf和ipsec.conf
配置strongswan.conf vi /usr/local/etc/strongswan.conf # strongswan.conf - strongSwan configuration fil ...
- 架设基于StrongSwan的L2tp/IPSec VPN服务器
架设基于StrongSwan的L2tp/IPSec VPN服务器 参考: http://agit8.turbulent.ca/bwp/2011/01/setting-up-a-vpn-server-w ...
- Ubuntu下配置python完成爬虫任务(笔记一)
Ubuntu下配置python完成爬虫任务(笔记一) 目标: 作为一个.NET汪,是时候去学习一下Linux下的操作了.为此选择了python来边学习Linux,边学python,熟能生巧嘛. 前期目 ...
- [ipsec][strongswan] 使用VTI配置基于路由的ipsec
之前写的一个:[dev][ipsec] 基于路由的VPrivateN 一 我们默认用strongswan的时候基于策略的. 也就是policy. 基于策略的ipsec中, policy承担了两部分功能 ...
- 【转】CentOS上部署PPTP和L2TP over IPSec简要笔记
PPTP部署 安装 PPTP 需要 MPPE 和较高版本的 ppp ( > 2.4.3 ) 支持,不过 CentOS 5.0/RHEL 5 的 2.6.18 内核已经集成了 MPPE 和高版本的 ...
- Openwrt配置小记
手中有台Netgear WNR2000v3,一直想尝试Openwrt,于是刷机.官方最新固件的稳定版本为15.05.1,该版本自带luci,BUT,不能保存配置,上网查了很久,得出结论,是由于WNR2 ...
- IPsec学习笔记
IPsec是什么 IPsec(IP Security)是一系列为IP通信提供安全性的协议和服务的集合,工作在IP层,可以为上层协议和应用提供透明的安全服务.IPsec提供两种安全机制:认证和加密. 认 ...
- openwrt 配置rsync服务
一: rsyn简介 remote synchronize顾名思意就知道它是一款实现远程同步功能的软件,它在同步文件的同时,可以保持原来文件的权限.时间.软硬链接等附加信息. rsync是用 “rsyn ...
- 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 ...
随机推荐
- what's the RTP协议
what's the RTP RTP全名是Real-time Transport Protocol(实时传输协议).它是IETF提出的一个标准,对应的RFC文档为RFC3550(RFC1889为其过期 ...
- 【WebSocket】WebSocket快速入门
WebSocket介绍 WebSocket 是 HTML5 开始提供的一种在单个 TCP 连接上进行全双工通讯的协议. WebSocket 使得客户端和服务器之间的数据交换变得更加简单,允许服务端主动 ...
- saltstack执行state.sls耗时长的坑
一直用的 jenkins + saltstack 自动化构建发布项目,一共也就不超过20台服务器,奈何运行时间越来越慢,并且负载越来越高(这里大部分都是使用state模块),但是不用state模块效率 ...
- [AWS] Cloud Server
一元课程:AWS云计算——AWS操作指南系列课程 AWS 入门指南 1.1 Create one account 1.2 Create IAM Users Create 'group' firstly ...
- nginx配置ssl证书,启动http访问并代理到本地http端口
小白第一次使用nginx,本地环境Ubuntu 16.04.6 1.安装Nginx sudo apt install nginx 2.生成证书 (参考来源:https://segmentfault.c ...
- [LeetCode] 211. Add and Search Word - Data structure design 添加和查找单词-数据结构设计
Design a data structure that supports the following two operations: void addWord(word) bool search(w ...
- 【机器学习之二】python开发spark案例
环境 spark-1.6 python3.5 一.wordcount # -*- coding:utf-8 -*- ''' Created on 2019年5月13日 @author: Adminis ...
- TortoiseGit,git 未能顺利结束 (退出码 1)
其中一个原因是不能把Git下所有文件全部删除,一个都没有,就会报这个错误. 注:空文件夹git定义为空,不是文件.所以只有空文件夹也会报这个错误.
- 【视频开发】【计算机视觉】doppia编译之三:编译安装opencv库
这里我介绍2种方法 (1)利用别人写好的脚本编译,相对来说省力一点 上Github下载别人写好的脚本文件,网址 https://github.com/jayrambhia/Install-OpenC ...
- linux 软连接 ln -s
<pre>linux 软连接 ln -sln -s /home/ /home/ss/</pre> 按照win的说法就是创建快捷方式在/home/ss/ 文件夹里(名字就是hom ...