22

I am using ubuntu 14.04 on ec2 instance, I am changing dhcp settings as part of the provisioning process, and I cant find a way to reload the dhclient. Infact, theres no way to restart network on 14.04 cloud instances. Any suggestions?

Ranjib
  • 321
  • 1
  • 2
  • 4

3 Answers3

13

The -r flag explicitly releases the current lease, and once the lease has been released, the client exits. Open a terminal and type the command:

$ sudo dhclient -r

Now obtain fresh IP:

$ sudo dhclient 
Jan
  • 12,931
  • 3
  • 34
  • 39
2

Typically I do this by running dhclient as a single command like so:

$ sudo -Es
$ dhclient -r; dhclient

You can use this trick if you've made changes to /etc/dhcp/dhclient.conf:

$ cat /etc/dhcp/dhclient.conf
timeout 300;
retry 60;
supersede domain-search "dom1.mydom.com", "dom2.mydom.com";
prepend domain-name-servers 192.168.7.185,192.168.7.186;

References

slm
  • 3,155
2

Yeah... no. dhclient -x or dhclient -r didn't work for me. What did work was

sudo su
ps fax

then copy the entire command-line that starts with /sbin/dhclient, including all the command-line options, file paths, etc... Then

pkill dhclient

and paste the command-line from ps fax into your terminal and hit enter.

Mr Stock
  • 21
  • 1