# Viewing and Deleting DHCP Client Bindings

The JunosE Software provides commands that enable you to manage your router’s DHCP external server, DHCP local server, and DHCP relay proxy client bindings. A client binding associates an IP address with a DHCP client, and describes both the client (for example, hardware address and state) and the IP address (for example, subnet and lease time).

The following commands enable you to view information about current DHCP client bindings:

- To display information and track lease times and status for specified DHCP client bindings, with results arranged in ascending order by binding ID, use the show dhcp binding command.
- To display information and track lease times and status for specified DHCP client bindings, with results arranged in ascending order by IP address, use the show dhcp host command. This command displays information only for DHCP client bindings with assigned IP addresses.
- To display count information for DHCP client bindings and interfaces, use the show dhcp count command.

To delete a connected user's IP address lease and the associated route configuration when the DHCP client binding is no longer needed, use the dhcp delete-binding command. When you delete a DHCP client binding, the lease is removed on the router. You might delete client bindings to:

- Recover functional resources from a user who has not explicitly terminated connectivity and whose lease is unexpired.
- Discontinue connectivity to a user, prompting or forcing the user to request a new lease in order to reestablish network connectivity.

The router does not notify the DHCP client or the DHCP server when you issue the dhcp delete-binding command.

| Note: The dhcp delete-binding command replaces the clear ip dhcp-local binding and dhcp-external delete-binding commands, which are deprecated and might be removed in a future release.

Use the following keywords and variables with the dhcp delete-binding command to specify (filter) the client bindings you want to delete:

- all—All DHCP local server, DHCP external server, and DHCP relay proxy client bindings
- all-local—All DHCP local server client bindings
- all-external—All DHCP external server client bindings
- all-relay-proxy—All DHCP relay proxy client bindings
- binding-id—DHCP binding ID for a specific client
- circuit-id—Agent-circuit-id suboption (suboption 1) string of the DHCP relay agent information option (option 82); the circuit ID string supports matching of both regular expression metacharacters and nonprintable ASCII characters in binary sequences
- external—DHCP external server bindings that meet the deletion criteria
- interface—Interface string associated with DHCP client bindings; the interface string supports matching of regular expression metacharacters, and must be specified as a regular expression without spaces
- ip-prefix—IP prefix (address and subnetwork mask) of the DHCP client
- local—DHCP local server bindings that meet the deletion criteria
- no-interface—DHCP clients without a lower-layer interface; use this keyword to delete DHCP client bindings configured over dynamic interfaces for which the lower-layer interface has been shut down
- relay-proxy—DHCP relay proxy bindings that meet the deletion criteria
- remote-id—Agent-remote-id suboption (suboption 2) string of the DHCP relay agent information option (option 82); the remote ID string supports matching of both regular expression metacharacters and nonprintable ASCII characters in binary sequences
- subnetAddress—IP address of the subnet on which the DHCP client resides

Filtering the deletion of DHCP client bindings by the circuit ID string or remote ID string is not supported for the DHCP external server application. DHCP external server does not store information about the agent-circuit-id suboption or agent-remote-id suboption of option 82.

You can remove all DHCP client bindings, all DHCP client bindings of a particular type, or a specified DHCP client binding that meets the deletion criteria you specify.

- To delete all DHCP client bindings on virtual router vr1:
  host1:vr1#dhcp delete-binding all
- To delete DHCP local server client bindings with the specified subnet address:
  host1:vr2#dhcp delete-binding local 0.0.0.0

  When you delete DHCP client bindings of a particular type on a specified subnet, you must specify the local, external, or relay-proxy type keyword to prevent accidental deletion of all DHCP client bindings.

- To delete a specific DHCP client binding:
  host1:vr1#dhcp delete-binding 3972819365
- To delete DHCP client bindings with the specified IP prefix:
  host1:vr1#dhcp delete-binding ip-prefix 10.1.0.0/28
- To delete DHCP client bindings without a lower-layer interface:
  host1:vr1#dhcp delete-binding no-interface
- To delete DHCP client bindings with the specified interface string:
  host1:vr2#dhcp delete-binding interface ip71.*4

  This dhcp delete-binding command uses the * (asterisk) regular expression metacharacter in the interface string to delete DHCP client bindings on virtual router vr2 with an IP address beginning with 71 and ending with 4.

- To delete DHCP client bindings that match the specified circuit ID string:
  host1:vr3#dhcp delete-binding circuit-id \\xe3

  To specify nonprintable byte codes in the circuit ID string or remote ID string, you can use the string \\xab, where ab is a hex code of the byte. This dhcp delete-binding command uses the string \\xe3 to represent byte E3 in the circuit ID string. This command deletes DHCP client bindings on virtual router vr3 with the specified circuit ID string.

#### Related Documentation

- dhcp delete-binding
- show dhcp binding
- show dhcp count
- show dhcp host