# [SOLVED] iptables: -F without argument vs -X <chain>

## CleanTestr

the man page seems to indicate that iptables -F <name> will 'flush rules' in 'name',

whereas iptables -F without 'name' will 'flush all rules in chain'.

In earlier versions of iptables, code such as

```
iptables -F

iptables -N my-own-foo

```

used to run without warnings, but now gives: 'Chain already exists'.

Ideally I would like the behavior to be along the lines of

```
iptables -F my-own-foo

iptables -N my-own-foo

```

----------

## papahuhn

-F flushes all rules in a chain, but does not delete it. So there is a warning if you try to create the chain again.

----------

## CleanTestr

So, referring to: home router, I should, 

instead of relying on the (at the very top) iptables -F, use, at the very end (before the rc-update

command group), something like this:

iptables -X my-own-foo

iptables -N my-own-foo

.. other rules ..

instead of, just:

iptables -N my-own-foo

maybe?

[Edit] Yes, that works. Thanks  :Smile: 

----------

