Openvpn跨网段通信

  • A+
所属分类:VPN

需求:因公司路由器对vpn支持效果不太好,所以在公司服务器上搭建了一个vpn。主要实现功能跨网段连接不同网段服务器

一.openvpn

1.从官网下载还得翻墙,所以我把rpm放到自己的服务器上,当然也可以用迅雷从官网下载然后上传到服务器。(经测试偶尔可以用迅雷从官网下载)

相关依赖包

yum install net-tools wget -y

网站下载:

wget https://www.thege.cn/openvpn.rpm

2.安装

rpm -ivh openvpn.rpm

3.为openvpn客户端设置密码

passwd openvpn

4.访问

Admin  UI: https://IP:943/admin
Client UI: https://IP:943/

5.登陆后台地址,修改认证方式,我们这次选用简单的账号+密码认证
Openvpn跨网段通信

6.创建用户
Openvpn跨网段通信

7.配置客户端连接地址,映射外网地址
Openvpn跨网段通信

8.配置要访问的网段
Openvpn跨网段通信

9.下载客户端并安装
Openvpn跨网段通信

10.连接
Openvpn跨网段通信

二.破解(慎用)

1.覆盖授权

wget http://www.thege.cn/pyovpn-2.0-py2.7.egg
cp pyovpn-2.0-py2.7.egg /usr/local/openvpn_as/lib/python2.7/site-packages

2.初始化

/usr/local/openvpn_as/bin/ovpn-init

如报一下错误
Traceback (most recent call last):
  File "/usr/local/openvpn_as/bin/_ovpn-init", line 25, in <module>
    from pyovpn.util.gcp import get_user_dict_gcp, get_cidr_list_gcp, gcp_get_pub_ip
ImportError: No module named gcp

修改一下_ovpn-init,把第25行注释掉,然后再次执行
vim /usr/local/openvpn_as/bin/_ovpn-init
#from pyovpn.util.gcp import get_user_dict_gcp, get_cidr_list_gcp, gcp_get_pub_ip

[root@docker bin]# /usr/local/openvpn_as/bin/ovpn-init
Detected an existing OpenVPN-AS configuration.
Continuing will delete this configuration and restart from scratch.
Please enter 'DELETE' to delete existing configuration: DELETE

Please enter 'yes' to indicate your agreement [no]: yes

之后一直回车即可

3.验证授权

Openvpn跨网段通信

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: