OpenVPN 经常断线

OpenVPN 经常断线

我的 OpenVPN 经常断线。我对这个主题不太了解,也许你可以给我指出正确的方向?这是 的尾部/var/log/messages,它包含 a<warn>和其他相关的行:

Jul 15 21:27:58 notebook NetworkManager[907]: <info> Tunnel Device: tun0
Jul 15 21:27:58 notebook NetworkManager[907]: <info> IPv4 configuration:
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   Internal Gateway: 10.8.0.65
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   Internal Address: 10.8.0.66
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   Internal Prefix: 32
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   Internal Point-to-Point Address: 10.8.0.65
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   Maximum Segment Size (MSS): 0
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   Static Route: 10.8.0.1/32   Next Hop: 10.8.0.1
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   Forbid Default Route: no
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   Internal DNS: 10.8.0.1
Jul 15 21:27:58 notebook nm-openvpn[5675]: Initialization Sequence Completed
Jul 15 21:27:58 notebook NetworkManager[907]: <info>   DNS Domain: '(none)'
Jul 15 21:27:58 notebook NetworkManager[907]: <info> No IPv6 configuration
Jul 15 21:27:59 notebook NetworkManager[907]: <info> VPN connection 'Some VPN' (IP Config Get) complete.
Jul 15 21:27:59 notebook NetworkManager[907]: <info> Policy set 'Some VPN' (tun0) as default for IPv4 routing and DNS.
Jul 15 21:27:59 notebook NetworkManager[907]: <warn> /sys/devices/virtual/net/tun0: couldn't determine device driver; ignoring...
Jul 15 21:27:59 notebook NetworkManager[907]: <info> VPN plugin state changed: started (4)
Jul 15 21:28:44 notebook NetworkManager[907]: <info> VPN plugin state changed: stopping (5)
Jul 15 21:28:44 notebook NetworkManager[907]: <info> VPN plugin state changed: stopped (6)
Jul 15 21:28:44 notebook NetworkManager[907]: <info> VPN plugin state change reason: 0
Jul 15 21:28:44 notebook avahi-daemon[910]: Withdrawing workstation service for tun0.
Jul 15 21:28:44 notebook avahi-daemon[910]: Withdrawing address record for 192.168.0.5 on em1.
Jul 15 21:28:44 notebook avahi-daemon[910]: Leaving mDNS multicast group on interface em1.IPv4 with address 192.168.0.5.
Jul 15 21:28:44 notebook avahi-daemon[910]: Interface em1.IPv4 no longer relevant for mDNS.
Jul 15 21:28:44 notebook avahi-daemon[910]: Joining mDNS multicast group on interface em1.IPv4 with address 192.168.0.5.
Jul 15 21:28:44 notebook avahi-daemon[910]: New relevant interface em1.IPv4 for mDNS.
Jul 15 21:28:44 notebook avahi-daemon[910]: Registering new address record for 192.168.0.5 on em1.IPv4.
Jul 15 21:28:44 notebook nm-openvpn[5675]: SIGTERM[hard,] received, process exiting
Jul 15 21:28:45 notebook NetworkManager[907]: <info> Policy set 'System em1' (em1) as default for IPv4 routing and DNS.
Jul 15 21:28:45 notebook NetworkManager[907]: <warn> error disconnecting VPN: Could not process the request because no VPN connection was active.
Jul 15 21:28:45 notebook NetworkManager[907]: <warn> (5) failed to find interface name for index
Jul 15 21:28:45 notebook NetworkManager[907]: nm_system_iface_flush_routes: assertion `iface != NULL' failed
Jul 15 21:28:45 notebook NetworkManager[907]: <warn> (5) failed to find interface name for index
Jul 15 21:28:49 notebook NetworkManager[907]: <info> VPN service 'openvpn' disappeared

答案1

作为解决方法,创建一个脚本来检查 openvpn 是否仍在运行:

if ! pgrep "openvpn" > /dev/null; then 
  /usr/sbin/service openvpn restart
  echo "["$(date "+%Y-%m-%d %H:%M:%S")"] openvpn restarted">> /var/log/openvpn.log
fi

并在 crontab 中详细调用聊天脚本

相关内容