Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm setting marks with iptables like this

iptables -t mangle -A POSTROUTING -d 192.168.1.143 -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
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

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

share|improve this question

2 Answers 2

up vote 2 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 192.168.1.143 -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

 
discard

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.