ISC-DHCP-SERVER - Can different reservations get different options (router, DNS, etc)?

10,158

It should be as simple as doing something like this.

host windows-matt-2 {
  option domain-name-servers 1.2.3.4;
  option domain-name "foo";
  option routers 5.6.7.8;
  option broadcast-address 10.100.255.255;
  default-lease-time 600;
  max-lease-time 7200;
  hardware ethernet 00:1f:d0:a1:55:5d;
  fixed-address 10.100.101.21;
}

subnet 10.100.0.0 netmask 255.255.0.0 {
  range 10.100.201.1 10.100.201.254;
  option domain-name-servers 10.100.1.1;
  option domain-name "lundfam.local";
  option routers 10.100.1.1;
  option broadcast-address 10.100.255.255;
  default-lease-time 600;
  max-lease-time 7200;
}
Share:
10,158

Related videos on Youtube

Matthew Lund
Author by

Matthew Lund

Object-oriented design involves trade-offs. In some cases there are perfectly optimal solutions but usually you can do things several different ways and the best choice is based on trade-offs.

Updated on September 18, 2022

Comments

  • Matthew Lund
    Matthew Lund almost 2 years

    Suppose there's just one Ubuntu / ISC-DHCP (v3) server on the network. I've successfully been able to provide "DHCP reservations" meaning MAC foo gets ip 1.2.3.4, whereas everyone else just gets an address from a pool, etc.

    But is it possible to only make the address specific to a particular reservation but also other options like the router and DNS servers?

    Example: I want computers 1, 2, and 3 to get addresses from the 192.168.100.10 to 192.168.100.20 range, use 192.168.100.1 as the router, and use 192.168.100.2 and 192.168.100.3 as the DNS servers.

    But I want computer 4 to get a particular address (let's say 192.168.100.21), use 192.168.100.4 as the router, and use 192.168.100.5 as the DNS server.

    This is my attempt, but I don't think it's right:

    subnet 10.100.0.0 netmask 255.255.0.0 {
      option domain-name-servers 1.2.3.4;
      option domain-name "foo";
      option routers 5.6.7.8;
      option broadcast-address 10.100.255.255;
      default-lease-time 600;
      max-lease-time 7200;
    
      host windows-matt-2 {
        hardware ethernet 00:1f:d0:a1:55:5d;
        fixed-address 10.100.101.21;
      } 
    }
    
    subnet 10.100.0.0 netmask 255.255.0.0 {
      range 10.100.201.1 10.100.201.254;
      option domain-name-servers 10.100.1.1;
      option domain-name "lundfam.local";
      option routers 10.100.1.1;
      option broadcast-address 10.100.255.255;
      default-lease-time 600;
      max-lease-time 7200;
    }
    
  • Matthew Lund
    Matthew Lund over 12 years
    I'll try that out!
  • Matthew Lund
    Matthew Lund over 12 years
    This worked. Regarding your last comment, could I make the name servers, domain name, routers, and the broadcast address defaults as well (and only override them as needed)? Or would it just be limited to default-lease-time and max-lease-time in my case?
  • Zoredache
    Zoredache over 12 years
    I usually set the domain name and lease times globally (outside of a scope). The broadcast address should not be required at all for any modern OS/network. The only things you should need to set as part of the per-host reservations are things that will be different from the scope/global settings.