<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Ipsec-Vpn on Lucien's Blog</title><link>https://www.lucien116.com/tags/ipsec-vpn/</link><description>Recent content in Ipsec-Vpn on Lucien's Blog</description><generator>Hugo</generator><language>zh-Hans</language><lastBuildDate>Sat, 03 Sep 2016 21:12:13 +0000</lastBuildDate><atom:link href="https://www.lucien116.com/tags/ipsec-vpn/feed.xml" rel="self" type="application/rss+xml"/><item><title>使用Strongswan架设Ipsec VPN</title><link>https://www.lucien116.com/archives/106/</link><pubDate>Sat, 03 Sep 2016 21:12:13 +0000</pubDate><guid isPermaLink="false">http://www.lucien116.com/?p=106</guid><description>&lt;p&gt;本教学介绍了如何使用 Strongswan 5.0.x 在 openSUSE 12.3+ 服务器上架设支持 ikev1/ikev2 的 Ipsec VPN。适用于 openSUSE、iOS、Android、Windows 和其它 Linux。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt; Strongswan 5 即现在的主力支持版本和 Strongswan 4 的 ipsec.conf 有很大的不同（作废了很多选项），请保证您的版本为 5.0.4+ 本教学才有参考价值。因此请不要往 Debian 这些软件包版本旧的系统上套，同样 openSUSE 用户也不要拿 Debian 的来套。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt; 本文的例子仅以最常见的 VPS/客户机模式为例，假设客户机使用图形客户端，因此并不涉及客户端文本配置的内容。其中的原理和服务器端配置可用于其它用途比如服务器到服务器（Site to Site）的连接，但这种连接的客户端文本配置部分需要领会原理自己写。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt; 本文只适用于有 VPS 的爱好者使用，并不提供已建立好的 demo 供测试，但保证文中出现的配置如无意外如上游改选项，实际中都是能够使用的。因此并不可用于「免费 VPN」这样的话题，如何优惠购买 VPS 请到我们的论坛 &lt;a href="https://forum.suse.org.cn/"&gt;forum.suse.org.cn&lt;/a&gt;。本文也不讨论如何进行后台计费，但提供了计费软件的名称供 VPN 服务商参考，因此只适用于小团体的共用。如果小群体产生流量纠纷而需区分账户，那解散才是治本的方法，其它都只能治标。&lt;/p&gt;
&lt;h2 id="目录"&gt;目录&lt;/h2&gt;
&lt;p&gt;[ &lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#"&gt;隐藏&lt;/a&gt;]&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E4.BB.80.E4.B9.88.E6.98.AF_IPsec.EF.BC.9F"&gt;1什么是 IPsec？&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E8.AE.BE.E5.A4.87.2F.E6.93.8D.E4.BD.9C.E7.B3.BB.E7.BB.9F.E8.A7.84.E6.A0.BC"&gt;2设备/操作系统规格&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Linux"&gt;2.1Linux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Android"&gt;2.2Android&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#iOS.2FMac_OS_X"&gt;2.3iOS/Mac OS X&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Windows"&gt;2.4Windows&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E5.AE.89.E8.A3.85_Srongswan"&gt;3安装 Srongswan&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E7.94.9F.E6.88.90.E8.AF.81.E4.B9.A6.EF.BC.88.E5.8F.AF.E9.80.89.EF.BC.89"&gt;4生成证书（可选）&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E7.94.9F.E6.88.90_CA_.E8.AF.81.E4.B9.A6"&gt;4.1生成 CA 证书&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E7.94.9F.E6.88.90.E6.9C.8D.E5.8A.A1.E5.99.A8.E8.AF.81.E4.B9.A6"&gt;4.2生成服务器证书&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E7.94.9F.E6.88.90.E5.AE.A2.E6.88.B7.E7.AB.AF.E8.AF.81.E4.B9.A6"&gt;4.3生成客户端证书&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E7.94.9F.E6.88.90_pkcs12_.E8.AF.81.E4.B9.A6.EF.BC.88.E5.8F.AF.E9.80.89.EF.BC.89"&gt;4.4生成 pkcs12 证书（可选）&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E5.AE.89.E8.A3.85.E8.AF.81.E4.B9.A6"&gt;5安装证书&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E9.85.8D.E7.BD.AE_Strongswan"&gt;6配置 Strongswan&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#ipsec.conf"&gt;6.1ipsec.conf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#ipsec.secrets"&gt;6.2ipsec.secrets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#strongswan.conf"&gt;6.3strongswan.conf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E5.90.AF.E5.8A.A8_Strongswan"&gt;7启动 Strongswan&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E9.85.8D.E7.BD.AE_Iptables_.E8.BD.AC.E5.8F.91"&gt;8配置 Iptables 转发&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#openSUSE_.E5.AE.A2.E6.88.B7.E7.AB.AF.E9.85.8D.E7.BD.AE"&gt;9openSUSE 客户端配置&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E5.85.B6.E5.AE.83.E5.AE.A2.E6.88.B7.E7.AB.AF.E9.85.8D.E7.BD.AE"&gt;10其它客户端配置&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E5.85.B6.E5.AE.83_Linux"&gt;10.1其它 Linux&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Chakra_Linux"&gt;10.1.1Chakra Linux&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#iOS"&gt;10.2iOS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Android_2"&gt;10.3Android&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#IPSec_Xauth_PSK"&gt;10.3.1IPSec Xauth PSK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.22strongSwan_VPN_Client.22_for_Android_4.0_.28ICS.29.2B"&gt;10.3.2&amp;quot;strongSwan VPN Client&amp;quot; for Android 4.0 (ICS)+&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Windows_XP.2FVista"&gt;10.4Windows XP/Vista&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E4.BD.BF.E7.94.A8_Shrew_Soft_VPN_Client"&gt;10.4.1使用 Shrew Soft VPN Client&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Windows_7.2B"&gt;10.5Windows 7+&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E8.B0.83.E8.AF.95"&gt;11调试&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E6.97.A5.E5.BF.97.E9.98.85.E8.AF.BB.E6.8A.80.E5.B7.A7"&gt;11.1日志阅读技巧&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.AB.AF.E8.B0.83.E8.AF.95"&gt;11.2服务器端调试&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Linux_.E8.B0.83.E8.AF.95"&gt;11.3Linux 调试&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#iOS_.E8.B0.83.E8.AF.95"&gt;11.4iOS 调试&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Android_.E8.B0.83.E8.AF.95"&gt;11.5Android 调试&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#Windows_.E8.B0.83.E8.AF.95"&gt;11.6Windows 调试&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E6.89.A9.E5.B1.95.E9.98.85.E8.AF.BB"&gt;12扩展阅读&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E8.AE.A1.E8.B4.B9.E8.BD.AF.E4.BB.B6"&gt;12.1计费软件&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E5.8F.82.E8.80.83.E6.96.87.E7.8C.AE"&gt;13参考文献&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zh.opensuse.org/index.php?title=SDB:Setup_Ipsec_VPN_with_Strongswan&amp;amp;variant=zh#.E4.BD.9C.E8.80.85"&gt;14作者&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="什么是-ipsec"&gt;什么是 IPsec？&lt;/h2&gt;
&lt;p&gt;IPsec 是 &lt;a href="http://zh.opensuse.org/SDB:VPN_%E9%85%8D%E7%BD%AE" title="SDB:VPN 配置"&gt;虚拟私密网络（VPN）&lt;/a&gt; 的一种，用于在服务器和客户端之间建立加密隧道并传输敏感数据之用。它由两个阶段组成，第一阶段（Phrase 1, ph1），交换金钥建立连接，使用互联网金钥交换（ike）协议; 第二阶段（Phrase 2, ph2），连接建立后对数据进行加密传输，使用封装安全载荷（esp）协议。参考： &lt;a href="http://zh.wikipedia.org/wiki/IPsec"&gt;维基百科 IPsec 词条&lt;/a&gt;。&lt;/p&gt;</description></item></channel></rss>