How to configure the dhcp server for a laptop

Sten Carlsen sten at s-carlsen.dk
Tue Jul 10 06:17:15 UTC 2007



Marc Chamberlin wrote:
> Hello -  I know this may go a bit beyond the pale for most users but I 
> need help configuring my home network dhcp server....
>
> I have a dual boot laptop that I use between multiple work sites and 
> home. This laptop is configured to boot up either in Windows Vista or 
> SuSE Linux and has two network connections - wired and wireless. Because 
> I am constantly moving around from one network to another I must leave 
> the laptop configured so that it receives it's IP address dynamically 
> from a local DHCP server and cannot configure it to use a fixed static 
> IP address.
>
> What I need my home DHCP server to do is to assign my laptop one 
> particular IP address if it boots up in Windows and another if it boots 
> up in Linux, regardless of which network connection (wired or wireless) 
> that I choose to use when I get home. (This is so disk mounts, and other 
> programs running on my home network will work properly when my laptop 
> enters my home network environment. Also I frequently switch between 
> wired and wireless mostly for performance purposes when transferring 
> large files but also for remote control operations.) For each OS, I do 
> assign the laptop a different host name, depending on which OS is 
> booted, to help identify it, but I cannot understand the DHCP server's 
> model well enough to figure out how this would help, though it seems it 
> should..
>
> So in a nutshell I want -
>
> OS          medium   MAC addr               IP Addr
> Linux       wired      aa:aa:aa:aa:aa:aa       192.168.2.10
> Linux       wireless   bb:bb:bb:bb:bb:bb    192.168.2.10
>
> Windows wired      aa:aa:aa:aa:aa:aa        192.168.2.20
> Windows wireless  bb:bb:bb:bb:bb:bb      192.168.2.20
>
> I searched through the archives and found one suggestion for configuring 
> dhcpd.conf for using two interfaces on a laptop so as to
> get the same IP address assigned to each, but that approach seems to 
> ignore the actual name given to the laptop. It was suggested to 
> configure it with unique DHCP host names for each MAC address as follows -
>
> group {
>     host laptopname_wired {
>          hardware    ethernet  aa:aa:aa:aa:aa:aa;
>          fixed-address 192.168.2.10;
>     }
>     host laptopname_wireless {
>           hardware   ethernet  bb:bb:bb:bb:bb:bb;
>           fixed-address 192.168.2.10
>     }
> }
>
> I guess I am thoroughly confused by the DHCP server's model of computers 
> on a network. Does it not use both the name of the laptop as supplied by 
> the laptop AND the MAC address of the interface to uniquely identify it? 
> I thought the following might work but it gives me an error instead 
> apparently because the host names are not completely unique....
>   
The names after "host" have to be unique, they could be any weird 
combination of letters, they have no relation to the hostname of the 
computer. That information is taken from the setup in your laptop or 
from options listed inside the host statement. The above is the correct 
solution using MAC addresses. There is another solution, which I use my 
self to accomplish the same thing:


host laptop_linux {
    option dhcp-client-identifier "\000lap_lin";
    fixed-address 192.168.2.10;
}

host laptop_windows {
    option dhcp-client-identifier "\000lap_win";
    fixed-address 192.168.2.10;
}

This does it for me. The way I figured out what exactly to use for 
dhcp-client-identifier was to name the computer and look in dhcp.leases 
under "uid". Some systems put the "\000" in front of the name and some 
don't. If the name you choose does not come up in dhcp.leases, you have 
to find the right place in that computer setup to place it.

This method has the strength and weakness that the MAC is not used so 
any network card that asks for an address with the same 
dhcp-client-identifier will get the same address.

Which method you prefer depends on which kind of security and control 
you want on your network.

-- 
Best regards

Sten Carlsen

No improvements come from shouting:

       "MALE BOVINE MANURE!!!" 



More information about the dhcp-users mailing list