I am trying to use bind9 on debian as a DNS server. It was working until I added iptables firewall. I have tried the following filter but it does not seem to work. Anyone can help?
# DNS
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT --syn
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p udp -m udp -s 0/0 -d 0/0 --sport 53 -j ACCEPT**
My complete filter is, the bold is actually a commented line using '#' which I could not find how to prevent:
*filter
# Samba
-A INPUT -p udp -m udp --dport 137 -j ACCEPT
-A INPUT -p udp -m udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
# SYN Flood Protection
-A INPUT -p tcp --syn -m limit --limit 5/second -j ACCEPT
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allows SSH connections
# THE -dport NUMBER IS THE SAME ONE YOU SET UP IN THE SSHD_CONFIG FILE
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
# My webmin custom port
-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT
#POP mail <br>
-A INPUT -p tcp -m tcp --dport 110 -j ACCEPT --syn
#SMTP Traffic <br>
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT --syn
#HTTP <br>
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT --syn
#HTTPS <br>
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT --syn
# IMAP mail services <br>
-A INPUT -p tcp -m tcp --dport 143 -j ACCEPT --syn
# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# DNS
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT --syn
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p udp -m udp -s 0/0 -d 0/0 --sport 53 -j ACCEPT
# Localhost traffic <br>
-A INPUT -i lo -j ACCEPT
# log iptables denied calls (access via 'dmesg' command)
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
# Reject all other inbound - default deny unless explicitly allowed policy:
-A INPUT -j REJECT
-A FORWARD -j DROP
# The below commits the rules to production for iptables to execute <br>
COMMIT