How to restart/reload service when interface number changes

Hello, I am running openwrt with nftables instead of iptables, and I was having problems referencing the interfaces by name. I suppose it is an nftables issue, so it might change in the future, but for now I am referencing all of the interfaces by ID, and these change eventually at runtime for the virtual interfaces. All I have to do to get nftables to see the interfaces correctly is restart nftables with a custom init script I wrote.

Is there a way to trigger the init script for a restart/reload every time the interfaces change IDs?

Yes, there is: please have a look at an example: it was for openvpn but the general idea is to place a script under /etc/hotplug.d/iface/ and do your thing there.

1 Like

Thanks, that worked perfectly.

1 Like

This may be more up-to-date example. :wink:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.