Network Manager – How to Temporarily Turn Off NetworkManager from Command-Line


The network interface should not make a request for an IP over DHCP. So, what is the command to turn off NetworkManager in Ubuntu?


I am writing a script in which the interfaces receive static IPs. For this to happen I need to put a line in the script which will turn off NetworkManager. But when I'm not using that script I want to have DHCP on the interfaces.

Best Answer

If you don't want to have your inteface make a DHCP request, simply edit it (right on network manager applet, choose "Edit Connections", click on the interface in question, then choose the IPv4 tab and change "Automatic (DHCP)" to "Manual" and specify your settings manually.

If you need to turn off network manager regardless, use

sudo service network-manager stop

You can specify stop, start or restart for most services.

Htorque notes that service is being deprecated in Ubuntu in favour of the stop, start and restart commands. So :

sudo stop network-manager

would also work. I still prefer using service because, as of Maverick, there's no auto-complete when you use the newer commands. A bug has been filed about this, and from that, a fix has been released, so hopefully this will be rectified in Natty this coming April.

Related Question