1

I have a user defined chain which is linked with the INPUT chain in the filter table. How do i remove this link so that i can remove my user chain ? Linked in the sense i have made a jump connection from INPUT chain to the user defined chain.

I know that i can save to a file and remove the jump rule from the file but i want to do it through the terminal it self without having to save to a separate file.

Is there a way to do it ?

Thank you.

john
  • 45
  • 1
  • 6

1 Answers1

1

You can use the --line-numbers option to get a listing of the relevant table with erm line numbers.

$ sudo iptables -L INPUT --line-numbers -vn
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1       46  3716 TEST       all  --  *      *       0.0.0.0/0            0.0.0.0/0
...

Once you know the line number of the rule you can delete it with the -D option

$ sudo iptables -D INPUT 1

Will delete the first rule in the INPUT table.

user9517
  • 114,104
  • 20
  • 206
  • 289