summaryrefslogtreecommitdiff
path: root/docs/configuration/service/dhcp-relay.rst
blob: b489b600b2f3f438e1efc5cc1aa1490cfc156fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
.. _dhcp-relay:

##########
DHCP Relay
##########

If you want your router to forward DHCP requests to an external DHCP server
you can configure the system to act as a DHCP relay agent. The DHCP relay
agent works with IPv4 and IPv6 addresses.

All interfaces used for the DHCP relay must be configured. This includes the
uplink to the DHCP server.

**********
IPv4 relay
**********

Configuration
=============

.. cfgcmd:: set service dhcp-relay interface <interface>

   Interfaces that participate in the DHCP relay process, including the uplink
   to the DHCP server.

.. cfgcmd:: set service dhcp-relay server <server>

   Configure IP address of the DHCP `<server>` which will handle the relayed
   packets.

Options
-------

.. cfgcmd:: set service dhcp-relay relay-options hop-count <count>

   Set the maximum hop `<count>` before packets are discarded. Range 0...255,
   default 10.

.. cfgcmd:: set service dhcp-relay relay-options max-size <size>

   Set maximum `<size>` of DHCP packets including relay agent information. If a
   DHCP packet size surpasses this value it will be forwarded without appending
   relay agent information. Range 64...1400, default 576.

.. cfgcmd:: set service dhcp-relay relay-options relay-agents-packets
   <append | discard | forward | replace>

   Four policies for reforwarding DHCP packets exist:

   * **append:** The relay agent is allowed to append its own relay information
     to a received DHCP packet, disregarding relay information already present
     in the packet.

   * **discard:** Received packets which already contain relay information will
     be discarded.

   * **forward:** All packets are forwarded, relay information already present
     will be ignored.

   * **replace:** Relay information already present in a packet is stripped and
     replaced with the router's own relay information set.

Example
=======

* Listen for DHCP requests on interface ``eth1``.
* DHCP server is located at IPv4 address 10.0.1.4 on ``eth2``.
* Router receives DHCP client requests on ``eth1`` and relays them to the server
  at 10.0.1.4 on ``eth2``.

.. figure:: /_static/images/service_dhcp-relay01.png
   :scale: 80 %
   :alt: DHCP relay example

   DHCP relay example

The generated configuration will look like:

.. code-block:: none

  show service dhcp-relay
      interface eth1
      interface eth2
      server 10.0.1.4
      relay-options {
         relay-agents-packets discard
      }

Operation
=========

.. opcmd:: restart dhcp relay-agent

   Restart DHCP relay service

**********
IPv6 relay
**********

Configuration
=============

.. cfgcmd:: set service dhcpv6-relay listen-interface <interface>

   Set eth1 to be the listening interface for the DHCPv6 relay.

   Multiple interfaces may be specified.

.. cfgcmd:: set service dhcpv6-relay upstream-interface <interface>
   address <server>

   Specifies an upstream network `<interface>` from which replies from
   `<server>` and other relay agents will be accepted.

Options
-------

.. cfgcmd:: set service dhcpv6-relay max-hop-count <count>

   Set maximum hop count before packets are discarded, default: 10

.. cfgcmd:: set service dhcpv6-relay use-interface-id-option

   If this is set the relay agent will insert the interface ID. This option is
   set automatically if more than one listening interfaces are in use.

Example
=======

* DHCPv6 requests are received by the router on `listening interface` ``eth1``
* Requests are forwarded through ``eth2`` as the `upstream interface`
* External DHCPv6 server is at 2001:db8::4

.. figure:: /_static/images/service_dhcpv6-relay01.png
   :scale: 80 %
   :alt: DHCPv6 relay example

   DHCPv6 relay example

The generated configuration will look like:

.. code-block:: none

  commit
  show service dhcpv6-relay
      listen-interface eth1 {
      }
      upstream-interface eth2 {
         address 2001:db8::4
      }

Operation
=========

.. opcmd:: restart dhcpv6 relay-agent

   Restart DHCPv6 relay agent immediately.