7

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

Update:

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.

2 Answers 2

11

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.

4
  • 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 the network manager. But when I'm not using that script I want to have dhcp on the interfaces.
    – nixnotwin
    Jan 15, 2011 at 12:45
  • 1
    Okay updated my answer. You should really update your question with this specific requirement.
    – Scaine
    Jan 15, 2011 at 13:14
  • Addendum: service still works with Upstart, but it is a SysV command.
    – htorque
    Jan 16, 2011 at 12:02
  • By which you mean that it will be phased out in favour of stop and start, right? I'm surprised it doesn't offer deprecation warnings when you run it actually.
    – Scaine
    Jan 16, 2011 at 12:10
2

I've recentely had a similar issue. For some reason, NetworkManager would default to DHCP even if I specify a static IP entry in NetworkManager or /etc/network/interfaces. I've solved it by uninstalling NetworkManager. If you want just to turn NetworkManager of temporary, run:

sudo stop network-manager
2
  • A simpler solution might be to untick "Connect Automatically" in network manager for the interface affected.
    – Scaine
    Jan 16, 2011 at 13:58
  • I've had just one entry, the static one, which should connect automatically with the static IP settings.
    – Lekensteyn
    Jan 16, 2011 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .