If DHCP-server is not on same VLAN as clients, a router/multilayer switch must 'relay' DHCP messages from clients to server.
Goal:
- Create DHCP-Server in IOU1, and Relay DHCP in IOU3
- Make sure IOU5 get IP DHCP from IOU1
Configuration:
IOU1#
ip dhcp pool POOL1
network 1.1.1.0 255.255.255.0
default-router 1.1.1.1
ip dhcp pool POOL2
network 2.2.2.0 255.255.255.0
default-router 2.2.2.2
ip dhcp excluded-address 1.1.1.1 1.1.1.2
ip dhcp excluded-address 2.2.2.2
IOU3#
interface Vlan11
ip address 1.1.1.2 255.255.255.0
interface Vlan22
ip address 2.2.2.2 255.255.255.0
ip helper-address 1.1.1.1
IOU5#
interface Ethernet0/2
ip address dhcp
Verify:
IOU5#
- debug dhcp detail
- shut (int et0/2)
- no shut (int et0/2)
- sh ip int et0/2
- sh ip int br
*Sep 28 04:30:59.956: Hostname: IOU5
*Sep 28 04:30:59.956: DHCP: SRequest- Server ID option: 1.1.1.1
*Sep 28 04:30:59.956: DHCP: SRequest- Requested IP addr option: 2.2.2.4
*Sep 28 04:30:59.956: DHCP: SRequest: 305 bytes
*Sep 28 04:30:59.956: DHCP: SRequest: 305 bytes
*Sep 28 04:30:59.960: B'cast on Ethernet0/2 interface from 0.0.0.0
*Sep 28 04:30:59.973: DHCP: Received a BOOTREP pkt
*Sep 28 04:30:59.973: DHCP: Scan: Message type: DHCP Ack
*Sep 28 04:30:59.974: DHCP: Scan: Server ID Option: 1.1.1.1 = 1010101
*Sep 28 04:30:59.974: DHCP: Scan: Lease Time: 86400
*Sep 28 04:30:59.974: DHCP: Scan: Renewal time: 43200
*Sep 28 04:30:59.974: DHCP: Scan: Rebind time: 75600
*Sep 28 04:30:59.974: DHCP: Scan: Subnet Address Option: 255.255.255.0
*Sep 28 04:30:59.974: DHCP: Scan: Router Option: 2.2.2.2
*Sep 28 04:30:59.974: DHCP: rcvd pkt source: 2.2.2.2, destination: 255.255.255.255
*Sep 28 04:30:59.974: UDP sport: 43, dport: 44, length: 308
*Sep 28 04:30:59.974: DHCP op: 2, htype: 1, hlen: 6, hops: 0
*Sep 28 04:30:59.974: DHCP server identifier: 1.1.1.1
*Sep 28 04:30:59.974: xid: 236E, secs: 0, flags: 8000
*Sep 28 04:30:59.974: client: 0.0.0.0, your: 2.2.2.4
*Sep 28 04:30:59.974: srvr: 0.0.0.0, gw: 2.2.2.2
*Sep 28 04:30:59.974: options block length: 60
*Sep 28 04:30:59.974: DHCP Ack Message
IOU5(config-if)#
*Sep 28 04:30:59.974: DHCP: Lease Seconds: 86400 Renewal secs: 43200 Rebind secs: 75600
*Sep 28 04:30:59.974: DHCP: Server ID Option: 1.1.1.1
IOU5(config-if)#
*Sep 28 04:31:00.879: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/2, changed state to up
IOU5(config-if)#
*Sep 28 04:31:03.001: DHCP: Releasing ipl options:
*Sep 28 04:31:03.001: DHCP: Applying DHCP options:
*Sep 28 04:31:03.002: Setting default_gateway to 2.2.2.2
*Sep 28 04:31:03.002: Adding default route 2.2.2.2
*Sep 28 04:31:04.007: Adding route to DHCP server 1.1.1.1 via Ethernet0/2 2.2.2.2
*Sep 28 04:31:04.007: DHCP: Sending notification of ASSIGNMENT:
*Sep 28 04:31:04.007: Address 2.2.2.4 mask 255.255.255.0
*Sep 28 04:31:04.007: DHCP Client Pooling: ***Allocated IP address: 2.2.2.4
*Sep 28 04:31:04.020: Allocated IP address = 2.2.2.4 255.255.255.0
IOU5(config-if)#
*Sep 28 04:31:04.020: %DHCP-6-ADDRESS_ASSIGN: Interface Ethernet0/2 assigned DHCP address 2.2.2.4, mask 255.255.255.0, hostname IOU5
IOU5(config-if)#
*Sep 28 04:31:10.034: DHCP: Client socket is closed
IOU1#
- debug ip dhcp server events
- debug ip dhcp server packet
*Sep 28 04:30:59.945: DHCPD: Reprocessing saved workspace (ID=0x88000004)
*Sep 28 04:30:59.945: DHCPD: Sending notification of DISCOVER:
*Sep 28 04:30:59.945: DHCPD: htype 1 chaddr aabb.cc00.0520
*Sep 28 04:30:59.945: DHCPD: remote id 020a00000101010101000000
*Sep 28 04:30:59.945: DHCPD: circuit id 00000000
*Sep 28 04:30:59.945: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d61.6162.622e.6363.3030.2e30.3532.302d.4574.302f.32 through relay 2.2.2.2.
*Sep 28 04:30:59.945: DHCPD: Seeing if there is an internally specified pool class:
*Sep 28 04:30:59.945: DHCPD: htype 1 chaddr aabb.cc00.0520
*Sep 28 04:30:59.945: DHCPD: remote id 020a00000101010101000000
*Sep 28 04:30:59.945: DHCPD: circuit id 00000000
*Sep 28 04:30:59.945: DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d61.6162.622e.6363.3030.2e30.3532.302d.4574.302f.32 (2.2.2.4).DHCPD: Setting only requested parameters