.. _dhcp-server: ########### DHCP Server ########### VyOS uses ISC 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 host-decl-name Will drop `_` from client DNS record, using only the host declaration name and domain: `.` .. cfgcmd:: set service dhcp-server shared-network-name 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 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 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 ping-check When the DHCP server is considering dynamically allocating an IP address to a client, it first sends an ICMP Echo request (a ping) to the address being assigned. It waits for a second, and if no ICMP Echo response has been heard, it assigns the address. If a response is heard, the lease is abandoned, and the server does not respond to the client. The lease will remain abandoned for a minimum of abandon-lease-time seconds (defaults to 24 hours). If there are no free addresses but there are abandoned IP addresses, the DHCP server will attempt to reclaim an abandoned IP address regardless of the value of abandon-lease-time. .. 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 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 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