This is an old revision of the document!
Debian Setup als Router
eth0 = WAN
/ eth1 = LAN
- Berarbeiten und festlegen der Netzkonfig in der interfaces Datei:
# vim /etc/network/interfaces
- Festlegen der fixen Angaben zum interen LAN Netzwerk:
- /etc/network/interfaces
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp # This is an autoconfigured IPv6 interface #iface eth0 inet6 auto auto eth1 iface eth1 inet static address 172.168.1.1 netmask 255.255.255.0 dns-nameservers 172.168.1.1 gateway 172.168.1.1
- Now edit /etc/sysctl.conf and uncomment:
# net.ipv4.ip_forward=1>
so that it reads: net.ipv4.ip_forward=1
and save it by entering
:wq
- To enable IP masquerading, enter following set of commands in terminal:
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT # iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT # apt‐get install iptables‐persistent # iptables-save > /etc/iptables/rules.v4
- Reboot des Systems: →
init 0
https://askubuntu.com/questions/590920/ubuntu-14-04-as-a-gateway-router-and-a-firewall
Bessere Lösung → https://gridscale.io/community/knowledgebase/tutorial-debian-routergateway-in-10-minuten/