.. _dhcp-server: ########### DHCP Server ########### VyOS uses Kea DHCP server for both IPv4 and IPv6 address assignment. *********** IPv4 server *********** The network topology is declared by shared-network-name and the subnet declarations. The DHCP service can serve multiple shared networks, with each shared network having 1 or more subnets. Each subnet must be present on an interface. A range can be declared inside a subnet to define a pool of dynamic addresses. Multiple ranges can be defined and can contain holes. Static mappings can be set to assign "static" addresses to clients based on their MAC address. Configuration ============= .. cfgcmd:: set service dhcp-server hostfile-update Create DNS record per client lease, by adding clients to /etc/hosts file. Entry will have format: `_.` .. cfgcmd:: set service dhcp-server shared-network-name option domain-name The domain-name parameter should be the domain name that will be appended to the client's hostname to form a fully-qualified domain-name (FQDN) (DHCP Option 015). This is the configuration parameter for the entire shared network definition. All subnets will inherit this configuration item if not specified locally. .. cfgcmd:: set service dhcp-server shared-network-name option domain-search The domain-name parameter should be the domain name used when completing DNS request where no full FQDN is passed. This option can be given multiple times if you need multiple search domains (DHCP Option 119). This is the configuration parameter for the entire shared network definition. All subnets will inherit this configuration item if not specified locally. .. cfgcmd:: set service dhcp-server shared-network-name option name-server
Inform client that the DNS server can be found at `
`. This is the configuration parameter for the entire shared network definition. All subnets will inherit this configuration item if not specified locally. Multiple DNS servers can be defined. .. cfgcmd:: set service dhcp-server shared-network-name option vendor-option This configuration parameter lets you specify a vendor-option for the entire shared network definition. All subnets will inherit this configuration item if not specified locally. An example for Ubiquiti is shown below: **Example:** Pass address of Unifi controller at ``172.16.100.1`` to all clients of ``NET1`` .. code-block:: none set service dhcp-server shared-network-name 'NET1' option vendor-option ubiquiti '172.16.100.1' .. cfgcmd:: set service dhcp-server listen-address
This configuration parameter lets the DHCP server to listen for DHCP requests sent to the specified address, it is only realistically useful for a server whose only clients are reached via unicasts, such as via DHCP relay agents. Individual Client Subnet ------------------------- .. cfgcmd:: set service dhcp-server shared-network-name authoritative This says that this device is the only DHCP server for this network. If other devices are trying to offer DHCP leases, this machine will send 'DHCPNAK' to any device trying to request an IP address that is not valid for this network. .. cfgcmd:: set service dhcp-server shared-network-name subnet subnet-id This configuration parameter is required and must be unique to each subnet. It is required to map subnets to lease file entries. .. cfgcmd:: set service dhcp-server shared-network-name subnet option default-router
This is a configuration parameter for the ``, saying that as part of the response, tell the client that the default gateway can be reached at `
`. .. cfgcmd:: set service dhcp-server shared-network-name subnet option name-server
This is a configuration parameter for the subnet, saying that as part of the response, tell the client that the DNS server can be found at `
`. Multiple DNS servers can be defined. .. cfgcmd:: set service dhcp-server shared-network-name subnet lease