I'm trying to block anything on my server except for some specific ip ranges. There should be neither access from web nor to ssh or anything else.
I searched already through different topics and found a solution which sounds fine:
iptables -P INPUT DROP
iptables -A INPUT -s IP/24 -j ACCEPT
Actually the drop works as it should, but as soon as I execute the command I'm disconnecting. I'm connected through an ssh client. I also tried to create a bash script. But after the dropping it drops me also and it seems that the script doesn't finish.
What can I do to achieve my goal?