用代理连接 OpenVPN 的问题

很多人在公司、学校都是通过代理服务器上的网,需要设置代理。我们有位客户在公司用代理上 OpenVPN 时遇到一个问题,他在我们的 VPS 上安装和配置好了 OpenVPN 服务,客户端也设置了代理 http-proxy 192.168.0.1 3128,可是就是连不上去。OpenVPN 客户端报错如下:

2010-05-16 15:46:48 Attempting to establish TCP connection with 192.168.0.1:3128 [nonblock]
2010-05-16 15:46:48
2010-05-16 15:46:49 TCP connection established with 192.168.0.1:3128
2010-05-16 15:46:49 Send to HTTP proxy: ‘CONNECT 206.221.200.200:1194 HTTP/1.0’
2010-05-16 15:47:40 recv_line: TCP port read timeout expired: Operation now in progress (errno=36)
2010-05-16 15:47:40 TCP/UDP: Closing socket
2010-05-16 15:47:40 process exiting

这是因为大部分代理服务器都封掉了非标准端口,并且很多管理员因为安全因素都封掉了非标准端口的 HTTP CONNECT,所以像 OpenVPN 的默认 1194 端口而且需要CONNECT 方法支持就不行。既然不能去要求公司管理员把 1194 端口打开,我们就只能在自己 VPS 上想办法,幸运的是大部分代理服务器都会开 443 端口并且可以 CONNECT,所以我们只需要修改自己 VPS 上 OpenVPN 服务器的监听端口,把它改成 443 就可以了,使用代理的话还必须用 TCP:

# vi /etc/openvpn/server.conf

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
;port 1194
port 443

# TCP or UDP server?
proto tcp
;proto udp

评论 (4 Comments)

  1. 请教下

    先经过内网http代理 再连接vpn

    是使用什么工具?

  2. 大多数 OpenVPN 客户端都内置 http proxy 连接,只需要配置就可以了,比如 Mac 上的 Tunnelblick、Windows 上的 OpenVPN GUI for Windows 等。

  3. 那代理要论证怎么办?

  4. 是认证打错了

发表评论