debian 安裝 softether VPN server
11/28/2019 5:25:45 PM
LINUX安装配置SOFTETHER VPN CLIENT(UBUNTU、树莓派)
Posted on 八月 13, 2019 by root
准备工具
- 电脑一台
- 装有Softether VPN Server的VPS服务器
- 树莓派或者装有Ubuntu的电脑
Softether VPN Client的安装配置(ubuntu、debian、树莓派)
很多时候我们在使用linux设备的时候需要访问外网,但是linux安装vpn却很麻烦。
在某些大学的校园网是按流量计费的,所以也可以用Softether来进行免流。
1.下载softether客户端程序:最新的下载地址
1
|
wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.30-9696-beta/softether-vpnclient-v4.30-9696-beta-2019.07.08-linux-arm_eabi-32bit.tar.gz
|
2.解压并安装程序:
1
2
3
4
5
6
7
|
tar zxf softether-vpnclient-v4.30-9696-beta-2019.07.08-linux-arm_eabi-32bit.tar.gz
sudo rm -rf softether-vpnclient-v4.30-9696-beta-2019.07.08-linux-arm_eabi-32bit.tar.gz
cd vpnclient/
make #安装过程用一路选择Y(yes)
|
然后执行:
1
2
3
4
5
6
7
8
9
10
11
|
cd ..
sudo mv vpnclient /usr/local
cd /usr/local/vpnclient/
chmod 600 *
chmod 700 vpncmd
chmod 700 vpnclient
|
将配置界面改成中文
1
2
3
|
sudo ./vpnclient start
sudo nano lang.config
|
将en改为cn,Ctrl+X后按下Y后回车保存
开启远程连接
1
|
/usr/local/vpnclient/vpncmd /client localhost /cmd RemoteEnable
|
Windows电脑上安装SoftEther VPN Client 远程管理工具,输入树莓派的IP地址,连接后即可添加远程VPN服务器,添加完成后连接VPN服务器。
3.配置自启文件
1
|
sudo nano /usr/local/vpnclient/dhclient_start.sh
|
1
2
3
4
5
6
7
|
sleep 10
/usr/local/vpnclient/vpncmd /client localhost /cmd AccountConnect [VPN连接名]
sleep 1
dhclient vpn_vpn
sudo ip route add [公网服务器IP] via [内网网关] dev [本地以太网接口,例如:wlan0,eth0] proto static
sudo ip route del default
sudo ip route add default via [VPN_Server 内网网关] dev vpn_vpn
|
1
|
sudo nano /etc/systemd/system/vpnclient.service
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[Unit]
Description=Softether VPN Client Service
After=network.target
[Service]
Type=forking
User=root
ExecStart=/usr/local/vpnclient/vpnclient start
ExecStop=/usr/local/vpnclient/vpnclient stop
Restart=on-abort
WorkingDirectory=/usr/local/vpnclient
ExecStartPre=/sbin/ip link set dev [本地以太网接口,例如:wlan0,eth0] promisc on
[Install]
WantedBy=multi-user.target
|
1
|
sudo nano /etc/systemd/system/dhclient.service
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[Unit]
Description=Softether VPN Client DHCP
After=vpnclient.service
[Service]
Type=oneshot
User=root
ExecStart=/bin/bash /usr/local/vpnclient/dhclient_start.sh
WorkingDirectory=/usr/local/vpnclient
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
|
4.设置开机自启
1
2
3
4
5
6
7
|
sudo chmod 0755 /etc/systemd/system/vpnclient.service
sudo chmod 0755 /etc/systemd/system/dhclient.service
sudo systemctl daemon-reload
sudo systemctl start vpnclient
sudo systemctl enable vpnclient
sudo systemctl start dhclient
sudo systemctl enable dhclient
|
5.重启