Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
When I try to ssh into my machine running iptables, I get the login prompt and type in the username. It takes about 17 seconds for the password prompt to come up when I have iptables on.
Also, if I do an iptables -L it takes about 30 seconds to display the list.
Do I have something misconfigured?
/sbin/iptables -F
/sbin/iptables -A INPUT -p tcp -m state --state ESTABLISHED -j ACCEPT
/sbin/iptables -A INPUT -s x.x.x.3 -p udp -j ACCEPT
/sbin/iptables -A INPUT -s x.x.x.4 -p udp -j ACCEPT
/sbin/iptables -A INPUT -s x.x.x.1 -p udp --dport 123 -j ACCEPT
/sbin/iptables -A INPUT -s x.x.x.0/24 -p tcp -m tcp --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -j DROP
It logs in fine when I flush the rules. I also moved the ssh rule to the top. This didn't change anything. I set the last rule as -j ACCEPT instead of DROP and it gives me the password prompt right away.
Yup. That's true. BTW, I think I might have spotted the problem:
Quote:
/sbin/iptables -A INPUT -p tcp -m state --state ESTABLISHED -j ACCEPT
Notice how it only matches against TCP packets. That would mean the returning UDP packets for the DNS lookups wouldn't get sent to ACCEPT by it. Your box may be doing TCP-fallback after a while when it realizes UDP didn't work, I don't know. You also are missing a rule for the loopback interface, which although likely not related to your current issue is still a pretty standard rule to have. Try this:
Code:
/sbin/iptables -F
/sbin/iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -s x.x.x.3 -p udp -j ACCEPT
/sbin/iptables -A INPUT -s x.x.x.4 -p udp -j ACCEPT
/sbin/iptables -A INPUT -s x.x.x.1 -p udp --dport 123 -j ACCEPT
/sbin/iptables -A INPUT -s x.x.x.0/24 -p tcp -m tcp --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -j DROP
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.