◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
W2008搭建VPN流程
VPN的作用: 跳过本地封堵直接访问。所以在本地以外的地方建立VPN,则可达到这个作用。打开系统 ...
总字数:11243VPN的作用: 跳过本地封堵直接访问。
所以在本地以外的地方建立VPN,则可达到这个作用。
角色→添加角色
→网络策略和访问服务
→下一步
●√网络策略服务器
●√路由和远程访问服务
√远程访问服务
√路由
→下一步,安装完成。
打开系统 管理工具/【路由和远程访问】
→配置并启用路由和远程访问(红色未启动)
...,这些搭建方法网上很多,基本一样。
Win2008的VPN建好后如不小心删除了NAT或是其他的,不用将组件卸载或是重装,直接重建即可。
●重要的来了:
打开客户机的系统【控制面板】→Internet选项,
点击顶部菜单【连接】→选中框内的【VPN】,点击【设置】;
拨号设置→【属性】,选中顶部菜单【网络】;
→选中【TCP/IPV4】→【属性】
DNS地址手动改为:8.8.8.8
注:不执行上面的修改,连上VPN后本地网页打不开。
VPN连接成功后联网正常,本地网关屏蔽的某些网站连接正常。
如同墙内打不开外面的网,那是因为被封堵了,如果在墙外同样建立一个,则道理一样:
直接通过墙外建立的连接访问。
OpenVPN
win10openvpn搭建与安卓客户端使用(仅用于内网穿透,不可非法使用)
●配置服务端
步骤:
使用宝塔面板安装:openvpn(Docker应用) 1.0.2,完成之后打开终端:
Last failed login: Fri Nov 8 20:08:24 CST 2024 from 218.92.0.246 on ssh:notty
There were 4 failed login attempts since the last successful login.
Last login: Fri Nov 8 20:08:14 2024 from localhost
2.4: Pulling from kylemanna/openvpn
188c0c94c7c5: Pull complete
67e020653bdb: Pull complete
ea7504435934: Pull complete
577cc4d838f3: Pull complete
5e1478772e2e: Pull complete
Digest: sha256:4de5e6690818c7c4025ae605369f681e813a7f9fe5d99feed988412c2d07987c
Status: Downloaded newer image for kylemanna/openvpn:2.4
docker.io/kylemanna/openvpn:2.4
Backing up /etc/openvpn/ovpn_env.sh -> /etc/openvpn/ovpn_env.sh.1731071931.bak
Backing up /etc/openvpn/openvpn.conf -> /etc/openvpn/openvpn.conf.1731071931.bak
Processing PUSH Config: 'block-outside-dns'
Processing Route Config: '192.168.254.0/24'
Processing PUSH Config: 'dhcp-option DNS 8.8.8.8'
Processing PUSH Config: 'dhcp-option DNS 8.8.4.4'
Processing PUSH Config: 'comp-lzo no'
Removing duplicate back-up: /etc/openvpn/ovpn_env.sh.1731071931.bak
removed '/etc/openvpn/ovpn_env.sh.1731071931.bak'
Removing duplicate back-up: /etc/openvpn/openvpn.conf.1731071931.bak
removed '/etc/openvpn/openvpn.conf.1731071931.bak'
Successfully generated config
Cleaning up before Exit ...
WARNING!!!
You are about to remove the EASYRSA_PKI at: /etc/openvpn/pki
and initialize a fresh PKI here.
Type the word 'yes' to continue, or any other input to abort.
Confirm removal: yes
init-pki complete; you may now create a CA or requests.
Your newly created PKI dir is: /etc/openvpn/pki
Using SSL: openssl OpenSSL 1.1.1g 21 Apr 2020
Enter New CA Key Passphrase:
Re-Enter New CA Key Passphrase:
Generating RSA private key, 2048 bit long modulus (2 primes)
..................................................................................................................................................+++++
................................+++++
e is 65537 (0x010001)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Common Name (eg: your user, host, or server name) [Easy-RSA CA]:ABCEFDPass2025@CHINA
CA creation complete and you may now import and sign cert requests.
Your new CA certificate file for publishing is at:
/etc/openvpn/pki/ca.crt
Using SSL: openssl OpenSSL 1.1.1g 21 Apr 2020
Generating DH parameters, 2048 bit long safe prime, generator 2
This is going to take a long time
......+.........+..................................................+........................................................................................................................................................................................................................................................................................................+....................................+.....................................................................................................................+..........................................................................................+...............................................................++*++*++*++*
DH parameters of size 2048 created at /etc/openvpn/pki/dh.pem
Using SSL: openssl OpenSSL 1.1.1g 21 Apr 2020
Generating a RSA private key
.........+++++
...........................................................................+++++
writing new private key to '/etc/openvpn/pki/easy-rsa-72.JCMeIA/tmp.mpoFfi'
-----
Using configuration from /etc/openvpn/pki/easy-rsa-72.JCMeIA/tmp.kFHMnO
Enter pass phrase for /etc/openvpn/pki/private/ca.key:
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName :ASN.1 12:'45.128.222.11'
Certificate is to be certified until Feb 11 12:19:09 2027 GMT (825 days)
Write out database with 1 new entries
Data Base Updated
Using SSL: openssl OpenSSL 1.1.1g 21 Apr 2020
Using configuration from /etc/openvpn/pki/easy-rsa-147.nKNcbE/tmp.dnBkfD
Enter pass phrase for /etc/openvpn/pki/private/ca.key:
An updated CRL has been created.
CRL file: /etc/openvpn/pki/crl.pem
Using SSL: openssl OpenSSL 1.1.1g 21 Apr 2020
Generating a RSA private key
...............+++++
.................................................................................................+++++
writing new private key to '/etc/openvpn/pki/easy-rsa-1.MdGLHj/tmp.DMLjBi'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
Using configuration from /etc/openvpn/pki/easy-rsa-1.MdGLHj/tmp.ebJpMm
Enter pass phrase for /etc/openvpn/pki/private/ca.key:
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName :ASN.1 12:'jast'
Certificate is to be certified until Feb 11 12:23:48 2027 GMT (825 days)
Write out database with 1 new entries
Data Base Updated
ae1a787e0aaccd0cfd738dd73fd865634b167c931e20e26623303aef13c640c4
[root@cloud ~]#
如出现:
这个错误提示已经有容器使用这个名称ov2024,
须删除该容器或重命名该容器才能使用这个名称;
可以查看,再强制停止,再删除。
删除命令rm -f 容器名称
查看:
强制停止:
查看端口占用:
●服务端启动完成。
●配置客户端
服务器路径:
/opt/User2025.ovpn
下载后添加下面的内容:
注释掉最后一行:
redirect-gateway def1
PS:
停止 openvpndocker stop ov2024
启动 openvpndocker start ov2024
查看容器运行信息:
docker ps
客户端下载与教程地址
Mac:https://tunnelblick.net/
Win7:https://swupdate.openvpn.org/community/releases/openvpn-install-2.4.8-I602-Win7.exe
Win10:https://swupdate.openvpn.org/community/releases/openvpn-install-2.4.8-I602-Win10.exe
查看网络连接,运行 ncpa.cpl
参考
https://kui.li/675.html
https://kyo86.com/2022/10/08/openvpn/
https://blog.csdn.net/weizhen330/article/details/132244496
https://blog.csdn.net/qq_42761569/article/details/106538056
https://blog.csdn.net/sdhzdtwhm/article/details/135558435
保存防火墙规则
设置防火墙
关闭firewalld防火墙,关闭开机自启
systemctl stop firewalld.service
systemctl disable firewalld.service
1
2
安装iptables,并设置开机自启
yum -y install iptables-services net-tools
systemctl enable iptables.service
vi 进入编辑
i 插入
:wq 保存退出(先按ESC)
2KK8.com
2KK8.com
这里的内容可以随意更改,在后台-主题配置中设置。