32.3k views
3 votes
Peter has discovered that the junior administrator has done something to corrupt the firewall rules on one of the Linux machines. He decides to delete all of the rules and recreate them from scratch. What is the first command that Peter should run

User Vibin Jith
by
3.9k points

1 Answer

3 votes

Answer:

the first step Peter must take is to configure the default policies for each of the built-in chains to ACCEPT.

He can do this by running the following:

$ sudo iptables -P INPUT ACCEPT

$ sudo iptables -P FORWARD ACCEPT

$ sudo iptables -P OUTPUT ACCEPT

Step-by-step explanation:

If he doesn't do this, he stands the risk of being locked out of the server through the SSH.

Having done the above, he can proceed to run the following commands:

$ sudo iptables -t nat -F

$ sudo iptables -t mangle -F

$ sudo iptables -F

$ sudo iptables -X

The above will effectively flush (-F), and delete all non-default chains (-X).

Cheers

User Dimitra
by
5.0k points