iptables konfiguration
hejsaHar lidt problemer med min iptables konfiguration. Jeg kan ikke komme på internet via min Linux Firewall og SSH virker heller ikke.
desuden kan jeg ikke komme i kontant med min ftp server på DMZ.
tag jer ikke for meget af at det står på engelsk (forklaringerne), har fået hjælp af en amerikaner jeg kender.
her er konfigurationen :
#!/bin/sh
INTIP=192.168.0.1
EXTIP=xxx.xxx.xxx.xxx
DMZIP=10.0.0.1
#whether to forward packets at layer three. This can be 0 or 1. 1 enables it
echo "1" > /proc/sys/net/ipv4/ip_forward
#default rules
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
#flush iptables
iptables -F
iptables -t nat -F
#accept any traffic on the localhost interface
iptables -A INPUT -i lo -j ACCEPT
# (INTERN IP) Route the 192.168.0 network through the EXTIP ip address. Don't accept any packets with
# the 192.168.0 address as incoming!
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -d "!" 192.168.0.0/24 -j SNAT --to $EXTIP
#(DMZ IP) Route the 10 network through the EXTIP ip address. Don't accept any packets with
# the 10 address as incoming!
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -d "!" 10.0.0.0/8 -j SNAT --to $EXTIP
#destination nat "FTP"
iptables -t nat -A PREROUTING -s 0/0 -d $EXTIP -p tcp --dport 21 -j DNAT --to 10.0.0.2:8
iptables -A FORWARD --dport 21 -d 10.0.0.2:8 -j ACCEPT
# destination nat "HTTP"
iptables -t nat -A PREROUTING -s 0/0 -d $EXTIP -p tcp --dport 80 -j DNAT --to 10.0.0.2:8
iptables -A FORWARD --dport 80 -d 10.0.0.2:8 -j ACCEPT
# destination nat "POP3"
iptables -t nat -A PREROUTING -s 0/0 -d $EXTIP -p tcp --dport 110 -j DNAT --to 10.0.0.2:8
iptables -A FORWARD --dport 110 -d 10.0.0.2:8 -j ACCEPT
# destination nat "SMTP"
iptables -t nat -A PREROUTING -s 0/0 -d $EXTIP -p tcp --dport 25 -j DNAT --to 10.0.0.2:8
iptables -A FORWARD --dport 25 -d 10.0.0.2:8 -j ACCEPT
#The following ports are being blocked based on destination IP
iptables -A INPUT -p tcp -d $INTIP --dport 25 -j DROP
iptables -A INPUT -p udp -d $INTIP --dport syslog -j DROP
iptables -A INPUT -p tcp -d $INTIP --dport printer -j DROP
#Dropping ssh to your external interface?
iptables -A INPUT -p tcp -d $EXTIP --dport 22 -j DROP
iptables -A INPUT -p tcp -d $EXTIP --dport 111 -j DROP
#Let good stuff through
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#block the last stuff coming through
iptables -A INPUT -d $EXTIP -j LOG --log-level 6 --log-prefix "Blocked packets: "
iptables -A INPUT -d $EXTIP -j DROP