我有一台 Synology NAS,它是我的 OPENVPN 服务器。我总是在路上,我想将所有流量都路由到我家。这是我的配置和日志。
配置文件
dev tun
tls-client
remote XX.XXX.XXX.XX 1194
# The "float" tells OpenVPN to accept authenticated packets from any address,
# not only the address which was specified in the --remote option.
# This is useful when you are connecting to a peer which holds a dynamic address
# such as a dial-in user or DHCP client.
# (Please refer to the manual of OpenVPN for more information.)
#float
# If redirect-gateway is enabled, the client will redirect it's
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)
push redirect-gateway def1
route 192.168.0.25 255.255.255.0 net_gateway
route 10.8.0.0 255.255.255.0
# dhcp-option DNS: To set primary domain name server address.
# Repeat this option to set secondary DNS server addresses.
push dhcp-option DNS 10.8.0.1
push dhcp-option DNS 192.168.0.25
push dhcp-option DNS 8.8.8.8
push dhcp-option DNS 8.8.4.4
pull
proto udp
script-security 2
ca ca.crt
comp-lzo
reneg-sec 0
auth-user-pass Dontbelazy.txt
日志档案
Tue Mar 19 13:55:35 2013 OpenVPN 2.2.2 Win32-MSVC++ [SSL] [LZO2] [PKCS11] built on Dec 15 2011
Tue Mar 19 13:55:35 2013 IMPORTANT: OpenVPN's default port number is now 1194, based on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earlier used 5000 as the default port.
Tue Mar 19 13:55:35 2013 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Tue Mar 19 13:55:35 2013 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Tue Mar 19 13:55:35 2013 LZO compression initialized
Tue Mar 19 13:55:35 2013 UDPv4 link local (bound): [undef]:1194
Tue Mar 19 13:55:35 2013 UDPv4 link remote: XX.XXX.XXX.XX 1194
Tue Mar 19 13:56:35 2013 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Tue Mar 19 13:56:35 2013 TLS Error: TLS handshake failed
Tue Mar 19 13:56:35 2013 SIGUSR1[soft,tls-error] received, process restarting
答案1
尝试改变
push redirect-gateway def1
route 192.168.0.25 255.255.255.0 net_gateway
route 10.8.0.0 255.255.255.0
到
redirect-gateway
和
push dhcp-option DNS 10.8.0.1
push dhcp-option DNS 192.168.0.25
push dhcp-option DNS 8.8.8.8
push dhcp-option DNS 8.8.4.4
到
dhcp-option DNS <YOUR_ROUTER_LOCAL_IP_ADDRESS>