I'm trying to setup iptables, the forward rules are workin fine, but the output rules are making problems.
I Can't access internet from the hosts beheind the firewall neither the firewall server can ping www.google.com . And the hosts can't ping www.google.com too, the ping didn't worked with ip too.
The default action for input, output and forward is drop.
I've opened 80,443,53(tcp and udp) and the ports for outlook.
Here my output rules:
iptables -P OUTPUT DROP
# Output
iptables -A FORWARD -p tcp --dport 80 -j ACCEPT
iptables -A FORWARD -p tcp --dport 443 -j ACCEPT
iptables -A FORWARD -p tcp --dport 25 -j ACCEPT
iptables -A FORWARD -p tcp --dport 110 -j ACCEPT
iptables -A FORWARD -p tcp --dport 53 -j ACCEPT
iptables -A FORWARD -p udp --dport 53 -j ACCEPT
# DNS
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT
OUTPUT
rule allowing anything but DNS, it's normal the firewall cannot access anything nor ping google. Actually you have no rules allowing icmp anywhere, so ping is not allowed for hosts either.INPUT
chain. I recommend using a stateful firewall using theconntrack
module as it is much simpler to configure.