Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

{
  # dhcpd.conf
  #
  # Sample configuration file for ISC dhcpd
  #
  # option definitions common to all supported networks...
  /// This configuration declares some subnets but has no interfaces-config
  /// Reference Kea #245
  "Dhcp4": {
    "option-data": [
      {
        "space": "dhcp4",
        "name": "domain-name",
        "code": 15,
        "data": "example.org"
      },
      #option domain-name-servers ns1.example.org, ns2.example.org;
      {
        "space": "dhcp4",
        "name": "domain-name-servers",
        "code": 6,
        "data": "10.35.0.1, 10.35.0.2"
      }
    ],
    "valid-lifetime": 600,
    "max-valid-lifetime": 7200,
//  "config": [
//    /// log-facility is not supported
//    /// Please use the KEA_LOGGER_DESTINATION environment variable instead
//    {
//      "name": "log-facility",
//      "code": 44,
//      "value": "local7"
//    }
//  ],
    "subnet4": [
      # No service will be given on this subnet, but declaring it helps the 
      # DHCP server to understand the network topology.
      {
        "id": 1,
        "subnet": "10.152.187.0/24"
      },
      # This is a very basic subnet declaration.
      {
        "id": 2,
        "subnet": "10.254.239.0/27",
        "pools": [
          {
            "pool": "10.254.239.10 - 10.254.239.20"
          }
        ],
        "option-data": [
          # option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
          {
            "space": "dhcp4",
            "name": "routers",
            "code": 3,
            "data": "10.254.239.1, 10.254.239.2"
          }
        ]
      },
      # This declaration allows BOOTP clients to get dynamic addresses,
      # which we don't really recommend.
      {
        "id": 3,
        "subnet": "10.254.239.32/27",
        "pools": [
          {
            "pool": "10.254.239.40 - 10.254.239.60"
          }
        ],
        "option-data": [
          {
            "space": "dhcp4",
            "name": "broadcast-address",
            "code": 28,
            "data": "10.254.239.31"
          },
          # option routers rtr-239-32-1.example.org;
          {
            "space": "dhcp4",
            "name": "routers",
            "code": 3,
            "data": "10.254.239.33"
          }
        ]
      },
      # A slightly different configuration for an internal subnet.
      {
        "id": 4,
        "subnet": "10.5.5.0/27",
        "pools": [
          {
            "pool": "10.5.5.26 - 10.5.5.30"
          }
        ],
        "option-data": [
          # option domain-name-servers ns1.internal.example.org;
          {
            "space": "dhcp4",
            "name": "domain-name-servers",
            "code": 6,
            "data": "10.35.1.1"
          },
          {
            "space": "dhcp4",
            "name": "domain-name",
            "code": 15,
            "data": "internal.example.org"
          },
          {
            "space": "dhcp4",
            "name": "routers",
            "code": 3,
            "data": "10.5.5.1"
          },
          {
            "space": "dhcp4",
            "name": "broadcast-address",
            "code": 28,
            "data": "10.5.5.31"
          }
        ],
        "valid-lifetime": 600,
        "max-valid-lifetime": 7200,
        /// Host reservations without fixed addresses were put in the last declared subnet
        /// Reference Kea #231
        "reservations": [
          # Hosts which require special configuration options can be listed in
          # host statements.   If no address is specified, the address will be
          # allocated dynamically (if possible), but the host-specific information
          # will still come from the host declaration.
          {
            "hostname": "passacaglia",
            "hw-address": "00:00:c0:5d:bd:95",
            "boot-file-name": "vmunix.passacaglia",
            "server-hostname": "toccata.example.com"
          },
          # Fixed IP addresses can also be specified for hosts.   These addresses
          # should not also be listed as being available for dynamic assignment.
          # Hosts for which fixed IP addresses have been specified can boot using
          # BOOTP or DHCP.   Hosts for which no fixed address is specified can only
          # be booted with DHCP, unless there is an address range on the subnet
          # to which a BOOTP client is connected which has the dynamic-bootp flag
          # set.
          {
            "hostname": "fantasia",
            "hw-address": "08:00:07:26:c0:a5",
            "ip-address": "10.5.5.20"
          }
        ]
      }
    ],
    "host-reservation-identifiers": [
      "hw-address"
    ],
    "client-classes": [
      # You can declare a class of clients and then do address allocation
      # based on that.   The example below shows a case where all clients
      # in a certain class get addresses on the 10.17.224/24 subnet, and all
      # other clients get addresses on the 10.0.29/24 subnet.
      {
        "name": "foo",
        /// from: match if (substring(option dhcp.vendor-class-identifier, 0, 4)) = 'SUNW'
        "test": "substring(option[60].hex,0,4) == 'SUNW'"
      },
      {
        "name": "gen#_AND_#!foo#",
        "test": "not member('foo')"
      }
    ],
    /// Kea shared-networks are different, cf Kea #236
    "shared-networks": [
      {
        "name": "224-29",
        "subnet4": [
          {
            "id": 5,
            "subnet": "10.17.224.0/24",
            "option-data": [
              #   option routers rtr-224.example.org;
              {
                "space": "dhcp4",
                "name": "routers",
                "code": 3,
                "data": "10.17.224.1"
              }
            ],
            "pools": [
              {
                "pool": "10.17.224.10 - 10.17.224.250",
                /// From:
                ///   allow foo
                "client-class": "foo"
              }
            ]
          },
          {
            "id": 6,
            "subnet": "10.0.29.0/24",
            "option-data": [
              #   option routers rtr-29.example.org;
              {
                "space": "dhcp4",
                "name": "routers",
                "code": 3,
                "data": "10.0.29.1"
              }
            ],
            "pools": [
              {
                "pool": "10.0.29.10 - 10.0.29.230",
                /// From:
                ///   deny foo
                "client-class": "gen#_AND_#!foo#"
              }
            ]
          }
        ]
      }
    ]
  }
}