Hallo zusammen,
ich habe mich entschieden meinen Ubuntu-Server hinter einer Fritz-Box als Gateway mit Firewall zu betreiben. Ich verwende dafür zwei Gigabit-Netzwerkkarten.
Lokales Netz <p2p1 192.168.255.1> Ubuntu-Server <eth0 192.168.172.22> Fritz-Box
Nun habe ich ein Iptables-Script geschrieben:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #! /bin/bash iptables="/sbin/iptables" sysctl -w net.ipv4.ip_forward=1 sysctl -w net.ipv6.conf.default.forwarding=1 echo "1" > /proc/sys/net/ipv4/ip_forward echo "1" > /proc/sys/net/ipv6/conf/all/forwarding # delete all existing rules $iptables -F # set default chain policies $iptables -P INPUT DROP $iptables -P FORWARD DROP $iptables -P OUTPUT DROP # incoming @ eth0 $iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT $iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT $iptables -A INPUT -i eth0 -p tcp --dport 443 -j ACCEPT $iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT #iptables -A INPUT -i eth0 -p icmp --icmp-type echo-request -j DROP # incoming @ p2p1 $iptables -A INPUT -i p2p1 -j ACCEPT # outgoing $iptables -A OUTPUT -j ACCEPT # loopback $iptables -A INPUT -i lo -j ACCEPT $iptables -A OUTPUT -o lo -j ACCEPT # nat rules $iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE $iptables -A FORWARD -i p2p1 -o eth0 -j ACCEPT $iptables -A FORWARD -i eth0 -o p2p1 -m state --state RELATED,ESTABLISHED -j ACCEPT # routing route add default gw 192.168.172.1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 | auto lo iface lo inet loopback auto p2p1 iface p2p1 inet static address 192.168.255.1 netmask 255.255.255.0 gateway 192.168.255.1 dns-nameservers 192.168.255.1 8.8.8.8 auto eth0 iface eth0 inet dhcp iface eth0 inet6 auto |
Funktioniert unter IPV4 auch schon recht gut. Die Fritz-Box hat das Gateway als Exposed-Host (alle Porsts werden durch geschickt, welche nicht an die Fritz gehen...)
Allerdings will ich jetzt auch ipv6 wieder nutzen können ... xD
Wie gehe ich dabei am besten vor?
Hat jemand noch Sicherheitslücken bei meiner jetzigen Firewall entdeckt (Verbesserungen jeder Art?)?
Gruß Anton