设置 softether vpn 客户端

设置 softether vpn 客户端

我为我的 xubuntu 14.04(32 位)下载了 softether vpn 客户端,但之后我无法继续操作。

而且他们也没有 vpnclient 的安装指南(他们有服务器的安装指南)。

那么请指导我如何成功设置 softether vpnclient?

谢谢。

答案1

如何在 Linux 下设置 SoftEther VPN 客户端:通过 vpngate.net

Linux 下的客户端设置过程

  1. 从 softether.org 下载 VPN 客户端
    • 我的平台是 Debian 7 X64
  2. 在未压缩的 vpn 客户端目录中,在您的平台上编译 vpn 客户端
    • 只需输入“make”并接受所有许可协议就可以了
  3. 以 root 身份启动 vpnclient 服务
    • sudo ./vpnclient start
  4. 使用“vpncmd”(普通用户模式,不需要root权限)连接到本地vpnclient,创建本地虚拟NIC。

vpncmd

VPN Client>remoteenable
RemoteEnable command - Allow Remote Management of VPN Client Service
The command completed successfully.

VPN Client>niccreate
NicCreate command - Create New Virtual Network Adapter
Virtual Network Adapter Name: se

The command completed successfully.

VPN Client>niclist
NicList command - Get List of Virtual Network Adapters
Item                        |Value
----------------------------+-----------------------------------
Virtual Network Adapter Name|se
Status                      |Enabled
MAC Address                 |00ACDD071970
Version                     |Version 2.00 Build 9387   (English)
The command completed successfully.
  1. 前往“vpngate.net”,找到合适的 vpn 服务器

  2. 在 vpncmd 中设置一个 vpn 账户。

我在下面导出了 vpn 帐户配置文件,您可以根据需要进行定制。

VPN Client>accountimport 
AccountImport command - Import VPN Connection Setting
Import Source File Name: /home/luke/japan0.vpn

The VPN Connection Setting "japan0" was imported.
The command completed successfully.

VPN Client>accountget japan0
AccountGet command - Get Setting of VPN Connection Setting 
Item                                                 |Value
-----------------------------------------------------+------------------------
VPN Connection Setting Name                          |japan0
Destination VPN Server Host Name                     |222.228.120.128
Destination VPN Server Port Number                   |1950
Destination VPN Server Virtual Hub Name              |vpngate
Proxy Server Type                                    |Direct TCP/IP Connection
Verify Server Certificate                            |Disable
Device Name Used for Connection                      |se
Authentication Type                                  |Anonymous Authentication
User Name                                            |vpn
Number of TCP Connections to Use in VPN Communication|1
Interval between Establishing Each TCP Connection    |1
Connection Life of Each TCP Connection               |Infinite
Use Half Duplex Mode                                 |Disable
Encryption by SSL                                    |Enable
Data Compression                                     |Disable
Connect by Bridge / Router Mode                      |Disable
Connect by Monitoring Mode                           |Disable
No Adjustment for Routing Table                      |Disable
Do not Use QoS Control Function                      |Disable
The command completed successfully.

VPN Client>accountlist
AccountList command - Get List of VPN Connection Settings
Item                        |Value
----------------------------+-----------------------------------------------
VPN Connection Setting Name |japan0
Status                      |Offline
VPN Server Hostname         |222.228.120.128:1950 (Direct TCP/IP Connection)
Virtual Hub                 |vpngate
Virtual Network Adapter Name|se
The command completed successfully.

VPN Client>accountconnect japan0
AccountConnect command - Start Connection to VPN Server using VPN Connection Setting
The command completed successfully.

VPN Client>accountlist
AccountList command - Get List of VPN Connection Settings
Item                        |Value
----------------------------+-----------------------------------------------
VPN Connection Setting Name |japan0
Status                      |Connected
VPN Server Hostname         |222.228.120.128:1950 (Direct TCP/IP Connection)
Virtual Hub                 |vpngate
Virtual Network Adapter Name|se
The command completed successfully.

账户导出文件“/home/luke/japan0.vpn”:

# VPN Client VPN Connection Setting File
# 
# This file is exported using the VPN Client Manager.
# The contents of this file can be edited using a text editor.
# 
# When this file is imported to the Client Connection Manager
#  it can be used immediately.

declare root
{
 bool CheckServerCert false
 uint64 CreateDateTime 0
 uint64 LastConnectDateTime 0
 bool StartupAccount false
 uint64 UpdateDateTime 0

 declare ClientAuth
 {
  uint AuthType 0
  string Username vpn
 }
 declare ClientOption
 {
  string AccountName japan0
  uint AdditionalConnectionInterval 1
  uint ConnectionDisconnectSpan 0
  string DeviceName se
  bool DisableQoS false
  bool HalfConnection false
  bool HideNicInfoWindow false
  bool HideStatusWindow false
  string Hostname 222.228.120.128
  string HubName vpngate
  uint MaxConnection 1
  bool NoRoutingTracking false
  bool NoTls1 false
  bool NoUdpAcceleration false
  uint NumRetry 4294967295
  uint Port 1950
  uint PortUDP 0
  string ProxyName $
  byte ProxyPassword $
  uint ProxyPort 0
  uint ProxyType 0
  string ProxyUsername $
  bool RequireBridgeRoutingMode false
  bool RequireMonitorMode false
  uint RetryInterval 15
  bool UseCompress false
  bool UseEncrypt true
 }
}
  1. 现在 vpn 帐户已连接。在 Linux 下,路由表不会像在 Windows 下那样自动修改。我们需要手动调整路由信息以使 SoftEther VPN 正常工作。
    • 这里的关键点是:DHCP虚拟网卡从VPN服务器获取虚拟IP;通过原来的普通网关添加到VPN服务器的路由,并修改默认路由使用VPN网卡和VPN网关(虚拟地址)。

在调整路由表之前,请在“/etc/sysctl.conf”中启用 ip forward

net.ipv4.ip_forward=1

并通过以下方式加载:

sysctl -p 

现在我们要改变路由表。

luke@luke-debian:~$ ip addr show vpn_se
10: vpn_se: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
    link/ether 00:ac:dd:07:19:70 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::2ac:ddff:fe07:1970/64 scope link 
       valid_lft forever preferred_lft forever
luke@luke-debian:~$ sudo dhclient vpn_se
luke@luke-debian:~$ ip addr show vpn_se
10: vpn_se: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
    link/ether 00:ac:dd:07:19:70 brd ff:ff:ff:ff:ff:ff
    inet 10.211.1.63/16 brd 10.211.255.255 scope global vpn_se
    inet6 fe80::2ac:ddff:fe07:1970/64 scope link 
       valid_lft forever preferred_lft forever
luke@luke-debian:~$ ip neigh
192.168.100.1 dev wlan0 lladdr 00:1c:f0:4d:a0:a8 REACHABLE
10.211.254.254 dev vpn_se lladdr 00:ac:50:16:c8:27 REACHABLE
172.31.224.99 dev vpn_se lladdr 00:ae:df:62:34:d9 STALE

经过dhcp过程后,vpn_se从vpn server获取了一个虚拟ip地址“inet 10.211.1.63/16”,而我们从“ip neigh”中可以看到vpn server的虚拟ip地址是“10.211.254.254”。

现在我们要添加两条路由,以方便所有流量通过新建的 VPN。我的笔记本电脑通过无线“wlan0”连接到路由器 192.168.100.1。

$ ip route
default via 192.168.100.1 dev wlan0 
10.211.0.0/16 dev vpn_se  proto kernel  scope link  src 10.211.1.63 
169.254.0.0/16 dev wlan0  scope link  metric 1000 
172.16.125.0/24 dev vmnet1  proto kernel  scope link  src 172.16.125.1 
192.168.86.0/24 dev vmnet8  proto kernel  scope link  src 192.168.86.1 
192.168.100.0/24 dev wlan0  proto kernel  scope link  src 192.168.100.101 
$ sudo ip route add 222.228.120.128/32 via 192.168.100.1 dev wlan0
$ sudo ip route del default
$ sudo ip route add default via 10.211.254.254 dev vpn_se
$ ip route show
default via 10.211.254.254 dev vpn_se 
10.211.0.0/16 dev vpn_se  proto kernel  scope link  src 10.211.1.63 
192.168.100.0/24 dev wlan0  proto kernel  scope link  src 192.168.100.101 
222.228.120.128 via 192.168.100.1 dev wlan0 
luke@luke-debian:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=47 time=263 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=47 time=270 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 263.462/266.788/270.114/3.326 ms

$ ping youtube.com
PING youtube.com (74.125.235.201) 56(84) bytes of data.
64 bytes from kix01s01-in-f9.1e100.net (74.125.235.201): icmp_req=1 ttl=55 time=209 ms
64 bytes from kix01s01-in-f9.1e100.net (74.125.235.201): icmp_req=2 ttl=55 time=214 ms
64 bytes from kix01s01-in-f9.1e100.net (74.125.235.201): icmp_req=3 ttl=55 time=253 ms

64 bytes from kix01s01-in-f9.1e100.net (74.125.235.201): icmp_req=4 ttl=55 time=207 ms


luke@luke-debian:~$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  *^C

路由设置正确后,我们可以看到默认路由已指向 VPN 隧道。我们可以从“traceroute”的输出中确认这一点,因为不再能显示所有跳数。

Bash 脚本将节省大量的输入。

$ cat /etc/network/interfaces 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto-hotplug vpn_se
iface vpn_se inet dhcp



$ cat route.sh

#!/bin/bash
if [ "x$2" == "x" ]; 
then
  echo "vpn server ip missing!  ./route.sh add/del vpn_server_ip " 

else

 case "$1" in

 add)



 # restore default route to home network
 ip route delete default
 ip route add default via 192.168.100.1 dev wlan0

 # obtain ip address for vpn_se
 ifdown vpn_se
 ifup vpn_se


 # add route to vpn server

 ip route add $2/32 via 192.168.100.1 dev wlan0
 ip route delete default
 ip route add default via 10.211.254.254 dev vpn_se


 ;;

 del)


 ip route del $2/32
 ip route del default
 ip route add default via 192.168.100.1 dev wlan0
 ifdown vpn_se


 ;;

 esac


fi

答案2

我甚至遇到了同样的问题,但按照一步一步参考资料让我度过了愉快的一天。在 .vpn 文件中,需要进行一些小的更改,例如,您的帐户信息和您希望路由流量的远程服务器。从许多远程服务器中进行选择,然后通过访问此页面。为了清楚起见,添加我的自定义服务器配置。

declare root
{
 bool CheckServerCert false
 uint64 CreateDateTime 0
 uint64 LastConnectDateTime 0
 bool StartupAccount false
 uint64 UpdateDateTime 0

  declare ClientAuth
 {
  uint AuthType 1
  string Username fastssh.com-server-sp
 }
 declare ClientOption
 {
  string AccountName se-singapore
  uint AdditionalConnectionInterval 1
  uint ConnectionDisconnectSpan 0
  string DeviceName se
  bool DisableQoS false
  bool HalfConnection false
  bool HideNicInfoWindow false
  bool HideStatusWindow false
  string Hostname se-singapore.serverip.co
  string HubName FastSSH
  uint MaxConnection 1
  bool NoRoutingTracking false
  bool NoTls1 false
  bool NoUdpAcceleration false
  uint NumRetry 4294967295
  uint Port 443
  uint PortUDP 0
  string ProxyName $
  byte ProxyPassword $
  uint ProxyPort 0
  uint ProxyType 0
  string ProxyUsername $
  bool RequireBridgeRoutingMode false
  bool RequireMonitorMode false
  uint RetryInterval 15
  bool UseCompress false
  bool UseEncrypt true
 }
}

希望这可以帮助!!

相关内容