I'm baffled and am looking for help.
I understand many people would use a default block policy in their IPtables rules but the problem with that is if one is not careful, they may lock themselves out of their shell unless they happen to be on-site at the remote computer.
So research has led me to try a command like the following to block a range of ports that hackers love to use.
iptables -I INPUT -m multiport -p tcp --dports 2000:3000,4000:5000 -j DROP
iptables -I INPUT -m multiport -p udp --dports 2000:3000,4000:5000 -j DROP
So I did that while carefully skipping the ports that I want people to connect to on the server (example: DNS, HTTPS).
When I inserted those commands, things worked in my favor if I was a random client trying to connect to my own server on an unauthorized port (thats in the block list), but when I'm on the server itself trying to connect to an external URL (through curl or ping), the system freezes as if the rules are working against me. I did regain control with CTRL+C.
When I removed those rules or when I put them at the end of my other rules, I was able to connect to a remote system on the server.
Can anyone shed light on why this happens when I didn't tell the system to block port 53, 80 or 443?
Source: r/linuxadmin · by /u/Ok_Strike9189