Iptables: Difference between revisions
From KlavoWiki
Jump to navigationJump to search
Created page with "= Chains = <pre> INPUT OUTPUT FORWARD </pre> = Drop = Drop from Source <pre> iptables -I INPUT -s 23.253.232.189 -j DROP </pre> <pre> -I Insert -A Append -s Source -d Destin..." |
|||
Line 66: | Line 66: | ||
<pre> | <pre> | ||
iptables-restore < /opt/firewall.conf | iptables-restore < /opt/firewall.conf | ||
</pre> | |||
== Automatic Load on Restart == | |||
Based on Debian, once your tables are operating as required | |||
<pre> | |||
iptables-save > /etc/iptables.up.rules | |||
</pre> | |||
<pre> | |||
vi /etc/network/if-pre-up.d/iptables | |||
</pre> | |||
add the following lines | |||
<pre> | |||
#!/bin/sh | |||
/sbin/iptables-restore < /etc/iptables.up.rules | |||
</pre> | |||
<pre> | |||
chmod +x /etc/network/if-pre-up.d/iptables | |||
</pre> | </pre> | ||
[[Category : Linux]] | [[Category : Linux]] |
Revision as of 06:47, 3 August 2014
Chains
INPUT OUTPUT FORWARD
Drop
Drop from Source
iptables -I INPUT -s 23.253.232.189 -j DROP
-I Insert -A Append -s Source -d Destination
List
Current tables
iptables -L -v
-L List -v verbose
with Line Numbers
iptables -L -n --line-numbers
List Chain
iptables -L INPUT -n --line-numbers
Delete
by Rule Number
iptables -D INPUT 3
by Rule Name
iptables -D INPUT -s 23.253.232.189 -j DROP
Delete All
Delete all rules
iptables --flush
Rules
Saving
iptables-save > /opt/firewall.conf
Restoring
iptables-restore < /opt/firewall.conf
Automatic Load on Restart
Based on Debian, once your tables are operating as required
iptables-save > /etc/iptables.up.rules
vi /etc/network/if-pre-up.d/iptables
add the following lines
#!/bin/sh /sbin/iptables-restore < /etc/iptables.up.rules
chmod +x /etc/network/if-pre-up.d/iptables