我有一个设置,其中 PFsense 将 9049 转发到此 openVPN VM。(我正在进行其他端口转发,外部可以访问它们)。尝试实施第 2 层 Tap 模式,而不是第 3 层 Tun 模式。
[服务器配置文件]
port 9049
proto udp
dev tap
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
tls-server
tls-auth ta.key 0
dh /etc/openvpn/dh2048.pem
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 84.200.69.80"
push "dhcp-option DNS 8.8.8.8"
client-to-client
keepalive 15 60
user nobody
group nobody
persist-key
persist-tun
server 10.8.0.0 255.255.255.0
status openvpn-status.log
log-append openvpn.log
verb 3
[服务器日志]
Sun Apr 30 22:53:28 2017 library versions: OpenSSL 1.0.1e-fips 11 Feb 2013, LZO 2.06
Sun Apr 30 22:53:28 2017 Diffie-Hellman initialized with 2048 bit key
Sun Apr 30 22:53:28 2017 Failed to extract curve from certificate (UNDEF), using secp384r1 instead.
Sun Apr 30 22:53:28 2017 ECDH curve secp384r1 added
Sun Apr 30 22:53:28 2017 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Sun Apr 30 22:53:28 2017 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Sun Apr 30 22:53:28 2017 TUN/TAP device tap0 opened
Sun Apr 30 22:53:28 2017 TUN/TAP TX queue length set to 100
Sun Apr 30 22:53:28 2017 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Sun Apr 30 22:53:28 2017 /sbin/ip link set dev tap0 up mtu 1500
Sun Apr 30 22:53:28 2017 /sbin/ip addr add dev tap0 10.8.0.1/24 broadcast 10.8.0.255
Sun Apr 30 22:53:28 2017 Could not determine IPv4/IPv6 protocol. Using AF_INET
Sun Apr 30 22:53:28 2017 Socket Buffers: R=[212992->212992] S=[212992->212992]
Sun Apr 30 22:53:28 2017 UDPv4 link local (bound): [AF_INET][undef]:2443
Sun Apr 30 22:53:28 2017 UDPv4 link remote: [AF_UNSPEC]
Sun Apr 30 22:53:28 2017 GID set to nobody
Sun Apr 30 22:53:28 2017 UID set to nobody
Sun Apr 30 22:53:28 2017 MULTI: multi_init called, r=256 v=256
Sun Apr 30 22:53:28 2017 IFCONFIG POOL: base=10.8.0.2 size=253, ipv6=0
Sun Apr 30 22:53:28 2017 Initialization Sequence Completed
[root@openvpn openvpn]#
[港口]
[root@openvpn openvpn]# netstat -tulpn | grep :9049
udp 0 0 0.0.0.0:9049 0.0.0.0:* 3204/openvpn
[客户端.ovpn]
client
dev tap
proto udp
remote 1.2.3.4 9049 udp
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo
verb 3
ca ca.crt
cert client.crt
key client.key
tls-auth ta.key 1
tls-client
remote-cert-tls server
route-method exe
route-delay 2
[客户端日志]
Sun Apr 30 23:03:48 2017 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Sun Apr 30 23:03:48 2017 TLS Error: TLS handshake failed
Sun Apr 30 23:03:48 2017 SIGUSR1[soft,tls-error] received, process restarting
Sun Apr 30 23:03:48 2017 MANAGEMENT: >STATE:1493618628,RECONNECTING,tls-error,,,,,
Sun Apr 30 23:03:48 2017 Restart pause, 5 second(s)
Sun Apr 30 23:03:53 2017 MANAGEMENT: >STATE:1493618633,RESOLVE,,,,,,
Sun Apr 30 23:03:53 2017 TCP/UDP: Preserving recently used remote address: [AF_INET]1.2.3.4:9049
Sun Apr 30 23:03:53 2017 Socket Buffers: R=[65536->65536] S=[65536->65536]
Sun Apr 30 23:03:53 2017 UDP link local: (not bound)
Sun Apr 30 23:03:53 2017 UDP link remote: [AF_INET]1.2.3.4:9049
Sun Apr 30 23:03:53 2017 MANAGEMENT: >STATE:1493618633,WAIT,,,,,,
Sun Apr 30 23:04:42 2017 SIGTERM[hard,] received, process exiting
Sun Apr 30 23:04:42 2017 MANAGEMENT: >STATE:1493618682,EXITING,SIGTERM,,,,,
答案1
我遇到了这个问题并解决了
问题出在客户端配置文件和服务器配置文件上
使用默认配置文件,我的问题得到了解决