TechKnowSurge
Cisco CCNA 4.6 Cisco CCNA 1.8 Cisco CCNA 4.3 Cisco CCNA 2.1
VideoNetworkFree

DEMO: DHCP Relay

DHCP relay agents enable clients on one VLAN to reach DHCP servers located on a separate network segment. This topic covers how to configure a Cisco Layer 3 switch as a relay agent for both IPv4 and IPv6 DHCP traffic.

Complete this video to capture a CTF flag worth 1 point.

About this video

DHCP discovery traffic is broadcast-based, which means it is confined to the local Layer 2 segment and cannot reach servers hosted on a different VLAN or remote network without assistance. To bridge this gap, a Layer 3 device can be configured as a relay agent, intercepting DHCP requests from clients on one segment and forwarding them as unicast traffic to a DHCP server on another. This approach is common in environments where servers are isolated on dedicated, more tightly controlled network segments for security reasons. On Cisco equipment, IPv4 DHCP relay is enabled at the VLAN interface level using the ip helper-address command followed by the IP address of the target DHCP server. For IPv6, the equivalent configuration uses ipv6 unicast-routing at the global level and ipv6 dhcp relay destination on the relevant interface, pointing to the IPv6 address of the DHCPv6 server. Once in place, the switch intercepts requests arriving on the configured interface, forwards them to the designated server, and passes the server's response back to the requesting client. The show ipv6 dhcp interface command can be used to verify that the relay destination is correctly registered and active.

What you'll learn

What's covered

DHCP Relay Agent Setup

Aligned to

Cisco CCNA
4.6 Configure and verify DHCP client and relay
1.8 Configure and verify IPv6 addressing and prefix
4.3 Explain the role of DHCP and DNS within the network
2.1 Configure and verify VLANs (normal range) spanning multiple switches

Key terms

Dynamic Host Configuration Protocol
DHCP
A network protocol that automatically assigns IP addresses and other configuration parameters to devices on a network.
Virtual LAN
VLAN
A logical grouping of network devices that behave as if they are on the same network regardless of physical location.
Layer 2
The Data Link layer of the OSI model, responsible for MAC addressing and frame delivery on a local network.
Layer 3
The Network layer of the OSI model, responsible for logical addressing and routing packets between networks.
DHCP Relay Agent
A network device configured to forward DHCP broadcast requests from one network segment to a DHCP server on a different network.
ip helper-address
A Cisco IOS command configured on a Layer 3 interface that forwards IPv4 DHCP broadcast requests to a specified DHCP server address on another network.
ipv6 dhcp relay destination
A Cisco IOS command configured on a Layer 3 interface that forwards DHCPv6 requests to a specified IPv6 DHCP server address on another network.

Topics

Dhcp Dhcp Relay Ipv6 Cisco Ios Layer 3 Switching Networking Vlan

Transcript

We've talked a lot about IP addressing, we've talked about SLAAC, we've talked about DHCP, we talked about IPv4 and IPv6. We've gone over a lot of information, but so far we've really been talking about communication that happens across a layer 2 network. That is the communication that's happening on your local area network. Broadcast and multicast, these communications that are going out on your network, are all from a layer 2 perspective.

But there are sometimes when we want to remove some of these services and put them on another network, and so what will happen is that communication doesn't get to that other network. And so what we need to do is we need to set up some sort of relay agent. We can use your Cisco devices as relay agents for this information.

In the examples we talked about, this demo Pi 2 being a DHCP version 6 server, or perhaps maybe it is just a DHCP server, whatever the case may be, this demo laptop is on a different network. So if we're talking about DHCP, that initial request is not going to go outside of VLAN 10. Same thing when it comes to DHCP version six, that initial request stays within VLAN 10, and this is part of VLAN 20. This demo Pi 2 is part of VLAN 20. So somehow we need something that's going to take these requests from VLAN 10 and send it to VLAN 20. And so what we're going to do is we're going to talk about turning this layer 3 switch into a relay agent for this information.

What's going to happen is the request is going to be sent out, whether we're talking about DHCP for IPv4 or we're talking about DHCP version 6. This demo laptop will send out the request. This layer 3 device will then take that request and then forward it on, and it could be in a very distant network. In this one it happens to be also a locally connected network, but it could be in a whole other location. And then it sends the information back to this switch right here, and then this switch then sends it to the demo laptop. So that's how this communication happens across here.

The idea behind this is that many of your servers you want on a separate network. You probably do want to put your devices that need to be more secure, and you want to control some of the access to that, so you have it on this separate network. So how do we get that DHCP response to get back to those clients?

The Configuration

One thing to note is I can actually set this up for many different services, so I can set up different layer 2 services to be forwarded onto a server, but we're just going to take it from the DHCP standpoint at this point, because that's what we're specifically talking about here.

So the first thing I'm going to do is get into the global configuration mode, and then in the global configuration mode I can do my ipv6 unicast-routing. This is the same command that we've been using to turn on SLAAC and turn on the ability to send out the router advertisements, so now we do it with this one as well.

The next thing I'm going to do is get into an interface. In this particular case, what we're doing is we're getting into the interface that we want to accept that layer 2 packets that are being sent out, frames that are being sent out. So we say interface VLAN 10 to get into that interface, so that way that is the VLAN that we are going to take those layer 2 information and forward it onto a server.

So then I'm going to type in my ip helper-address statement, and the address, 10.1.20.22, it's in a different VLAN, so that's the IP address I want to send it to. And there you have it, we set it up. Now if a DHCP request comes in for IPv4, it's going to now send it to 10.1.20.22, that demo Pi 2. It's going to send those requests onto there.

So if we want to do IPv6, then the command for IPv6 is ipv6 dhcp relay destination, and then the destination it's going to go to, which is going to be fc00:1:20::22. We're going to get that command in there, now it's going to relay that information off. For IPv6, the DHCP request is going to be sent now to that demo Pi 2 that we have.

One of the commands that we can do just to take a look at and see what's happening here: I can do a show ipv6 dhcp interface, and then the interface that we want, which is VLAN 10. Hit enter, and now we can see the relay destination that's added into there. So there you have it, this is up and functioning.

About TechKnowSurge

TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.

Explore free tools and programs →