I would like to know what commands to type in the different switches and the router to to make the router function as a dhcp server for each PC in seperate vlans . I know to create the dhcp pools in the router and I would like to use the layer 3 switch for inter-vlan routing.
2 Answers
Simply configure a DCHP relay on the SVIs with the ip helper-address <dhcp server address>
command.
Alternatively, you can configure the DHCP server on the layer-3 switch.
The built-in DHCP servers are pretty lame. For a real network, you should use a real DHCP server.
-
How do I use the L3 switch for routing the vlans and send the PCs DHCP requests ? Do I need to make a vlan between the router and L3 switch ? Apr 24, 2022 at 12:55
-
That is really a different question altogether. Normally, you set up a routed link (
no switchport
), rather than a VLAN (switchport
). Remember that a layer-3 switch has a built-in router, so you need to tell each router about the networks on the other side of the other routers. You can statically configure routes on each, or you could use a dynamic routing protocol.– Ron Maupin ♦Apr 24, 2022 at 13:00 -
Which commands should I type in the router and L3 switch to have DHCP working on the PCs belonging to seperate vlans ? I setup the dhcp pools and default router on the router already. Apr 24, 2022 at 13:44
-
It is just the DHCP relay that I explained in the answer, but you need to have routing set up properly. That is a completely different question, and it will need much more information. Just start a new question about routing. DHCP and routing really different questions. DHCP relay requires that the routing to be working.– Ron Maupin ♦Apr 24, 2022 at 13:47
-
To configure the DHCP I need to give an address to my router's interface and add that address to the L3 switch with ip helper-address ? I also need ip routing enabled on the switch ? Apr 24, 2022 at 14:11
Cisco documentation Configuring the Cisco IOS DHCP Relay Agent explains:
A DHCP relay agent is any host that forwards DHCP packets between clients and servers. Relay agents are used to forward requests and replies between clients and servers when they are not on the same physical subnet. Relay agent forwarding is distinct from the normal forwarding of an IP router, where IP datagrams are switched between networks somewhat transparently. By contrast, relay agents receive DHCP messages and then generate a new DHCP message to send out on another interface. The relay agent sets the gateway address (giaddr field of the DHCP packet) and, if configured, adds the relay agent information option (option82) in the packet and forwards it to the DHCP server. The reply from the server is forwarded back to the client after removing option 82.
The Cisco IOS DHCP relay agent supports the use of unnumbered interfaces. For DHCP clients connected though the unnumbered interfaces, the DHCP relay agent automatically adds a static host route once the DHCP client obtains an address, specifying the unnumbered interface as the outbound interface. The route is automatically removed once the lease time expires or when the client releases the address.
ip helper-address address
Example:
Router(config-if)# ip helper-address 172.16.1.2
Forwards UPD broadcasts, including BOOTP and DHCP.
•The address argument can be a specific DHCP server address, or it can be the network address if other DHCP servers are on the destination network segment. Using the network address enables other servers to respond to DHCP requests.
•If you have multiple servers, you can configure one helper address for each server.