DHCP Server Options
DHCP options are tagged data items that provide information to a DHCP client. The options are sent in a variable-length field at the end of a DHCP message. For more information about various DHCP options, read this topic.
Configure DHCP Server Identifier
The server identifier identifies a DHCP server in a DHCP message. It can also be used as a destination address from clients to servers (for example, when the boot file is set, but not the boot server).
To configure a DHCP server identifier, include
the server-identifier
statement at [edit access address-assignment
pool pool-name family inet dhcp-attributes
] hierarchy level.
Example:
[edit access address-assignment pool P1 family inet] dhcp-attributes { server-identifier 192.0.2.0; }
You can also include the server-identifier
statement at the following hierarchy levels:
[edit logical-systems logical-system-name access address-assignment pool pool-name family inet dhcp-attributes]
[edit logical-systems logical-system-name routing-instances routing-instance-name access address-assignment pool pool-name family inet dhcp-attributes]
[edit routing-instances routing-instance-name access address-assignment pool pool-name family inet dhcp-attributes]
Configure Address Pools for DHCP Dynamic Bindings
For dynamic bindings, set aside a pool of IP addresses that can be assigned to clients. Addresses in a pool must be available to clients on the same subnet. Configure the following options:
Network - Include the client subnet number and prefix length (in bits). The addresses in the pool must be on the subnet in which the DHCP clients reside.
Address Range -Specify the range of IP addresses in the pool that are available for dynamic address assignment. This statement is optional. If no range is specified, the pool will use all available addresses within the subnet specified. (Broadcast addresses, interface addresses, and excluded addresses are not available.)
Excluded Addresses –Specify the addresses within the range that are not used for dynamic address assignment. You can exclude one or more addresses within the range. This statement is optional.
The following is an example of a pool configuration.
[edit access address-assignment pool P1 family inet] network 192.0.2.0/24; range R1 { low 192.0.2.0; high 192.0.2.10; } excluded-address 10.3.3.33; }
Note the following when configuring address pools:
You can configure multiple address pools for a DHCP server, but only one address range per pool is supported.
DHCP maintains the state information for all pools configured. Clients are assigned addresses from pools with subnets that match the interface on which the
DHCPDISCOVER
packet is received.When more than one pool exists on the same interface, addresses are assigned on a rotating basis from all available pools.
Configure Manual (Static) DHCP Bindings Between a Fixed IP Address and a Client MAC Address
Static bindings provide configuration information for specific clients. This information can include one or more fixed Internet addresses, the client hostname, and a client identifier.
A static binding defines a mapping between a fixed IP address and the client’s MAC address.
The hardware-address variable specifies the MAC address of the client. This is a hardware address that uniquely identifies each client on the network.
The ip-address
statement specifies the
fixed IP address assigned to the client. Typically a client has one
address assigned, but you can assign more.
The following is an example of a static binding configuration:
[edit access address-assignment pool P1 family inet] host H1 { hardware-address 2c:56:dc:72:99:f3; ip-address 192.0.2.0; }
You can also include the server-identifier
statement at the following hierarchy levels:
[edit logical-systems logical-system-name access address-assignment pool pool-name family inet]
[edit logical-systems logical-system-name routing-instances routing-instance-name access address-assignment pool pool-name family inet]
[edit routing-instances routing-instance-name access address-assignment pool pool-name family inet]
Enabling TCP/IP Propagation on a DHCP Local Server
Propagation of TCP/IP Settings for DHCP
The Juniper Networks device can operate simultaneously as a client of the DHCP server in the untrust zone and a DHCP server to the clients in the trust zone. The device takes the TCP/IP settings that it receives as a DHCP client and forwards them as a DHCP server to the clients in the trust zone. The device interface in the untrust zone operates as the DHCP client, receiving IP addresses dynamically from an Internet service provider (ISP) on the external network.
During the DHCP protocol exchange, the device receives TCP/IP settings from the external network on its DHCP client interface. Settings include the address of the ISP's DHCP name server and other server addresses. These settings are propagated to the DHCP server pools configured on the device to fulfill host requests for IP addresses on the device's internal network.
This topic describes how to configure TCP/IP settings on a DHCP local server, which includes a DHCP client and a DHCP local server.
This feature is supported on SRX300, SRX320, SRX340, SRX345, SRX550M, and SRX1500 devices.
To enable TCP/IP setting propagation on a DHCP local server:
Specify DHCP Lease Times for IP Address Assignments
For clients that do not request a specific lease time, the default lease time is one day. You can configure a maximum lease time for IP address assignments or change the default lease time.
To configure maximum lease time, include the maximum-lease-time
statement:
user@host# set access address-assignment pool P1 family inet dhcp-attributes maximum-lease-time 7200
To configure default lease time, include the lease-time
statement:
user@host# set interfaces ge-0/0/1 unit 0 family inet dhcp lease-time 4100
Configure a DHCP Boot File and DHCP Boot Server
When a DHCP client starts, it contacts a boot server to download the boot file.
To configure a boot file and boot server, include
the boot-file
and boot-server
statements:
After a client receives a DHCPOFFER response from a DHCP server, the client can communicate directly with the boot server (instead of the DHCP server) to download the boot file. This minimizes network traffic and enables you to specify separate boot server/file pairs for each client pool or subnetwork.
The boot-file
statement configures the
name and location of the initial boot file that the DHCP client loads
and executes. This file stores the boot image for the client. In most
cases, the boot image is the operating system the client uses to load.
The boot-server
statement configures
the IP address of the TFTP server that contains the client’s
initial boot file. You must configure an IP address or a hostname
for the server.
You must configure at least one boot file and boot
server. Optionally, you can configure multiple boot files and boot
servers. For example, you might configure two separate boot servers
and files: one for static binding and one for address pools. Boot
file configurations for pools or static bindings take precedence over
boot file configurations at the [edit system services dhcp]
hierarchy level.
The following example specifies a boot file and server for an address pool:
[edit access address-assignment pool P1 family inet] dhcp-attributes { boot-file "boot.client"; boot-server 10.4.4.1; }
Configure Domain Name and Domain Search List
To configure the name of the domain in which clients search for a DHCP server host,
include the domain-name
statement:
The domain-name
statement sets the domain name that is appended to
hostnames that are not fully qualified. This statement is optional. If you do not
configure a domain name, the default is the client’s current domain.
[edit access address-assignment pool P1 family inet] dhcp-attributes { domain-name example.com; }
To configure a domain search list, include the option 119
statement
in hexadecimal-string using hexadecimal values. Following is an example for
'jnpr.net' domain name:
[edit access] set address-assignment pool hawk family inet dhcp-attributes option 119 array hex-string 046a6e7072036e657400
See How to configure DHCP server (JDHCPD) to support domain search (option 119).
Configure Routers Available to the DHCP Client
After a DHCP client loads the boot image and has booted, the client sends packets to a router.
To configure routers available to the DHCP client,
include the router
statement:
The router
statement specifies a list
of IP addresses for routers on the client’s subnet. List routers
in order of preference. You must configure at least one router for
each client subnet.
Example:
[edit access address-assignment pool P1 family inet] dhcp-attributes { router { 198.51.100.0; 198.51.100.1; } }
Configure User-Defined DHCP Options
You can configure one or more user-defined options that are not included in the Junos default implementation of the DHCP server. For example, if a client requests a DHCP option that is not included in the DHCP server, you can create a user-defined option that enables the server to respond to the client’s request.
To configure a user-defined DHCP option, include
the option
statement:
option { [ (id-number option-type option-value) | (id-number array option-type option-value) ]; }
The option
statement specifies the following
values:
id-number—Any whole number. The ID number is used to index the option and must be unique across a DHCP server.
option-type—Any of the following types:
byte
,byte-stream
,flag
,integer
,ip-address
,short
,string
,unsigned-integer
,unsigned-short
.array—An option can include an array of values.
option-value—Value associated with an option. The option value must be compatible with the option type (for example, an
On
orOff
value for aflag
type).
The following example shows user-defined DHCP options:
[edit access address-assignment pool P1 family inet] dhcp-attributes { option 19 flag false; option 40 string domain.tld; option 16 ip-address 10.3.3.33; }
Configure DHCP SIP Server
You can use the sip-server
statement
on the EX Series switch to configure option 120 on a DHCP server.
The DHCP server sends configured option values—Session Initiation
Protocol (SIP) server addresses or names—to DHCP clients when
they request them. You specify either an IPv4 address or a fully qualified
domain name to be used by SIP clients to locate a SIP server. You
cannot specify both an address and name in the same statement.
To configure a SIP server using the dhcp-attributes
option:
[edit access address-assignment pool P1 family inet] dhcp-attributes { sip-server 198.51.100.0; }
Overriding the Default DHCP Local Server Configuration Settings
Subscriber management enables you to override certain default DHCP local server configuration settings. You can override the configuration settings at the global level, for a named group of interfaces, or for a specific interface within a named group.
To override global default DHCP local server configuration options, include the
overrides
statement and its subordinate statements at the[edit system services dhcp-local-server]
hierarchy level.To override DHCP local server configuration options for a named group of interfaces, include the statements at the
[edit system services dhcp-local-server group group-name]
hierarchy level.To override DHCP local server configuration options for a specific interface within a named group of interfaces, include the statements at the
[edit system services dhcp-local-server group group-name interface interface-name]
hierarchy level.To configure overrides for DHCPv6 local server at the global level, group level, or per-interface, use the corresponding statements at the
[edit system services dhcp-local-server dhcpv6]
hierarchy level.
To override default DHCP local server configuration settings:
Legacy DHCP Server Configuration Options
If you are using the legacy DHCP on your device, use the following configuration options:
- DHCP Server Identifier
- Static-Binding
- Configuring Address Pools
- Maximum Lease Time
- Boot File and Boot Server
- Domain Name and Domain Search
- Router Name
- DHCP Options
- DHCP SIP Server
DHCP Server Identifier
The server identifier identifies a DHCP server in a DHCP message. It can also be used as a destination address from clients to servers (for example, when the boot file is set, but not the boot server).
You can configure DHCP server identifier in following hierarchy levels:
[edit system services dhcp] [edit system services dhcp pool] [edit system services dhcp static-binding]
Example:
The following example shows a DHCP server identifier configured for an address pool:
[edit system services dhcp] pool 10.3.3.0/24 { address-range low 10.3.3.2 high 10.3.3.254; server-identifier 10.3.3.1; }
Static-Binding
A static binding defines a mapping between a fixed IP address and the client’s MAC address.
Static bindings provide configuration information for specific clients. This information can include one or more fixed Internet addresses, the client hostname, and a client identifier.
[edit system services dhcp] static-binding mac-address { fixed-address { address; } host client-hostname; client-identifier (ascii client-id | hexadecimal client-id); }
In the static-binding configuration, you must configure following parameters:
The mac-address variable specifies the MAC address of the client. This is a hardware address that uniquely identifies each client on the network.
The
fixed-address
statement specifies the fixed IP address assigned to the client. Typically a client has one address assigned, but you can assign more.The
host
statement specifies the hostname of the client requesting the DHCP server. The name can include the local domain name. Otherwise, the name is resolved based on thedomain-name
statement.The
client-identifier
statement is used by the DHCP server to index the database of address bindings. The client identifier is either an ASCII string or hexadecimal digits. It can include a type-value pair as specified in RFC 1700, Assigned Numbers. Either a client identifier or the client’s MAC address must be configured to uniquely identify the client on the network.For each unique
client-identifier client-id
value, the DHCP server issues a unique lease and IP address from the pool. Previously, when the client provided an incorrectclient-identifier client-id
value, the DHCP server did not issue a lease.
Example:
[edit system services dhcp] static-binding 00:0d:56:f4:01:ab { fixed-address { 10.5.5.5; 10.6.6.6; } host-name "another-host.domain.tld"; client-identifier hexadecimal 01001122aabbcc; }
Configuring Address Pools
For dynamic bindings, set aside a pool of IP addresses that can be assigned to clients. Addresses in a pool must be available to clients on the same subnet. Configure the following options:
[edit system services dhcp] pool address</prefix-length> { address-range { low address; high address; } exclude-address { address; } }
Example:
[edit system services dhcp] pool 10.3.3.0/24 { address-range low 10.3.3.2 high 10.3.3.254; exclude-address { 10.3.3.33; } }
Maximum Lease Time
For clients that do not request a specific lease time, the default lease time is one day. You can configure a maximum lease time for IP address assignments or change the default lease time.
To configure maximum lease time, include the maximum-lease-time
statement:
maximum-lease-time; default-lease-time;
You can include these statements at the following hierarchy levels:
[edit system services dhcp] [edit system services dhcp pool] [edit system services dhcp static-binding]
Lease times defined for static bindings and address
pools take priority over lease times defined at the [edit system
services dhcp]
hierarchy level.
The maximum-lease-time
statement configures
the maximum length of time in seconds for which a client can request
and hold a lease. If a client requests a lease longer than the maximum
specified, the lease is granted only for the maximum time configured
on the server. After a lease expires, the client must request a new lease.
Maximum lease times do not apply to dynamic BOOTP leases. These leases are not specified by the client and can exceed the maximum lease time configured.
The following example shows a configuration for maximum and default lease times:
[edit system services dhcp] maximum-lease-time 7200; default-lease-time 3600;
Boot File and Boot Server
When a DHCP client starts, it contacts a boot server to download the boot file.
To configure a boot file and boot server, include
the boot-file
and boot-server
statements:
After a client receives a DHCPOFFER response from a DHCP server, the client can communicate directly with the boot server (instead of the DHCP server) to download the boot file. This minimizes network traffic and enables you to specify separate boot server/file pairs for each client pool or subnetwork.
boot-file filename; boot-server (address | hostname);
You can include these statements at the following hierarchy levels:
[edit system services dhcp] [edit system services dhcp pool] [edit system services dhcp static-binding]
Example:
[edit system services dhcp] pool 10.4.4.0/24 { boot-file "boot.client"; boot-server 10.4.4.1; }
Domain Name and Domain Search
domain-name domain;
You can include this statement at the following hierarchy levels:
[edit system services dhcp] [edit system services dhcp pool] [edit system services dhcp static-binding]
To configure a domain search list, include the domain-search
statement:
domain-search [ domain-list ];
You can include this statement at the following hierarchy levels:
[edit system services dhcp] [edit system services dhcp pool] [edit system services dhcp static-binding]
The domain-search
statement sets the
order in which clients append domain names when searching for the
IP address of a host. You can include one or more domain names in
the list. For more information, see RFC 3397, Dynamic Host
Configuration Protocol (DHCP) Domain Search Option.
The domain-search
statement is optional,
if you do not configure a domain search list, the default is the client’s
current domain.
Router Name
After a DHCP client loads the boot image and has booted, the client sends packets to a router.
To configure routers available to the DHCP client,
include the router
statement:
The router
statement specifies a list
of IP addresses for routers on the client’s subnet. List routers
in order of preference. You must configure at least one router for
each client subnet.
The following example shows routers configured
at the [edit system services dhcp]
hierarchy level:
router { address; }
Example:
[edit system services dhcp] router { 10.6.6.1; 10.7.7.1; }
You can include this statement at the following hierarchy levels:
[edit system services dhcp] [edit system services dhcp pool] [edit system services dhcp static-binding]
DHCP Options
You can configure one or more user-defined options that are not included in the Junos default implementation of the DHCP server. For example, if a client requests a DHCP option that is not included in the DHCP server, you can create a user-defined option that enables the server to respond to the client’s request.
Example
[edit system services dhcp] option 19 flag off; # 19: "IP Forwarding" option option 40 string "domain.tld"; # 40: "NIS Domain" option option 16 ip-address 10.3.3.33; # 16: "Swap Server" option
User-defined options that conflict with DHCP configuration
statements are ignored by the server. For example, in the following
configuration, the DHCP server ignores the user-defined option
3 router
statement and uses the router
statement
instead:
[edit system services dhcp] option 3 router 10.7.7.2; # 3: "Default Router" option router { 10.7.7.1; }
You can include this statement at the following hierarchy levels:
[edit system services dhcp] [edit system services dhcp pool] [edit system services dhcp static-binding]
DHCP SIP Server
You can use the sip-server
statement
on the EX Series switch to configure option 120 on a DHCP server.
The DHCP server sends configured option values—Session Initiation
Protocol (SIP) server addresses or names—to DHCP clients when
they request them. Previously, you were only allowed to specify a
SIP server by address using [edit system services dhcp option
120]
. You specify either an IPv4 address or a fully qualified
domain name to be used by SIP clients to locate a SIP server. You
cannot specify both an address and name in the same statement.
[edit system services dhcp] user@switch# set sip-server address
For example, to configure one address:
[edit system services dhcp] user@switch set sip-server 192.168.0.11
To configure a SIP server using the name
option:
[edit system services dhcp] user@switch# set sip-server name
For example, to configure a name:
[edit system services dhcp] user@switch set sip-server abc.example.com