Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

What is the correct way to restart nmcli interface remotely?

Writer Matthew Harrington

On Ubuntu 18.04, NetworkManager is used. After modifying the configuration of an interface remotely, using the NetworkManager CLI.

Example:

nmcli connection modify (interface_profile_name) ipv4.addresses ()

How can I make it taken into account without shutting down my remote access?

I tried:

nmcli device disconnect (interface_name) && sleep 5 && nmcli connection up (interface_name)

Because it is recommended to disconnect, and then reconnect the modified interface, but it cuts my access to the computer, the old and the new IP address are unreachable. I have to move on the targeted computer to make locally the modifications.

I want to be able to make the modifications taken into account remotely, with nmcli by an SSH connection, and without restarting the computer (nothing extraordinary ^^).

The restart of the NetworkManager service doesn't change anything.

Thank you.

3

2 Answers

If you use nmcli's device reapply command, it will apply the changes. Replacing devicename with the actual device name of course.

nmcli device reapply devicename

This worked fine for me.

nmcli device disconnect enp4s6; wait ; nmcli device connect enp4s6

Obviously replace enp4s6 with your device name

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy