当前位置: 技术问答>linux和unix
openvpn和客户端联接就出现段错误
来源: 互联网 发布时间:2016-10-17
本文导语: 我是一个openvpn的菜鸟。我照着网上的这篇博文http://blog.csdn.net/cnbird2008/archive/2010/11/25/6034273.aspx 配置了一下openvpn。我是这样连的,在宿舍我使用的linux Debian,安装的是openvpn 2.09。我这里是直接ADSL拨号上网,我这里是...
我是一个openvpn的菜鸟。我照着网上的这篇博文http://blog.csdn.net/cnbird2008/archive/2010/11/25/6034273.aspx
配置了一下openvpn。我是这样连的,在宿舍我使用的linux Debian,安装的是openvpn 2.09。我这里是直接ADSL拨号上网,我这里是作为服务器。我朋友在外网是的一个局域网中,他在widows下使用的是windows openvpn gui 2.09和我连。
在安装好密匙后,我先打开端口的防火墙。iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5555 -j ACCEPT
我的server.conf如下:
local 14.145.61.78
port 5555
proto tcp
dev tun
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 192.168.1.0 255.255.255.0"
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
我的client.ovpn如下:
client
dev tun
proto tcp
remote 14.145.61.78 5555
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client1.crt
key client1.key
ns-cert-type server
comp-lzo
verb 3
启动server端没有问题,但是一启动客户端联接的时候就出现段错误。在网上搜也没有类似的错误。
服务器端错误提示如下:
Mon Mar 28 23:29:34 2011 Initialization Sequence Completed //openvpn --config server.conf启动服务器在等待的时候没有问题,只要客户端联接就出现下面的提示
Mon Mar 28 23:31:20 2011 MULTI: multi_create_instance called
Mon Mar 28 23:31:20 2011 Re-using SSL/TLS context
Mon Mar 28 23:31:20 2011 LZO compression initialized
Mon Mar 28 23:31:20 2011 Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:0 EL:0 ]
Mon Mar 28 23:31:20 2011 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:0 EL:0 AF:3/1 ]
Mon Mar 28 23:31:20 2011 Local Options hash (VER=V4): 'c0103fa8'
Mon Mar 28 23:31:20 2011 Expected Remote Options hash (VER=V4): '69109d17'
Mon Mar 28 23:31:20 2011 TCP connection established with 183.3.158.20:39500
Mon Mar 28 23:31:20 2011 TCPv4_SERVER link local: [undef]
Mon Mar 28 23:31:20 2011 TCPv4_SERVER link remote: 183.3.158.20:39500
Mon Mar 28 23:31:20 2011 183.3.158.20:39500 TLS: Initial packet from 183.3.158.20:39500, sid=0a891570 331922cb
段错误
客户端的提示如下:
Mon Mar 28 23:31:10 2011 OpenVPN 2.0.9 Win32-MinGW [SSL] [LZO] built on Oct 1 2
006
Mon Mar 28 23:31:10 2011 IMPORTANT: OpenVPN's default port number is now 1194, b
ased on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earl
ier used 5000 as the default port.
Mon Mar 28 23:31:10 2011 LZO compression initialized
Mon Mar 28 23:31:10 2011 Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:
0 EL:0 ]
Mon Mar 28 23:31:10 2011 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:
0 EL:0 AF:3/1 ]
Mon Mar 28 23:31:10 2011 Local Options hash (VER=V4): '69109d17'
Mon Mar 28 23:31:10 2011 Expected Remote Options hash (VER=V4): 'c0103fa8'
Mon Mar 28 23:31:10 2011 Attempting to establish TCP connection with 14.145.61.7
8:5555
Mon Mar 28 23:31:13 2011 TCP connection established with 14.145.61.78:5555
Mon Mar 28 23:31:13 2011 TCPv4_CLIENT link local: [undef]
Mon Mar 28 23:31:13 2011 TCPv4_CLIENT link remote: 14.145.61.78:5555
Mon Mar 28 23:31:13 2011 TLS: Initial packet from 14.145.61.78:5555, sid=7cca9ad
0 bb97bb6b
Mon Mar 28 23:31:13 2011 VERIFY OK: depth=1, /C=CH/ST=GD/L=GuangZhou/O=OpenVPN/O
U=OpenVPN/CN=server/emailAddress=guohuhu2010@gmail.com
Mon Mar 28 23:31:13 2011 VERIFY OK: nsCertType=SERVER
Mon Mar 28 23:31:13 2011 VERIFY OK: depth=0, /C=CH/ST=GD/L=GuangZhou/O=OpenVPN/O
U=OpenVPN/CN=server/emailAddress=guohuhu2010@gmail.com
Mon Mar 28 23:31:14 2011 Connection reset, restarting [-1]
Mon Mar 28 23:31:14 2011 TCP/UDP: Closing socket
Mon Mar 28 23:31:14 2011 SIGUSR1[soft,connection-reset] received, process restar
ting
Mon Mar 28 23:31:14 2011 Restart pause, 5 second(s)
Mon Mar 28 23:31:19 2011 IMPORTANT: OpenVPN's default port number is now 1194, b
ased on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earl
ier used 5000 as the default port.
Mon Mar 28 23:31:19 2011 Re-using SSL/TLS context
Mon Mar 28 23:31:19 2011 LZO compression initialized
Mon Mar 28 23:31:19 2011 Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:
0 EL:0 ]
Mon Mar 28 23:31:19 2011 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:
0 EL:0 AF:3/1 ]
Mon Mar 28 23:31:19 2011 Local Options hash (VER=V4): '69109d17'
Mon Mar 28 23:31:19 2011 Expected Remote Options hash (VER=V4): 'c0103fa8'
Mon Mar 28 23:31:19 2011 Attempting to establish TCP connection with 14.145.61.7
8:5555
Mon Mar 28 23:31:20 2011 TCP: connect to 14.145.61.78:5555 failed, will try agai
n in 5 seconds
Mon Mar 28 23:31:26 2011 TCP: connect to 14.145.61.78:5555 failed, will try agai
n in 5 seconds
。。。。。。。。。。
openvpn的问题已经搞了好几天了,还请大侠们救命阿!
补充:我使用wireshark抓包发现客户端过来的包端口总是在变,而不是我设置的5555。
配置了一下openvpn。我是这样连的,在宿舍我使用的linux Debian,安装的是openvpn 2.09。我这里是直接ADSL拨号上网,我这里是作为服务器。我朋友在外网是的一个局域网中,他在widows下使用的是windows openvpn gui 2.09和我连。
在安装好密匙后,我先打开端口的防火墙。iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5555 -j ACCEPT
我的server.conf如下:
local 14.145.61.78
port 5555
proto tcp
dev tun
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 192.168.1.0 255.255.255.0"
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
我的client.ovpn如下:
client
dev tun
proto tcp
remote 14.145.61.78 5555
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client1.crt
key client1.key
ns-cert-type server
comp-lzo
verb 3
启动server端没有问题,但是一启动客户端联接的时候就出现段错误。在网上搜也没有类似的错误。
服务器端错误提示如下:
Mon Mar 28 23:29:34 2011 Initialization Sequence Completed //openvpn --config server.conf启动服务器在等待的时候没有问题,只要客户端联接就出现下面的提示
Mon Mar 28 23:31:20 2011 MULTI: multi_create_instance called
Mon Mar 28 23:31:20 2011 Re-using SSL/TLS context
Mon Mar 28 23:31:20 2011 LZO compression initialized
Mon Mar 28 23:31:20 2011 Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:0 EL:0 ]
Mon Mar 28 23:31:20 2011 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:0 EL:0 AF:3/1 ]
Mon Mar 28 23:31:20 2011 Local Options hash (VER=V4): 'c0103fa8'
Mon Mar 28 23:31:20 2011 Expected Remote Options hash (VER=V4): '69109d17'
Mon Mar 28 23:31:20 2011 TCP connection established with 183.3.158.20:39500
Mon Mar 28 23:31:20 2011 TCPv4_SERVER link local: [undef]
Mon Mar 28 23:31:20 2011 TCPv4_SERVER link remote: 183.3.158.20:39500
Mon Mar 28 23:31:20 2011 183.3.158.20:39500 TLS: Initial packet from 183.3.158.20:39500, sid=0a891570 331922cb
段错误
客户端的提示如下:
Mon Mar 28 23:31:10 2011 OpenVPN 2.0.9 Win32-MinGW [SSL] [LZO] built on Oct 1 2
006
Mon Mar 28 23:31:10 2011 IMPORTANT: OpenVPN's default port number is now 1194, b
ased on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earl
ier used 5000 as the default port.
Mon Mar 28 23:31:10 2011 LZO compression initialized
Mon Mar 28 23:31:10 2011 Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:
0 EL:0 ]
Mon Mar 28 23:31:10 2011 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:
0 EL:0 AF:3/1 ]
Mon Mar 28 23:31:10 2011 Local Options hash (VER=V4): '69109d17'
Mon Mar 28 23:31:10 2011 Expected Remote Options hash (VER=V4): 'c0103fa8'
Mon Mar 28 23:31:10 2011 Attempting to establish TCP connection with 14.145.61.7
8:5555
Mon Mar 28 23:31:13 2011 TCP connection established with 14.145.61.78:5555
Mon Mar 28 23:31:13 2011 TCPv4_CLIENT link local: [undef]
Mon Mar 28 23:31:13 2011 TCPv4_CLIENT link remote: 14.145.61.78:5555
Mon Mar 28 23:31:13 2011 TLS: Initial packet from 14.145.61.78:5555, sid=7cca9ad
0 bb97bb6b
Mon Mar 28 23:31:13 2011 VERIFY OK: depth=1, /C=CH/ST=GD/L=GuangZhou/O=OpenVPN/O
U=OpenVPN/CN=server/emailAddress=guohuhu2010@gmail.com
Mon Mar 28 23:31:13 2011 VERIFY OK: nsCertType=SERVER
Mon Mar 28 23:31:13 2011 VERIFY OK: depth=0, /C=CH/ST=GD/L=GuangZhou/O=OpenVPN/O
U=OpenVPN/CN=server/emailAddress=guohuhu2010@gmail.com
Mon Mar 28 23:31:14 2011 Connection reset, restarting [-1]
Mon Mar 28 23:31:14 2011 TCP/UDP: Closing socket
Mon Mar 28 23:31:14 2011 SIGUSR1[soft,connection-reset] received, process restar
ting
Mon Mar 28 23:31:14 2011 Restart pause, 5 second(s)
Mon Mar 28 23:31:19 2011 IMPORTANT: OpenVPN's default port number is now 1194, b
ased on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earl
ier used 5000 as the default port.
Mon Mar 28 23:31:19 2011 Re-using SSL/TLS context
Mon Mar 28 23:31:19 2011 LZO compression initialized
Mon Mar 28 23:31:19 2011 Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:
0 EL:0 ]
Mon Mar 28 23:31:19 2011 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:
0 EL:0 AF:3/1 ]
Mon Mar 28 23:31:19 2011 Local Options hash (VER=V4): '69109d17'
Mon Mar 28 23:31:19 2011 Expected Remote Options hash (VER=V4): 'c0103fa8'
Mon Mar 28 23:31:19 2011 Attempting to establish TCP connection with 14.145.61.7
8:5555
Mon Mar 28 23:31:20 2011 TCP: connect to 14.145.61.78:5555 failed, will try agai
n in 5 seconds
Mon Mar 28 23:31:26 2011 TCP: connect to 14.145.61.78:5555 failed, will try agai
n in 5 seconds
。。。。。。。。。。
openvpn的问题已经搞了好几天了,还请大侠们救命阿!
补充:我使用wireshark抓包发现客户端过来的包端口总是在变,而不是我设置的5555。
|