Cisco – How to configure IPHelper to relay DHCP with multiple switches

ciscocisco-ios

I am studying with Cisco Packet Tracer. Now I have a problem:

- A DHCP Server connect to switch A, with 3 VLAN 1,2,3
- 2 switches B,C connect to switch A, B is VLAN 2 and C is VLAN 3
- Some computer connect to B and C

enter image description here

I can use IP helper to help the computers in different VLANs contact DHCP server if all computers and server is connected into 1 switch, but I dont know how to do it in the above scenario with multiple switch. So how can I do that? And a bit of explaining is great.

Edit:
I mean that:
Should I set the port between 2 switches as Trunk or just Access?
Should I set the other Switches with IP address, IP helper address, VLAN database like the main switch?

Edit: Follow Dougrritzer and Teun Vink answer, I set as follow:

Switch A:

enable
conf t

int fa0/1
switchport trunk encapsulation dot1q
switchport native vlan 2
switchport mode trunk
exit

int fa0/3
switchport access vlan 1
switchport mode access
exit

int vlan 1
ip address 192.168.1.1 255.255.255.0
exit

int vlan 2
ip address 192.168.2.1 255.255.255.0
exit

ip routing
end

Switch B:

enable
conf t

int fa0/1
switchport trunk encapsulation dot1q
switchport native vlan 2
switchport mode trunk
exit

int fa0/2
switchport access vlan 2
switchport mode access
exit

int fa0/2
switchport access vlan 2
switchport mode access
exit

int vlan 2
ip helper-address 192.168.1.2
end

And the computers on port fa0/2 still "DHCP request failed". Am I wrong at some points?

Best Answer

Should I set the port between 2 switches as Trunk or just Access?

It really doesn't matter in this situation. Since SwB is only on VLAN 2 and SwC is only on VLAN 3, you can provide access with either a trunk/tagged port or an access port. However, if you want the management SVI on SwB and SwC to be in VLAN 1 like SwA, they will need to be trunk/tagged ports.

Should I set the other Switches with IP address, IP helper address, VLAN database like the main switch?

IP helper statements do not apply to the L2 VLAN, rather they are applied to the L3 VLAN SVI (switch virtual interface). They should be aware of the VLANs they will be configured to utilize but do not need any IP configuration (other than for management purposes).

In your example, SwA is functioning as your L3 gateway and should have an SVI for each VLAN with an appropriate IP address assigned. You would configure your IP helper statements in the SVI for VLAN 2 and VLAN 3 to refer to the IP address of your DHCP server.

When a station broadcasts out a DHCP Discover frame on the VLAN, the SVI (which exists on that VLAN) will hear it. If it has an IP helper statement configured, it will then relay/proxy the request to the configured IP address (which should be your DHCP server).

And the computers on port fa0/2 still "DHCP request failed". Am I wrong at some points?

Yes, you put your IP helper statement on an SVI on SwB (which has no IP address). It should be on the SVI for VLAN 2 on SwA.

Keep in midn that if you are configuring an SVI for the first time, it is disabled by default. To enable the SVI, you would need to add a no shutdown statement to your configurations unless you had previously configured and enabled the SVI.

This also assumes that the DHCP server is connected to Fa0/3 on SwA and that the station is connected to Fa0/2 on SwB based on your configuration above.

Edit: A final note is that your DHCP server needs to be configured to understand it is providing service for more than one network. If it hasn't been configured to do so, it may not provide the correct information necessary for the setup to work as you wish.