在Ubuntu VPS @ linode上设置VPN

我真的很苦恼,因为我不是一个networkingpipe理员,只有一个凡人的程序员。

Linode为您提供一个外部和内部IP,以便与linodenetworking上的其他节点一起使用。 在我的情况下,我已经configuration我的外部接口像这样:

# The loopback interface auto lo iface lo inet loopback # Configuration for eth0 and aliases # This line ensures that the interface will be brought up during boot. auto eth0 eth0:0 eth0:1 # eth0 - This is the main IP address that will be used for most outbound connec$ # The address, netmask and gateway are all necessary. iface eth0 inet static address 97.107.XXX.XX netmask 255.255.255.0 gateway 97.107.XXX.1 # eth0:1 - Private IPs have no gateway (they are not publicly routable) so all $ # specify is the address and netmask. iface eth0:1 inet static address 192.168.140.135 netmask 255.255.128.0 

在eth0之前缺less的是什么:1是我想用于我的VPN的接口eth0:0。 我必须这样做吗? 那么我把它添加到我的interfaces文件eth0和eth0:1之间

 iface eth0:0 inet static address 10.10.10.1 netmask 255.0.0.0 

所以我开始安装openvpn并生成密钥。 就我所能判断,这工作。 我遇到了openvpn服务器configuration的问题。 我希望能够从家里或在旅途中访问我的VPS的文件,也许通过它访问互联网(也许在稍后阶段,我不知道,我主要是有兴趣访问我的VPS和其文件)

其中,我有我的server.conf中的以下内容

 dev tap1 server-bridge 10.10.10.1 255.0.0.0 10.10.10.50 10.10.10.100 

它是否正确? 或者我必须在那里使用别的东西。

我为桥添加了一些iptables mumbo jumbo。

 iptables -A INPUT -i tap0 -j ACCEPT iptables -A INPUT -i br0 -j ACCEPT iptables -A FORWARD -i br0 -j ACCEPT 

它说tap0在这里甚至tho其他地方是tap1。 我从指南获取这些数字( http://www.linode.com/wiki/index.php/OpenVPN )。 我不知道这是否正确。

然后我创build了一个桥启动脚本:

  #!/bin/bash ################################# # Set up Ethernet bridge on Linux # Requires: bridge-utils ################################# # Define Bridge Interface br="br0" # Define list of TAP interfaces to be bridged, # for example tap="tap0 tap1 tap2". tap="tap1" # Define physical ethernet interface to be bridged # with TAP interface(s) above. eth="eth0:0" eth_ip="10.10.10.1" eth_netmask="255.0.0.0" eth_broadcast="10.10.10.255" for t in $tap; do openvpn --mktun --dev $t done 

再次,我不知道我在这里实际做了什么…因为我决定使用10.10.10.1我猜默认的networking掩码将是255.0.0.0。 我还添加了一个类似的桥停脚本。 无论如何,如果我想开始我的桥启动脚本我得到:

 kitsune@makemake:/etc/openvpn/# /etc/openvpn/bridge-start Thu Jun 25 21:08:36 2009 TUN/TAP device tap1 opened Thu Jun 25 21:08:36 2009 Persist state set to: ON SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address 

当我然后尝试启动openvpn 失败。

任何人都可以理解这个吗?

该wiki文章是完整的,完全的球。 除非你真的知道你为什么要使用它,否则不要使用OpenVPN桥接。 这使得所有事情都变得更难100倍。 我将从官方的OpenVPN HOWTO开始,并从那里开始。