Portal Home > Knowledgebase > Articles Database > iptables not saving


iptables not saving




Posted by Hoosier Mike, 05-12-2012, 06:42 PM
I'm using CentOS 6.2 86_64 with CloudLinux and it seems IPTABLES is not saving. I am trying to make it that you can only access whm on our main IP of the server. But trying other IPs I can still connect to WHM. I have tried iptables -A INPUT -s ! xxx.xxx.xxx.xxx -p tcp --dport 2082:2087 -j DROP which warns Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`) and after a save I can still access WHM on other IPs iptables -A INPUT -s xxx.xxx.xxx.xxx -p tcp --dport 2082:2087 -j DROP which no errors but after save I can still reach WHM on that IP. Any suggestions would be great!

Posted by Hoopla-Brad, 05-12-2012, 08:39 PM
Shouldn't the ! be before -s

Posted by net, 05-12-2012, 08:51 PM
Moved > Hosting Security and Technology .

Posted by Hoosier Mike, 05-12-2012, 10:51 PM
No error now using root@flare [/etc]# iptables -A INPUT ! -s xxx.xxx.xxx.xxx -p tcp --dport 2082:2087 -j DROP root@flare [/etc]# service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ] But, I can still open WHM on any of our /26 subnet IPs. Edit: Oh that reverse suggested now blocks main IP but not others. I tried adding the reverse again with that now too on next IP, but it still only blocks main IP.

Posted by dale, 05-12-2012, 11:31 PM
Have you tried doing this through your control panel?

Posted by VectorVPS, 05-13-2012, 12:20 AM
iptables -A INPUT ! -s xxx.xxx.xxx.xxx -p tcp --dport 2082:2087 -j DROP

Posted by Hoosier Mike, 05-13-2012, 01:54 AM
Thanks, but as already stated.. Unless I'm not noticing something different in your line.. root@flare [/etc]# iptables -A INPUT ! -s xxx.xxx.xxx.xxx -p tcp --dport 2082:2087 -j DROP root@flare [/etc]# service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ] But, I can still open WHM on any of our /26 subnet IPs.

Posted by VectorVPS, 05-13-2012, 02:51 AM
Do you have a conflicting rule which is allowing access from your subnet? For example, if you have the following 2 rules (in this order)... -A INPUT -s xxx.xxx.xxx.xxx -p tcp --dport 2082:2087 -j ACCEPT -A INPUT -s xxx.xxx.xxx.xxx -p tcp --dport 2082:2087 -j DROP ...you will still be able to access WHM from that IP. Last edited by VectorVPS; 05-13-2012 at 02:57 AM.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
php send form problem (Views: 712)


Language: