Is there a way to delete all iptables rules, that relate to a given interface? I don't see any command line option for this, may be there is a shorcut bash script for this?
Is there a way to delete all iptables rules, that relate to a given interface? I don't see any command line option for this, may be there is a shorcut bash script for this?
Some possibilities, depending on your setup.
If you are running a quite simple structure of chains and dont to nesting and implications, use iptables-save to save your firewallset. Remove all lines with -i $if or -o $if, depending on your needs. Use grep or something. Save that ruleset, diff it to your first saved ruleset and if it's okay, load it with iptables-restore.
Alternatively - gather your rules in interface-specific chains. That way you can easily migrate or remove interfaces. And you are going speed up your firewall processing!
Add a rule to accept all the trafic on one interface :
iptables -A INPUT -i eth0 -j ACCEPT ; iptables -A OUTPUT -o eth0 -j ACCEPT
All the trafic from or to this interface is allowed.To delete all the firewall rules (I have a doubt in reading your text),
iptables -P INPUT ACCEPT ; iptables -P OUTPUT ACCEPT ; iptables -P FORWARD ACCEPT ; iptables -X
: all the trafic is allowed.