使用 openVPN 共享互联网

发布于 2024-12-21 13:15:06 字数 1549 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

末骤雨初歇 2024-12-28 13:15:06

要做你想做的事,你不需要使用 VPN...我想你的服务器有 openSSH。所以你可以做的是 SSH 隧道

ssh -D login:server 1080:localhost:1080

在你的浏览器配置中,将“socks”设置为 localhost:1080

尝试继续 http: //whatsmyip.com 宾果,您服务器上的所有流量都将重定向到您的计算机

To do what you want you don't need to use a VPN... I suppose your server has openSSH. SO what you can do is a SSH tunnel

ssh -D login:server 1080:localhost:1080

The in your broswer config, set the "socks" to localhost:1080

try to go on http://whatsmyip.com and bingo all the trafic on your server will be redireected to yours machine

地狱即天堂 2024-12-28 13:15:06

CentOS 中需要进行一些更改:

首先,需要在 CentOS 服务器上启用转发:

sysctl -w net.ipv4.ip_forward=1
sysctl -p /etc/sysctl.conf

将网关更改为 LAN 网关。在 OpenVPN 配置中输入:

push "redirect-gateway def1"

和 DNS:

push "dhcp-option DNS 192.168.1.2"

最后,对 VPN 网络使用 NAT/MASQUERADE(通过 eth0 输出到互联网)

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

There are some changes to do in CentOS:

First, forwarding needs to be active on the CentOS server:

sysctl -w net.ipv4.ip_forward=1
sysctl -p /etc/sysctl.conf

Change the gateway to the LAN gateway. In OpenVPN configuration put:

push "redirect-gateway def1"

And the DNS:

push "dhcp-option DNS 192.168.1.2"

And finally, use NAT/MASQUERADE for the VPN network (output to Internet via eth0)

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文