Score:1

Something deletes my ip rules

kr flag
seb

So I have this server on Ubuntu 22.04 with a few ip rules, and they get overwritten every few minutes. All my rules get deleted pure and simple.

example of such rules: ip rule add pref 10 from all fwmark 0x117 lookup 17

An "ip rule list" show them to me alright, then a few minutes later the same command gives me an almost empty list.

Does anybody know what is causing this? I can't believe I'm the only one who gets this but I can't find anything on google on this matter.

Thanks

A.B avatar
cl flag
A.B
You can at least know when it happens: `ip -ts monitor rule` if that helps matching other logs to figure out which of your other tools/daemons is doing this.
seb avatar
kr flag
seb
nice command there. It doesn't give info on what did it though, too bad. `[2023-01-31T10:36:15.581050] 10: from all fwmark 0x101 lookup 1 [2023-01-31T10:37:29.378782] Deleted 10: from all fwmark 0x101 lookup 1`
Score:3
pt flag

It's systemd-networkd that's helping you :-)

I had the same issue after upgrading to 22.04, it seems systemd will remove all ip rules it didn't create on state change. The quick solution is to add "protocol kernel" to your rule as: ip rule add pref 10 from all fwmark 0x117 lookup 17 protocol kernel

more details here systemd-networkd removes fwmark rules

seb avatar
kr flag
seb
Thank you so very much! Saved me from a lot of headaches.
A.B avatar
cl flag
A.B
The true fix is there (following Greg's link and discussions): https://github.com/systemd/systemd/pull/19287
A.B avatar
cl flag
A.B
=> https://www.freedesktop.org/software/systemd/man/networkd.conf.html#ManageForeignRoutingPolicyRules=
mx flag
Thank you for this info!!! I spent an afternoon pulling out my hair because of this problem! Based on the above info, I edited `/etc/systemd/networkd.conf`, adding `ManageForeignRoutes=no` and `ManageForeignRoutingPolicyRules=no`, followed by `systemctl restart systemd-networkd`. My custom rule+default route finally stay in place! :-)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.