通过 LAN 在两台 Ubuntu 12.04 PC 之间建立 IPSEC 隧道

通过 LAN 在两台 Ubuntu 12.04 PC 之间建立 IPSEC 隧道

我有两台 ubuntu 12.04 32 位 PC,我希望在它们之间设置 IPSec 隧道。我在两个系统中都设置了 ipsec,并且ipsec verify在两个系统上都运行良好。由于我之前没有 openswan 的经验,所以我发现很难设置配置文件。

这是片段ipsec.config

config setup
# Do not set debug options to debug configuration issues!
# plutodebug / klipsdebug = "all", "none" or a combation from below:
# "raw crypt parsing emitting control klips pfkey natt x509 dpd private"
# eg:
# plutodebug="control parsing"
# Again: only enable plutodebug or klipsdebug when asked by a developer
#
# enable to get logs per-peer
# plutoopts="--perpeerlog"
#
# Enable core dumps (might require system changes, like ulimit -C)
# This is required for abrtd to work properly
# Note: incorrect SElinux policies might prevent pluto writing the core
dumpdir=/var/run/pluto/
#
# NAT-TRAVERSAL support, see README.NAT-Traversal
nat_traversal=yes
# exclude networks used on server side by adding %v4:!a.b.c.0/24
# It seems that T-Mobile in the US and Rogers/Fido in Canada are
# using 25/8 as "private" address space on their 3G network.
# This range has not been announced via BGP (at least upto 2010-12-21)
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12,%v4:25.0.0.0/8,%v6:fd00::/8,%v6:fe80::/10
# OE is now off by default. Uncomment and change to on, to enable.
oe=off
# which IPsec stack to use. auto will try netkey, then klips then mast
protostack=netkey
# Use this to log to a file, or disable logging on embedded systems (like openwrt)
#plutostderrlog=/dev/null

# Add connections here

# sample VPN connection
# for more examples, see /etc/ipsec.d/examples/
conn linux-to-linux
#       # Left security gateway, subnet behind it, nexthop toward right.
        left=192.168.58.17
#       leftsubnet=172.16.0.0/24
#       leftnexthop=10.22.33.44
#       # Right security gateway, subnet behind it, nexthop toward left.
        right=192.168.58.32
#       rightsubnet=192.168.0.0/24
#       rightnexthop=10.101.102.103
#       # To authorize this connection, but not actually start it, 
#       # at startup, uncomment this.
        auto=start

查询:

  1. 现在,根据我的网络的给定拓扑(参见图片),上述配置对于两台 PC 是否正确。
  2. 左右电脑是否必须相同?
  3. 设置完成后,如何确认安全隧道正在工作,检查正在使用的算法和数据包内容的最佳工具是什么。
  4. 在 LAN 内部,安全 ipsec 隧道称为主机到主机隧道,站点到站点连接是指 VPN 启动时的连接,对吧?

拓扑结构

相关内容