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.

I'm using Ubuntu 12.04 LTS, but I need to run the following command:

sudo dhclient

after startup to acquire a stable ethernet connection. I am running dhclient during startup already, through the /etc/rc.local file.

Someone please help me run this command after-startup automatically (by removing it's requirement for root, or some other means), or suggest a different way of troubleshooting my ethernet connection.

share|improve this question
1  
Can you give us the output of the command ifconfig after you have rebooted (but before you've run sudo dhclient), and again after you have run sudo dhclient? It sounds like you may have an IP address incorrectly configured/not configured for DHCP on your network interface. –  Matt Malesky May 18 '12 at 5:52
    
Make sure you types the password correctly for your wireless ;) –  Rinzwind May 18 '12 at 6:08
    
rc.local is executing with root permission, so you dont need to use a sudo. Is everything alright in your Network Manager? You can try to remove Network Manager and configure a /etc/network/interfaces –  us3r May 18 '12 at 6:43
    
a) it's wired, see "ethernet" b) rc.local isn't working, I think it's because it's running dhclient before the system is fully booted. That's why I'm trying to run it immediately after boot, or login c) I think something is definitely wrong with my Network Manager, but I don't know how to follow your instructions, could you be more precise? –  rofls May 18 '12 at 6:55
    
Will do, ~5 minutes. –  rofls May 18 '12 at 6:56
show 3 more comments

2 Answers

One workaround would be to use rc.local with a sleep command. Put the following into /etc/rc.local:

(sleep 60; dhclient) &

This will make the command wait for 60 seconds before being executed, which should allow enough time for your machine to finish booting.

share|improve this answer
add comment

You can create a Custom script to start or stop services and make it executable at startup, i don't have experience in writing codes so please refer this official Guide look up Installing custom init-scripts

share|improve this answer
    
Yeah, but I think those run during boot, by default, though I could be wrong. Thanks though! –  rofls May 18 '12 at 7:05
1  
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Mahesh May 18 '12 at 17:48
add comment

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.