# ⁣⁣dhcpr command (DHCP relay)

### Description <a href="#id-dhcprcommand-dhcprelay-description" id="id-dhcprcommand-dhcprelay-description"></a>

For DHCP protocol regular work, the server and the hosts that get the service should be allocated within one network segment – no routers should be placed in between. If the network consists of several segments, each segment should have its own DHCP server as routers block broadcast packets. One of the alternatives to this solution is installing in each segment that does not have the server DHCP Relay Agent which forwards the requests from network hosts to DHCP server. Some routers may also have a function of DHCP Relay.

{% hint style="warning" %}
**NOTE**

DHCP relay cannot be started simultaneously with DHCP server, if the device configuration contains the "*dhcpd start*" command, the relay start settings will not be applied.
{% endhint %}

**Syntax:**

```
dhcpr [add]|delete SERVERIP
dhcpr (flush|trace|notrace)
dhcpr (lock|unlock) INTERFACE
dhcpr (info|noinfo)
dhcpr (start|stop)
```

### Parameters <a href="#id-dhcprcommand-dhcprelay-parameters" id="id-dhcprcommand-dhcprelay-parameters"></a>

<table><thead><tr><th width="197">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em><strong>start | stop</strong></em></td><td>Starts / stops DHCP relay.</td></tr><tr><td><em><strong>[add]|delete SERVERIP</strong></em></td><td><p>DHCP servers listing. Adds / deletes DHCP servers to the list for which client’s requests forwarding will be made.</p><ul><li>"<em>SERVERIP</em>" – the IP-address of DHCP server<em>.</em></li></ul></td></tr><tr><td><em><strong>(lock|unlock) INTERFACE</strong></em></td><td><p>Interface blocking. By default, DHCP Relay accepts client’s requests from all network interfaces. If one of the interfaces needs to be blocked not to forward requests from it, this parameter should be used.</p><ul><li>"<em>INTERFACE</em>" – a name of one or several (separated by spaces) interfaces.</li></ul></td></tr><tr><td><em><strong>flush|trace|notrace</strong></em></td><td><p>DHCP Relay control parameters.</p><ul><li><em>"trace|notrace</em>" <em>–</em> enables/disables writing DHCP Relay’s service messages to the system log.</li><li><em>"flush</em>" <em>–</em> clears the DHCP Relay’s configurations.</li></ul></td></tr><tr><td><em><strong>info|noinfo</strong></em></td><td>Using "<em>DHCP Relay agent information</em>" option. In order to identify client’s interface when receiving server’s replies, the relay can use a special DHCP option which he appends to the client’s request packet while relaying. Not all of DHCP servers support this capability. DHCP Relay has this option turned off by default.</td></tr></tbody></table>

### Examples <a href="#id-dhcprcommand-dhcprelay-examples" id="id-dhcprcommand-dhcprelay-examples"></a>

Start of DHCP Relay.

```
dhcpr start
```

Add DHCP server with IP-address "*125.12.100.12*", delete same server from configuration.

```
dhcpr add 125.12.100.12
dhcpr delete 125.12.100.12
```

Deny accepting client’s requests from network interface "*eth0*".

```
dhcr lock eth0
```

Allow using "*DHCP Relay agent information*" option.

```
dhcpr info
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.astrawireless.net/astra-wireless-documentation/technical-documentation/astraflex-technical-user-manual/layer-3-command-set-ip-networking/dhcpr-command-dhcp-relay.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
