Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I don't want to delete or add, just want to modify one rule. Is there such a command or do I have to resort to Delete and Add ?

Computer is running Debian 6.

share|improve this question
are you talking about the iptables? the firewall? –  Braiam Jun 13 '14 at 16:48
ip route show and ip route help should get you started. –  mikeserv Jun 13 '14 at 16:51

1 Answer 1

up vote 1 down vote accepted

As you can see from ip rule help, there is no replace:

$ ip rule help
Usage: ip rule [ list | add | del | flush ] SELECTOR ACTION

So you have to delete the rule then add its replacement. You can (and should) use the pref values to put the rules in the right order.

(Note that ip route does have a replace option, unlike ip rule. I'm not sure why they implemented it for one but not the other.)

share|improve this answer
You can modify a route table. ip route help ... ip route { add | del | change | append | replace } ROUTE –  mikeserv Jun 13 '14 at 17:00
@mikeserv Indeed, you can modify a route, but not a rule. ip route v. ip rule. –  derobert Jun 13 '14 at 17:02
OP asked ... "How can I modify route table?" –  mikeserv Jun 13 '14 at 17:02
@mikeserv Indeed, and then stated he wanted to modify "one rule". OP accepted the answer, so I guess the title is in need of fixing. I'll put in a note about routes being different... –  derobert Jun 13 '14 at 17:04
Good idea. And thanks for highlighting that for me too. I've never use ip2 to directly alter iptables before. I've always used its own route config. Or is it nftables now? I don't even know. –  mikeserv Jun 13 '14 at 17:06

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.