[SOLVED] iptables: port 53 blocked but server resolve DNS query
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Server has DNS server up and running which resolve domains to given ip addresses. There's only one rule in INPUT chain (Default policy ACCEPT). No other rules. Here's how I added it
Code:
# iptables -A INPUT -p tcp --dport ! 22 -j DROP
# service iptables save
But even then, following works from client.example.org
Code:
# dig example.org
Yes. And according to me, nothing else than ssh should work. Am I making some logical error? And named is not restarting after I saved iptables settings, as it will try to start at example.org:53 which is blocked. It's already running and failing to stop.
Those 3 items are what you see when iptables is NOT running.
Try deleting the rule, running "service iptables start" then run iptables -L again and it will look somewhat different (assuming you're on Fedora/RHEL/CentOS).
By default there is a rule at end of iptables that rejects all traffic.
Code:
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
You can then INSERT (not ADD) the rule above that final rule that accepts only port 22 rather than attempts to reject all but 22.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.