=========== DHCP-Client =========== .. sidebar:: Contents .. contents:: :depth: 3 :local: This chapter covers some aspects related to the :osdx:cfg:`interfaces ethernet * dhcp client` configuration command, used to configure the **Dynamic Host Configuration Protocol (DHCP)** client in OSDx. DHCP client configuration can be done in all interfaces except xfrm interfaces. General aspects of the DHCP protocol can be found :doc:`here ` Operational command :osdx:op:`service dhcp-client show leases` can be used to display miscellaneous information about leases obtained by the DHCP client. *Example:* .. code-block:: none 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 :osdx:op:`service dhcp-client renew interface *` operational command can be used to renew DHCP client leases for a specific interface. DHCP-Client configuration options ================================= DHCP client configuration options are set via interfaces, which means each interface has 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 the event the DHCP client fails. It can be configured as shown. .. code-block:: none 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. .. code-block:: none 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 helps manage the default route configuration obtained through the DHCP client. In OSDx, the default route can be managed in two different ways. The first one involves disabling the default route installation (using the ``disable`` configuration command). This can be done as follows: .. code-block:: none set interfaces ethernet eth1 address dhcp set interfaces ethernet eth1 dhcp client receive default-router disable The routes installed in the system should look like the ones shown below. It is important to note that default route ``0.0.0.0`` is not installed. .. code-block:: none 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 default route installation (via ``distance``). This is done as shown below: .. code-block:: none set interfaces ethernet eth1 address dhcp set interfaces ethernet eth1 dhcp client receive default-router distance 200 The default route is now installed with a distance of 200. .. code-block:: none 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 static routes received through the DHCP client to be installed in accordance with RFC 3442. RFC 3442 defines the classless static route option for DHCP, allowing the client to receive and install one or more static routes along with the IP configuration. This can be done as follows: .. code-block:: none set interfaces ethernet eth1 address dhcp set interfaces ethernet eth1 dhcp client rfc3442-routes The routes installed in the system will look like this: .. code-block:: none 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, allowing for a DHCP client to be uniquely identified in accordance with RFC 2132. Three different parameters can be used as a client identifier. The first one is the ``base-mac`` configuration command, which uses the MAC address of the DHCP client`s interface as identifier. The second one is the ``serial-number`` configuration command, which uses the serial number of the DHCP client`s device as identifier. Finally, the ``string`` configuration command uses the selected string as identifier. It is important to note that only one dhcp-client-identifier can be used at a time. The configuration is shown below. .. code-block:: none 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. Clients and servers use this option to exchange vendor-specific information. The configuration command used for this option is shown below. .. code-block:: none set interfaces ethernet eth1 dhcp client send vendor-class-identifier string "vendor ID" Examples ======== :doc:`Here ` you can find different examples involving these options. Command Summary =============== .. osdx:cmdtree:: cfg :maxdepth: 6 interfaces ethernet * dhcp .. osdx:cmdtree:: op :maxdepth: 3 service dhcp-client