本文最后更新时间 2021年9月1日
本着能偷懒就偷懒的态度,先直接用 WireGuard一键安装脚本三合一脚本安装了服务端,在安装之前可以更新系统、安装BBR,该脚本支持 CentOS 7+、Debian 9+、Ubuntu 16+。执行完脚本,会有一个二维码,主要是用来给手机扫描快速配置的。而配置文件则在/etc/Wireguard/路径下,可以使用sftp客户端直接下载到本地,当然手工配置也OK。重新执行脚本可以新增其它用户,这里晚点我们会用到。
curl -O https://raw.githubusercontent.com/atrandys/wireguard/master/wg_mult.sh && chmod +x wg_mult.sh && ./wg_mult.sh
可以上面同样的方式先安装wireguard,然后直接把客户端配置文件下载到客户端机器上,放到/etc/wireguard/路径下即可。当然实际上中转机上需要操作的东西并不多,所以可以从简。
curl –Lo /etc/yum.repos.d/wireguard.repo https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo && yum install epel–release –y && yum install wireguard–dkms wireguard–tools –y
最后在两台服务器上分别输入下方启动命令启动服务:
- wg–quick up wg0 ##启动wg0虚拟网卡
- wg–quick down wg0 ##关闭wg0网络
- wg ##查看当前的运行情况
隧道中转:此时在国内服务器使用本站提供的各类中转工具,转发到远程服务器也就是国外服务器的 内网IP 就是走的WG内网隧道了
参考资料:
https://getzhuji.com/5604.html
https://icodex.org/2020/02/vps-and-virtual-machines-how-to-get-an-iplc-like-experience/
https://blog.csdn.net/weixin_43921239/article/details/104397912