Client in two subnets. In one it should get an fixed address.

Simon Hobson dhcp1 at thehobsons.co.uk
Thu Sep 11 11:38:40 UTC 2008


Marc Muehlfeld wrote:

>How can I configure a fixed address for one host if it is connected 
>in the first subnet and when it is connected to the second, it get 
>one out of the pool?
>
>Currently when I connect PC-02 to the first subnet, it gets an IP 
>out of the 10.1.0.241 10.1.0.254 range instead out of 10.1.0.100 
>10.1.0.200. In the second subnet it gets the configured fixed 
>address, like wanted.
>



>subnet 10.1.0.0 netmask 255.255.255.0 {
>
>  option broadcast-address 10.1.0.255;
>  option routers 10.1.0.5;
>
>  # Hosts with fix IPs via DHCP
>  pool {
>   range 10.1.0.241 10.1.0.254;
>   deny unknown-clients;
>   host PC-01 { hardware ethernet AA:AA:AA:AA:AA:AA; fixed-address 10.1.0.254;}

   ^^^^^^^^^^

This is your problem, even if this device is in another subnet, it 
still inherits options from this subnet and pool - you've told the 
server to do this by putting the host declaration inside the pool & 
subnet.

The answer is to put all your host statements in the global scope.

The standard statement here is "all host statements are global in 
scope", which is a slight simplification. You have found out why we 
tell people to always put their host statements in the global scope 
unless they are doing something advanced. In almost every case when 
it's come up, the user did NOT want the 'wrong' options inherited 
from another scope.


>  }
>
>  # Printer with fix IPs via DHCP
>  pool {
>   range 10.1.0.17 10.1.0.31;
>   deny unknown-clients;
>   host PRT-1 { hardware ethernet 11:11:11:11:11:11; fixed-address 10.1.0.18;}
>  }
>
>  # All other DHCP clients
>  pool {
>   range 10.1.0.100 10.1.0.200;
>   allow unknown-clients;
>  }
>
>}
>
>
>
>subnet 10.1.1.0 netmask 255.255.255.0 {
>
>  option broadcast-address 10.1.1.255;
>  option routers 10.1.1.5;
>
>  # Hosts with fix IPs via DHCP
>  pool {
>   range 10.1.1.241 10.1.1.254;
>   deny unknown-clients;
>   host PC-02 { hardware ethernet BB:BB:BB:BB:BB:BB; fixed-address 10.1.1.254;}
>  }
>
>  # Printer with fix IPs via DHCP
>  pool {
>   range 10.1.1.17 10.1.1.31;
>   deny unknown-clients;
>   host PRT-2 { hardware ethernet 22:22:22:22:22:22; fixed-address 10.1.1.18;}
>  }
>
>  # All other DHCP clients
>  pool {
>   range 10.1.1.100 10.1.1.200;
>   allow unknown-clients;
>  }
>
>}




More information about the dhcp-users mailing list