- With DHCP it's also possible
that we need to configure an iOS device
as a DHCP relay agent.
By default, routers will not forward broadcasts.
So the DHCP discover message
that gets sent out from a DHCP client,
that is a broadcast message.
So if we look at our two clients here
that are setting on a different network
from our DHCP server.
If those are on different subnets
as we see in this topology,
the DHCP discover broadcast message
would never reach the server
and the client would not be able to obtain an IP address.
That's the case that we see here.
And that's where we would use a DHCP relay agent.
A DHCP relay agent will simply receive DHCP messages
from a client, and will then generate
a new DHCP message to be sent out
a different interface over to the DHCP server.
So, we can see that again in our topology here
we have two subnets.
We have a client within the 192.168.1.0/24 network.
As a matter of fact, we have two clients there
connected to a switch, and we have a DHCP server
over in the 192.168.2.0/24 network.
And we have a router sitting between those networks
which is router one.
Let's jump on to our DHCP server here.
And let's go ahead and say show run pipe to begin.
And we'll say IP DHCP pool, just to take a look
at that configuration.
And we'll see in this output.
We have a DHCP pool configured that's named pool one,
and that is configured for the 192.168.1.0/24 subnets.
If we break out of this command
and we say show IP DHCP binding,
you'll see that we have no bindings currently.
We don't have anything in there
let's say show IP DHCP pool.
So again we can see our pool
we have a total of 254 addresses.
We currently have zero leased addresses in this pool.
So let's fix that.
Let's go over to our first host.
Let's go over to PC one right here let's go under
global configuration under interface gig 0/1,
which is the interface that's connecting into that switch.
And it's currently shut down.
So let's just do a no shut command.
We'll jump over to PC two, we'll do the same thing.
We'll go under interface gig 0/1
which is the interface that's connected into the switch,
and we'll say no shut.
Now we would expect, if we jump back over
to our DHCP server.
If we say, show IP DHCP bindings,
we would expect to see some bindings there perhaps.
But we do not see any bindings,
and that is again because those
DHCP discover broadcast messages
are not currently being passed over to this DHCP server,
because it's on a different network.
So how can we fix that?
Well that's a case where we would want to configure
a DHCP relay agent.
So let's go over to router one.
And let's go under global configuration mode,
and let's first say we want to go under
the interface gig 0/1 that is the interface
that's local to the host's network that's very important.
That is the interface on which you want to configure
the IP helper-address.
So whichever interface is in the same network
as your client's that's where you want to configure
the IP helper-address and you want to point that
to the DHCP server.
So we can do that very simply by saying
IP helper-address, and we'll follow that
with the IP address of the DHCP server itself,
which is 192.168.2.200
we hit Enter and so at this point,
this router is going to receive
the DHCP discover messages from our clients,
and it's going to generate a new DHCP message
and send that over to the DHCP server on the other network.
Let's go back to our server.
And let's again say show IP DHCP bindings,
and this time we can see our hosts
do have a valid IP address, within our DHCP pool
as we would expect to see.
And also we see that the switch has now been able
to obtain IP addresses in that same subnet
the 192.168.1.0/24 subnet.
So for troubleshooting these types of issues
if your DHCP server is on a subnet separate from your hosts,
you'll likely need a DHCP relay agent
configured in the manner that we've just looked at.
So that's the first place to look.
You want to make sure whether or not your host,
and your DHCP server share a network
that's your first step in troubleshooting.
Remember that you can use those debug commands
that we looked at previously
to see exactly where the DHCP process is failing.
So if you're not seeing any DHCP discover messages at all
that indicates some sort of problem.
It could indicate a potential Layer two issue
and it's also possible that the client interface
may be incorrectly configured,
and it isn't set up to obtain a DHCP address.
Or it could be that your IP helper-address
if that's already configured,
maybe that's configured incorrectly
maybe it has the wrong DHCP servers IP address.
I'll also point out that if you're using IP version six,
the same troubleshooting principles apply,
but the command is slightly different.
There is no broadcast within IP version six,
and there's no IP version six helper-address command.
If the DHCP version six server is in another network,
the router interface that is local to the hosts
needs to be configured as a relay agent with a command.
And actually, let me go back into router one.
And I'll just type that command out
so that you can actually see it because
it is a bit different syntax.
So you want to say IP version six DHCP relay destination.
And then of course you would want
to follow that with the IP version six address
of the DHCP server, just as we did with the IP version four
IP-helper command so that's the variation
for IP version six.
So that's a look at using a DHCP relay agent,
and the areas that you might want to check out
when troubleshooting DHCP in a network such as this.