Saved iptables rules not found
Hi,
I am trying to block a particular IP accessing my server via iptables as "iptables -I INPUT -s x.x.x.x -j DROP"
Then saved iptables by "service iptables save" and restarted "service iptables restart"
When I checked the saved rules after some time by this command "iptables -L -n | grep 'x.x.x.x' ", I couldn't find it in the saved list. Why?
Note::I dont have a csf installed in whm
Any help are appreciated.
-
Hi, Try below commands: # cp -ar /etc/sysconfig/iptables /etc/sysconfig/iptables_BK # iptables -A INPUT -p tcp -s x.x.x.x -j DROP # iptables-save >> /etc/sysconfig/iptables Note: Don't forget to back up correct IPtables file based on its appropriate location on your server.. 0 -
Hello, You may also want to consider installing a plugin such as CSF for easier management of your IPtables firewall rules. Thank you. 0 -
Hi, Sorry for the late reply. I found out that the rules are being saved in /etc/sysconfig/iptables, but is not showing when I check with iptables -L -n command. 0 -
Hello, You may want to consider installing a third-party firewall management utility such as CSF if you are having trouble manually saving your system's iptables firewall rules: ConfigServer Security & Firewall (csf) Thank you. 0 -
Thank you for your reply!:) 0 -
were the rules showing fine after running the command "service iptables save" ? 0 -
Yes, it shows when checking with the command iptables -L -n. After some time it goes nowhere, but still shows in the /etc/sysconfig/iptables directory. 0 -
Could you verify if installing CSF addresses the issue? Thank you. 0 -
Sorry, I can not install it right now. I am using Centos 5.11 which I think don't support csf, and right now I am not able to upgrade the OS. Thank you 0 -
There is an update, some rules are missing from iptables. I blocked a bad bot before two weeks with its IP subnet, now its again accessing my website and creating load. /etc/init.d/iptables save - thats all I need to do after applying the rule right? 0 -
/etc/init.d/iptables save - thats all I need to do after applying the rule right?
Hello, Yes, that command will save your iptables rules on CentOS 5. Thank you.0
Please sign in to leave a comment.
Comments
11 comments