我如何与 Debian 共享我的互联网连接到我的局域网?

29r*_*9ru 2 networking linux debian routing gateway

我正在尝试让我的 Debian 服务器成为我 LAN 的路由器。

我有两个接口:eth0 通过 PPPoE 连接到 Internet,eth1 通过 LAN。我在 sysctl net.ipv4.ip_forward=1 中打开了转发并禁用了 iptables(策略接受)。我可以 ping 网关,但无法 ping 互联网上的任何内容。

pau*_*ska 5

您需要使用 NAT 将 Internet 连接共享到您的 LAN。

例子:

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅 HowtoForge 上的本指南:http : //www.howtoforge.com/nat_iptables