Configuring Routers, Switches, and Interfaces as DHCP and BOOTP Relay Agents
You can configure the router, switch, or interface to act as a Dynamic Host Configuration Protocol (DHCP) and Bootstrap Protocol (BOOTP) relay agent. This means that a locally attached host can issue a DHCP or BOOTP request as a broadcast message. If the router, switch, or interface sees this broadcast message, it relays the message to a specified DHCP or BOOTP server.
You should configure the router, switch, or interface to be a DHCP and BOOTP relay agent if you have locally attached hosts and a distant DHCP or BOOTP server. For MX Series routers connected via IRB, see the note below to prevent BOOTP reply packets from being dropped.
To configure the router or switch to act as a DHCP and BOOTP
relay agent, include the bootp
statement at the [edit
forwarding-options helpers]
hierarchy level:
[edit forwarding-options helpers] bootp { client-response-ttl number; description text-description; interface (interface-name | interface-group) { client-response-ttl number; description text-description; maximum-hop-count number; minimum-wait-time seconds; no-listen; server address { logical-system logical-system-name <routing-instance [ <default> routing-instance-names ]>; routing-instance [ <default> routing-instance-names ]; } } maximum-hop-count number; minimum-wait-time seconds; relay-agent-option; server server-identifier { <logical-system logical-system-name> <routing-instance [ routing-instance-names ]>; } }
To set the description of the BOOTP service, DHCP service, or
interface, include the description
statement.
To set a logical interface or a group of logical interfaces
with a specific DHCP relay or BOOTP configuration, include the interface
statement.
To set the routing instance of the server to forward, include
the routing-instance
statement. You can include as many
routing instances as necessary in the same statement.
To stop packets from being forwarded on a logical interface,
a group of logical interfaces, or the router or switch, include the no-listen
statement.
To set the maximum allowed number in the hops field of the BOOTP
header, include the maximum-hop-count
statement. Headers
that have a larger number in the hops field are not forwarded. If
you omit the maximum-hop-count
statement, the default value
is four hops.
To set the minimum allowed number of seconds in the secs field of the BOOTP header, include the minimum-wait-time
statement. Headers that have a smaller number in the secs field are not forwarded. The default value for the minimum wait
time is zero (0).
To set the IP address that specify the DHCP or BOOTP server
for the router, switch, or interface, include the server
statement. You can include multiple server
statements.
To set an IP time-to-live (TTL) value for DHCP response packets
sent to a DHCP client, include the client-response-ttl
statement.
To use the DHCP relay agent option in relayed BOOTP/DHCP messages,
include the relay-agent-option
statement. This option is
primarily useful for enabling DHCP forwarding between different VRF
routing instances. This option is documented in RFC 3046, DHCP Relay Agent Information Option.
You can also configure an individual logical interface to be a DHCP and BOOTP relay agent if you have locally attached hosts and a remote DHCP or BOOTP server connected to one of the router's or switch’s interfaces. For more information, see the Junos OS Administration Library for Routing Devices.
The following example demonstrates a BOOTP relay agent configuration.
user@host# show forwarding-options helpers { bootp { description "dhcp relay agent global parameters"; server 192.168.55.44; server 172.16.0.3 routing-instance c3; maximum-hop-count 10; minimum-wait-time 8; interface { fe-1/3/0 { description "use this info for this interface"; server 10.10.10.10; server 192.168.14.14; maximum-hop-count 11; minimum-wait-time 3; } fe-1/3/1 { no-listen; ###ignore DHCPDISCOVER messages on this interface } all { description "globals apply to all other interfaces"; } } } }
To use bootp helper
on a MX Series router
(MX80, MX240, MX480 and MX960) connected via IRB, you may need to
take steps to ensure that DHCP discover packets (the bootp reply)
are sent to clients and received as expected. Otherwise, bootp replies may be dropped because the DHCP client
is clearing the broadcast bit in the discover packet, or because the
DHCP server is stripping option-82 flags
from the offer.
This happens when the IRB interface is a layer 3 (logical) interface associated with a bridge domain that has multiple layer 2 (physical) interfaces associated with it. In such cases, if the offer from the DHCP server is unicast and doesn’t include an ingress interface identifying the physical interface on which the discovery packet was received, the MX router won’t be able to determine an interface for sending out offers.
Enable
broadcast
on the IRB interface to flood discovery frames from all physical interfaces in the bridge domain. For example,user@host# edit forwarding-options helpers bootp interface irb.o broadcast; server 202.67.4.1; }
or,
Enable
relay-agent-option
on the bootp helper. For example,user@host# edit forwarding-options helpers bootp relay-agent-option; server 202.67.4.1; }
Configure the IRB interface connected to the DHCP server so it echoes option-82 flags back to the router. This will ensure that the option-82 string, which identifies the interface used by the router, is preserved.