How can I share my internet connection to my LAN with Debian?

17,456

You need to use NAT to share the internet connection to your LAN.

Example:

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT

See this guide at HowtoForge for more info: http://www.howtoforge.com/nat_iptables

Share:
17,456

Related videos on Youtube

Jeremy Holden
Author by

Jeremy Holden

Updated on September 18, 2022

Comments

  • Jeremy Holden
    Jeremy Holden over 1 year

    I'm trying to make my Debian server the router for my LAN.

    I got two interfaces: eth0 connects to internet through PPPoE, eth1 to LAN. I switched on forwarding in sysctl net.ipv4.ip_forward=1 and disabled iptables(policy accept). I can ping the gateway, but can't ping anything on the internet.

  • Jeremy Holden
    Jeremy Holden over 12 years
    I thought when iptables disabled there are no barriers to traffic.thanks i'll try it