2

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?

  • You should remove the ip helper-address from the downrange switches (i.e. B and C) and place it on Switch A. – Ryan Foley Nov 30 '14 at 13:05
  • @RyanFoley For VLAN 2 right? But I've already tried that. And even so, when I use "show ip interface vlan 2" after that, it say "Helper address is not set" – Tr1et Nov 30 '14 at 13:33
  • As it stands, your 2 outer switches don't have any knowledge of VLAN 1. So you have some critical flaws right now, 1) VLAN 2 has no IP address to source from and 2) Switch B/C have no knowledge of VLAN 1 or where to go to get to that subnet. – Ryan Foley Nov 30 '14 at 13:54
  • @RyanFoley So do I have to trunk all VLAN from 1 to 1005 between A and B? – Tr1et Nov 30 '14 at 13:58
  • No, just VLAN 2 from Switch B and VLAN 3 from Switch C. – Ryan Foley Nov 30 '14 at 14:02
4

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.

| improve this answer | |
0

For a host in one VLAN to receive DHCP information from a DHCP server in another VLAN you have to configure inter-vlan routing, whether that would be a router-on-a-stick config or using a Layer 3 switch.

| improve this answer | |
  • If all computer and server connect to same MultilayerSwitch, I can set it. But when it come to multi switch, I dont know how to set trunk port and other things to make IPhelper work with each other. And does router-on-a-stick work with Server (not router). – Tr1et Nov 29 '14 at 14:16
0

Please make sure you completely understand the difference between Layer 2 and Layer 3 before proceeding.

When you're talking about trunk and access that's Layer 2, so I ignore that, since your question is about DHCP. Because DHCP relay is a layer 3 feature, you configure it on an interface of a router.

Basically the answer to your question is that you will have to configure a DHCP relay/IP helper on the router that "terminates" the layer 3 network on which you'd like to use DHCP.

Since switch A seems to be a router that routes between all 3 networks (from your drawing), for a PC connected to switch B (vlan 2) to be able to successfully perform DHCP requests (and receive answers) from a DHCP server in vlan 1, you'd configure a DHCP relay on switch A on interface vlan 2 and use as destination the IP address of the DHCP server as it is present in vlan 1.

The router routing between vlan 2 and vlan 1 will convert the DHCP broadcast to unicast and send it to the DHCP server using its own IP. It will also translate the DHCP server's reply back so that it can reach the requesting machine in vlan 2.

| improve this answer | |
0

Connection between a switch and a switch should have the ports trunked and have access ports between switch and host. Trunk ports are tagged with the vlan you want to be allowed on it that's why. Access ports strip off the tag and frames from it are defaulted to native vlan (by default this is vlan 1). To trunk the ports, assuming fa0/1 is port on switchA connecting to switchB

SwitchA(config) int fa0/1

SwitchA(config-if)switchport encapsulation dot1q

SwitchA(config-if)switchport mode trunk allowed vlan 2

do this for port on A connecting to C using vlan 3. Do this on the switches B and C too.This makes sure the switches only allow the native + the tagged vlan only.

Also, add an IP address on vlan 1, 2 and 3. Use different subnet masks. (that's what vlans do, separate LANs, separate subnets, separate broadcast domains)

SwitchA(config)#int vlan 1

SwitchA(config-if)#ip address 192.168.10.1 255.255.255.0

Have the ports to the hosts as access ports.

SwitchB(config)#int fa0/10

SwitchB(config-if)# switchport mode access

Your switches have layer 3 capability so no need for router on a stick. Enable ip routing on the switchA. No need to enable it on the others

SwitchA(config)#ip routing

SwitchA(config)#int vlan 1

SwitchA(config-if)#ip address 192.168.10.1 255.255.255.0

SwitchA(config-if)#int vlan 2

SwitchA(config-if)#ip address 192.168.20.1 255.255.255.0

then on switchB and C, set the ip helper-address on the vlans 2 and 3. I assume in this case dhcp server is in "vlan 1" so address is in its subnet, maybe a .40

SwitchB(config)#int vlan 2

SwitchB(config-if)#ip helper-address 192.168.10.40
| improve this answer | |
  • Is "switchport encapsulation dot1q" + "switchport mode trunk allowed vlan 2" equal to "switchport trunk encapsulation dot1q" + "switchport native vlan 2" + "switchport mode trunk" ? Since in Packet Tracer IOS dont have the 2 commands above. – Tr1et Nov 30 '14 at 8:50
  • It's not working. If the computer is set in VLAN 1, it worked properly when I set to be in VLAN 1 but when it is in VLAN 2, it keep saying "DHCP request failed". Please see my setting in the question. – Tr1et Nov 30 '14 at 9:22
  • The command should be switchport trunk allowed vlan 2 (or 3 to switch C), not the native vlan command. Eventually you will want to not use vlan 1 as it is the native and remove it from your trunks, but that is not really necessary now while you learn. – cpt_fink Dec 2 '14 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.