Sample Header Ad - 728x90

Stop network connection from being brought up with NetworkManager-dispatcher pre-up

0 votes
0 answers
24 views
I am running NetworkManager on Debian 11. I have a script that is activated by NetworkManager dispatcher on pre-up. It has been running fine so far and now I would like to add another piece of functionality: I have a situation where it would be helpful if the script could tell dispatcher to not finalize bringing the NIC fully up from the current pre-up state, if certain conditions are met, preventing the connection from being announced to applications on the system. Is there a way to achieve that? The best I have been able to come up with is to call nmcli connection down $CONN_NAME from inside the script, but it is unclear whether that is performed before or after dispatcher brings the NIC up and applications can access the connection. I would much prefer if dispatcher would handle it and presumably guarantee that the up state is never reached. I found these resources useful but uninformative about the functionality I am looking for: https://networkmanager.dev/docs/api/latest/NetworkManager-dispatcher.html https://wiki.archlinux.org/title/NetworkManager#Network_services_with_NetworkManager_dispatcher https://blogs.oracle.com/linux/post/networkmanager-dispatcher-scripts https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/networking_guide/sec-Using_NetworkManager_with_Network_Scripts#bh-Running_Dispatcher_Scripts
Asked by tompi (292 rep)
Jun 5, 2025, 05:34 PM