0

I have my ubuntu server set to get addresses from a dhcp server. However, if that dhcp server is not currently active, the server will just stay with no address.

Is there some mechanism to periodically send dhcp requests?

1 Answer 1

0

You can use cron for that.

Open a console and as root type:

crontab -e

Insert a line that executes the dhclient

00 * * * * dhclient eth0

This runs the command dhclient for the network card eth0 every hour (00)

You must change the time for the one you want, and the network card for yours.

If you want to know how cron works:

enter image description here

4
  • I am not sure about this...what if I actually get an ip address: would I still keep polling the dhcp server?
    – Phate
    May 7, 2014 at 15:22
  • Note that the iage you posted is not the format of crontab -e but of /etc/crontab which is different. User crontabs don't have the user field.
    – terdon
    May 7, 2014 at 15:49
  • @Phate Then you should do something more elaborate like a script that checks if you have an ip address, if not then do the dhcp thing.
    – LnxSlck
    May 8, 2014 at 8:59
  • @terdon It was just an image to help him understand how cron works.
    – LnxSlck
    May 8, 2014 at 9:00

You must log in to answer this question.

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