使用云服务器搭建WireGuard VPN实现外网访问
发表于|更新于|网络
目录
- 1. 场景背景
- 2. 配置思路
- 3. 前期准备
- 4. 安装和配置 WireGuard
- 4.1. 1. 安装 WireGuard
- 4.2. Windows [7, 8.1, 10, 11, 2008R2, 2012R2, 2016, 2019, 2022 – v0.5.3]
- 4.3. macOS [app store – v1.0.16]
- 4.4. Ubuntu
- 4.5. Android [play store – v1.0.20231018 & direct apk file – v1.0.20231018]
- 4.6. iOS [app store – v1.0.16]
- 4.7. Debian [module – v1.0.20220627 & tools – v1.0.20210914]
- 4.8. Fedora [tools – v1.0.20210914]
- 4.9. Mageia [tools – v1.0.20210914]
- 4.10. Arch [module – v1.0.20220627 & tools – v1.0.20210914]
- 4.11. OpenSUSE/SLE [tools – v1.0.20210914]
- 4.12. Slackware [tools – v1.0.20210914]
- 4.13. Alpine [tools – v1.0.20210914]
- 4.14. Gentoo [module – v1.0.20220627 & tools – v1.0.20210914]
- 4.15. Exherbo
- 4.16. NixOS [module – v1.0.20220627 & tools – v1.0.20210914]
- 4.17. Nix on Darwin [userspace go – v0.0.20230223 & tools – v1.0.20210914]
- 4.18. OpenWRT [tools – v1.0.20210914]
- 4.19. Oracle Linux 8 [UEK6 & tools – v1.0.20200827 – out of date]
- 4.20. Red Hat Enterprise Linux 8
- 4.21. CentOS 8
- 4.22. Oracle Linux 7 [UEK6 & tools – v1.0.20200827 – out of date]
- 4.23. Red Hat Enterprise Linux 7
- 4.24. CentOS 7
- 4.25. FreeBSD
- 4.26. OpenBSD [tools – v1.0.20210914]
- 4.27. 2. 生成密钥对
- 4.28. 2. 客户端配置
- 4.29. 3. 启用伪装和端口转发,以及IP转发
- 4.30. 4. 启用 IP 转发
- 4.31. 5. 配置客户端(手机)
- 4.32. 6. 启动 WireGuard
- 4.33. 验证结果
- 5. 可能遇到的问题和解决办法,以及常见知识说明
- 5.1. IP转发(net.ipv4.ip_forward)是必须要设置的吗?
- 5.2. Endpoint字段很关键,特别是在wireguard组网使用中继服务器-客户端组网模式
- 5.2.1. 来自客户端的疑问
- 5.2.2. 设置客户端 AllowedIPs 以指定流量走 VPN