I'm kinda confused. I'm learning VLAN's now. So I decided to make a small lab – I need to make 4 dhcp pools on Router0 (which you can see on the pictures) for VLAN 100, 200, 300, 400 (pool 100 for VLAN 100 and so on). Also, I need to configure a DHCP-relay agent on Router1 so Router0 could give addresses from pools for VLAN 300 and 400.
I don't really understand, how I should configure DHCP-relay agent. I made 4 subinterfaces on Router0 and switched Fa0/1 of Switch1 to trunk mode. I tried making subinterfaces on Fa0/1, which are leading to VLAN 300 and 400 (Fa0/1.300 encapsulation dot1q 300; Fa0/1.400 encapsulation dot1q 400)
But I don't know, what I should do with Fa0/0 of Router1, which addresses I should add to ip helper-address on subinterfaces and how I should configure routes to VLAN's. I would really appreciate your help!
Best Answer
Your network diagram does not clearly show interface/port numbers between devices. Therefore, I am trying to guess as much as I can.
1.
On the right side of your Router1, I see its Int F0/1 is connecting to Int F0/1 of right-side Switch (on which you have two VLANs 300 and 400 configured):
Int F0/1 of right-side Switch should be configured as trunk port (allowed VLANs 300 and 400) and Int F0/1 of Router1 should be configured with two subinterface F0/1.300 and F0/1.400.
You need to assign IP addresses in subnets of VLAN 300 and 400 for subinterface F0/1.300 and F0/1.400 on Router1, for example 10.10.239.253/28 and 10.10.255.253/28, respectively. These are Relay Agent IP addresses in DHCP request packets.
2.
Next, you need to configure the IP address of DHCP server (here is Router0) under Router1's two subinterfaces F0/1.300 and F0/1.400 using
ip helper-address IP_Address
command.The IP address of Router0 DHCP server you use here depends on L3 segment/network between your Router1 (Int F0/0 on the left side) and Router0.
Your network has 4 VLANs/subnets. On Router1, you already use F0/1.300 and F0/1.400 subinterfaces (in VLAN 300 and 400), therefore you have to assign an IP address in other VLANs (either VLAN 100 or 200) for Int F0/0 of Router1. Let us say we choose the VLAN 100 and create an subinterface F0/0.100 with IP: 10.10.207.253/28, then we have to configure Int F0/2 of left-side switch (connecting to F0/0 of Router1) to trunk VLAN 100 as well.
Now, the IP address of Router0 DHCP server we use for
ip helper-address IP_Address
command must be the IP address of subinterface F0/0.100 - 10.10.207.254. Because the relayed DHCP requests from Router1 is routed through VLAN 100 on left-side switch, then hit Router1 on its subinterface F0/0.100.3.
Lastly, we need to ensure that Router0 knows how to send the traffic back to Router1 DHCP Relay Agent IP addresses (10.10.239.253 and 10.10.255.253) by adding static routes for them with next-hop IP is the IP address of Router 1 F0/0.100 subinterface (10.10.207.253).
4.
I do not put the configuration for Switches here, I assume they are good with all VLANs, trunk and access ports are configured properly.
The updated full configuration on Routers and Switches:
Testing on Router0
PC in VLAN 300 (on the right side) can get IP address:
======
In this case, VLANs 300 and 400 are on the right side of the network, You should configure the IP addresses of 10.10.239.253 and 10.10.255.253 are default gateway IPs (Router1 subinterfaces) in DHCP IP Pool 300 and 400 on Router0.
======
I hope it is helpful.