Action disabled: register

Linux als Router mit UMTS und WLAN

Die Konfiguration gestaltet sich hier relativ einfach. Man installiert ein Kommandozeilensystem und installiert sich noch folgende Pakete nach falls sie nicht existieren:

apt-get install iptables -y
apt-get remove ufw -y

Wir gehen hier von einem Ubuntu 12.04 Router aus mit 2 Netzwerkschnittstellen. eth0 = intern eth1 = extern

Routing freischalten

nano /etc/sysctl.conf

net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1

IPTABLES in Webmin auf NAT aktivieren, auf eth1 Als temporärer Befehl wäre

iptables -A FORWARD -o wlx9cd643001c0d -i ens18 -s 192.168.2.0/26 -m conntrack --ctstate NEW -j ACCEPT
iptables -t nat -A POSTROUTING -o wlx9cd643001c0d -j MASQUERADE
#iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE # würde hier auch alles über eine auf den Router aufgebaute Verbindung an das richtige Ziel weiter leiten
#iptables -P FORWARD ACCEPT

Die Interfaces sollten dann so ausehen.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth0 eth1
iface lo inet loopback

# The primary network interface
iface eth0 inet static
        address 192.168.2.1
        netmask 255.255.255.0
        dns-nameservers 127.0.0.1 8.8.8.8
        post-up iptables-restore < /etc/iptables.up.rules
iface eth0 inet6 static
        address 2001:db8:478::1
        netmask 64
        gateway 2001:db8:478::2
iface eth1 inet dhcp

OLD CONFIG


Event. braucht noch das Paket „dnsmasq“ ein kleiner DNS Cache und DHCP Server (siehe auch Dnsmasq) Um die IP-Tables zu aktivieren fügt man folgenden Eintrag der /etc/network/interfaces hinzu:

echo "post-up iptables-restore < /etc/iptables.up.rules" >> /etc/network/interfaces

Möchte man einen PC freigeben würde sich der Befehl so gestalten:

iptables -t nat -A POSTROUTING -s 172.16.20.54/32 -o tun+ -j MASQUERADE

Links