Skip to main content
Skip table of contents

iptables useful commands

CODE
iptables-restore < /etc/sysconfig/iptables

service iptables save

iptables -A OUTPUT -d 127.0.0.1/32 -j ACCEPT
iptables -A OUTPUT -d 10.0.0.0/8 -j ACCEPT
iptables -A OUTPUT -d 52.119.0.0/16 -j ACCEPT
iptables -A OUTPUT -d 52.94.0.0/16 -j ACCEPT
iptables -A OUTPUT -d 169.254.0.0/16 -j ACCEPT
iptables -A OUTPUT -j DROP


##to delete a rule:
iptables -D OUTPUT -j DROP

## ORDER IS IMPORTANT!!!! so a easier way is to edit /etc/sysconfig/iptables and restart service.


systemctl start iptables
systemctl enable iptables


##command used to block ldap connections (all other rules were deleted while running this one)
while (true); do iptables -A OUTPUT -j REJECT -d 10.0.20.171; sleep 6; iptables -D OUTPUT -j REJECT -d 10.0.20.171; sleep 6; iptables -A OUTPUT -j REJECT -d 10.0.20.172; sleep 6; iptables -D OUTPUT -j REJECT -d 10.0.20.172;  done
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.