DHCP-Client
This chapter covers some aspects related to the interfaces ethernet <txt> dhcp client configuration command,
which allows to configure the Dynamic Host Configuration Protocol (DHCP) client in OSDx. DHCP client configuration could be
done in all interfaces except xfrm interfaces.
General aspects of the DHCP protocol can be found here
Operational command service dhcp-client show leases can be used to display miscellaneous information
about leases obtained by DHCP client.
Example:
admin@osdx$ service dhcp-client show leases
Interface: eth1
IP address: 10.0.0.52
Subnet mask: 255.255.255.0
Routers: 10.0.0.1
Name-servers:
Domain-name:
NTP servers:
DHCP server: 10.0.0.1
Lease time: 42831
Expiry date: Wed Sep 10 10:18:24 2025
Reason: BOUND
The other operational command service dhcp-client renew interface <ifc> can be used to renew the DHCP client leases
for a specific interface.
DHCP-Client configuration options
DHCP client configuration options is done through interfaces, which means each interface have its own independent configuration options. The different DHCP client configuration options available in OSDx are described below.
Fallback
This option allows you to configure a fallback IP address for an interface in case the DHCP client fails. It could be configured as shown.
set interfaces ethernet eth1 address dhcp
set interfaces ethernet eth1 dhcp client fallback 192.168.100.100/24
Miscellaneous information about leases look as follows.
admin@osdx# run service dhcp-client show leases
Interface: eth1
IP address: 192.168.100.100 [Fallback]
Subnet mask: 255.255.255.0 [Fallback]
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason: FAIL
Receive-default-router
This option allows to manage the default route configuration obtained via DHCP client. In OSDx, there are two different ways to manage the
default route. The first method is to disable default route installation using disable configuration command. This can be done as shown below.
set interfaces ethernet eth1 address dhcp
set interfaces ethernet eth1 dhcp client receive default-router disable
The routes installed in the system should look as follows. It is important to note that default route 0.0.0.0 is not installed.
admin@osdx$ protocols ip show route
Codes: K - kernel route, C - connected, L - local, S - static,
R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
f - OpenFabric, t - Table-Direct,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
IPv4 unicast VRF default:
C>* 192.168.100.0/24 is directly connected, eth1, weight 1, 00:02:09
L>* 192.168.100.100/32 is directly connected, eth1, weight 1, 00:02:09
The second method is to set a distance for the default route installation using distance. This is done as shown below.
set interfaces ethernet eth1 address dhcp
set interfaces ethernet eth1 dhcp client receive default-router distance 200
This time the default route is installed with a distance of 200.
admin@osdx$ protocols ip show route
Codes: K - kernel route, C - connected, L - local, S - static,
R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
f - OpenFabric, t - Table-Direct,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
IPv4 unicast VRF default:
S>* 0.0.0.0/0 [200/0] via 192.168.100.1, eth1, weight 1, 00:00:07
C>* 192.168.100.0/24 is directly connected, eth1, weight 1, 00:05:06
L>* 192.168.100.100/32 is directly connected, eth1, weight 1, 00:05:06
Rfc3442-routes
This option allows the installation of static routes received through the DHCP client, in accordance with RFC 3442. RFC 3442 defines the classless static route option for DHCP, which enables the client to receive and install one or more static routes along with the IP configuration. This can be done as shown below.
set interfaces ethernet eth1 address dhcp
set interfaces ethernet eth1 dhcp client rfc3442-routes
The routes installed in the system will look as follows.
admin@osdx$ protocols ip show route
Codes: K - kernel route, C - connected, L - local, S - static,
R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
f - OpenFabric, t - Table-Direct,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
IPv4 unicast VRF default:
S>* 5.5.5.0/24 [1/0] via 192.168.100.1, eth1, weight 1, 00:12:18
C>* 192.168.100.0/24 is directly connected, eth1, weight 1, 00:34:42
L>* 192.168.100.100/32 is directly connected, eth1, weight 1, 00:34:42
Send dhcp-client-identifier
This option sets the Client Identifier field in DHCP messages, enabling unique identification of a DHCP client in accordance with the RFC 2132.
There are three different parameters that can be used as a client identifier. The first one is base-mac configuration command, which
uses the MAC address of the DHCP client`s interface as the identifier. The second one is to use serial-number configuration command,
which uses the serial number of the DHCP client`s device as the identifier. Finally, string configuration command, which uses the
string indicated as the identifier. It is important to note that only one dhcp-client-identifier can be used at a time. The configuration
is as shown below
set interfaces ethernet eth1 dhcp client send dhcp-client-identifier base-mac
set interfaces ethernet eth1 dhcp client send dhcp-client-identifier serial-number
set interfaces ethernet eth1 dhcp client send dhcp-client-identifier string "dhcp client ID"
Send vendor-class-identifier
This option sets the vendor class identifier field in DHCP messages, this option is used by clients and servers to exchange vendor specific information. The configuration command used for this option is shown below.
set interfaces ethernet eth1 dhcp client send vendor-class-identifier string "vendor ID"
Examples
Here, you can find different examples of these options.
Command Summary
Configuration commands
interfaces ethernet <txt> dhcp client fallback <ipv4cidr|ipv6cidr>interfaces ethernet <txt> dhcp client receive default-routerinterfaces ethernet <txt> dhcp client receive default-router disableinterfaces ethernet <txt> dhcp client receive default-router distance <u32>interfaces ethernet <txt> dhcp client send dhcp-client-identifierinterfaces ethernet <txt> dhcp client send dhcp-client-identifier base-macinterfaces ethernet <txt> dhcp client send dhcp-client-identifier serial-numberinterfaces ethernet <txt> dhcp client send dhcp-client-identifier string <id>interfaces ethernet <txt> dhcp client send vendor-class-identifierinterfaces ethernet <txt> dhcp client send vendor-class-identifier string <id>