[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: basic question about assigning ip address

Peter Horst wrote on Sunday 30 September 2007:

> I have a Fedora machine I'm using as a home server, without a keyboard
> or monitor. I'd like to set it up such that upon rebooting it first
> checks to see if there is a DHCP server on the network, and if so,
> grabs an ip address from it.  But if there isn't one, it assigns itself
> a static address.  Is this doable?

Yes, it's possible, but I agree with Jacques and Ed, that it is not 
desirable. A server should use a static address. So much for an advise.

What you want is possible using dhclient hooks. Those are scripts called 
by dhclient. Depending on the status dhclient provides to them they can 
do anything a script can do. "man dhclient-script" is your friend.

I use those scripts on my notebook to setup IPv4LL addresses (local link 
adresses, if there is no DHCP server available. Together 
with Avahi they make ad-hoc networks really easy.

I attach both dhclient-hooks as example how to use hooks. They both live 
in /etc and should be executable.


"Mach was the greatest intellectual fraud in the last ten years." "What 
about X?" "I said `intellectual'." ;login, 9/1990

Attachment: dhclient-enter-hooks
Description: application/shellscript

Attachment: dhclient-exit-hooks
Description: application/shellscript

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]