debian:other-debian:router-debian

This is an old revision of the document!


Debian Setup als Router

eth0 = WAN eth1 = LAN

  1. Open a new Putty Terminal and connect to server
  2. Enter following command to edit interfaces file:
    # vim /etc/network/interfaces
  3. Edit the file with the following lines: (add your netmask and gateway)
    /etc/network/interfaces
    auto lo 
    iface lo inet loopback
     
    auto eth0
    iface eth0 inet dhcp
     
    auto eth1
    iface eth1 inet static 
    address 172.168.1.1
    netmask 255.255.255.0
  4. 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

  5. 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 

Update: Fix strange “-–state” causing command to fail and fix nat MASQUERADE to eth0 (wan interface)

# apt‐get install iptables‐persistent
# iptables-save > /etc/iptables/rules.v4

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/

Tutorial_ Debian Router_Gateway in 10 Minuten einrichten

  • debian/other-debian/router-debian.1495012617.txt.gz
  • Last modified: 2017/05/17 11:16
  • by michael