Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm setting marks with iptables like this

iptables -t mangle -A POSTROUTING -d -j MARK --set-mark 10

if I want to clear what I do is remove all with

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT

instead of removing all the rules to clear this, how to remove a mark only?

share|improve this question
up vote 3 down vote accepted

You could just delete that one rule.

iptables -L -t mangle --line-numbers

will give you a number for each rule in your mangle table, then use

iptables -t mangle -D POSTROUTING x

where x is the rule number where you defined the mark.

share|improve this answer

You can also use this syntax:

iptables -t mangle -D POSTROUTING -d -j MARK --set-mark 10

(Note the -A changed to -D, everything else the same)

This format it useful if it is in your recent history which makes it easy to scroll back and change the A to a D. (ie, when you're testing a rule)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.