Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
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 '11 at 12:45
1  
Okay updated my answer. You should really update your question with this specific requirement. –  Scaine Jan 15 '11 at 13:14
    
okay. Thank you –  nixnotwin Jan 15 '11 at 14:32
    
Addendum: service still works with Upstart, but it is a SysV command. –  htorque Jan 16 '11 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 '11 at 12:10

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
share|improve this answer
    
A simpler solution might be to untick "Connect Automatically" in network manager for the interface affected. –  Scaine Jan 16 '11 at 13:58
    
I've had just one entry, the static one, which should connect automatically with the static IP settings. –  Lekensteyn Jan 16 '11 at 15:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.