前几天买了vpn,但是下载android代码的时候,总是不定期断开。到网上查找,发现有一篇文章写了如何在ubuntu上完成vpn 自动连接的问题。
连接地址:http://www.linuxdiyf.com/linux/17230.html
#!/bin/bash
user=scue # TODO: 替换用户名
vpnuuid=b8a9ec50-8bec-4d53-8c8e-0ba8db19ae50 # TODO: 替换UUID
while true
do
if [[ "$(nmcli con status|grep $vpnuuid)" == "" ]]; then
echo "Disconnected, trying to reconnect..."
sleep 1s
su $user -c "nmcli con up uuid $vpnuuid"
else
echo "Already connected !"
fi
sleep 10
done
但是会出现Error: Connection activation failed: no valid VPN secrets 问题
解决措施:
Solution mentioned there is to open file /etc/NetworkManager/system-connections/ConnectionName and set the
password-flags=0
and add the below lines to the file
[vpn-secrets]
password=YourPassword
Then restart network manager to pick up the change:
sudo restart network-manager
解决该问题。
linux发行版本配置VPN登录华大校网:http://www.linuxdiyf.com/linux/17098.html
Ubuntu终端下连接vpn:http://www.linuxdiyf.com/linux/14311.html
Ubuntu 14.04配置VPN:http://www.linuxdiyf.com/linux/14718.html
Ubuntu 14.04升级后VPN无法连接的问题:http://www.linuxdiyf.com/linux/14584.html
Ubuntu VPN连接设置:http://www.linuxdiyf.com/linux/13665.html