2

I have a router with some inter-vlan connections on, the router is connected to a switch, which is connected to 3 PC's on different vlans and then the switch is connected to another router which is the DHCP server. I cannot seem to get the DHCP requests working.

Structure

R1 - Switch: 3 PC's (PC1: VLAN30, PC2: VLAN40, PC3: VLAN50), R2 - DHCP Router.

R1 Commands

interface GigabitEthernet0/1.30
encapsulation dot1Q 30
ip address 172.16.30.1 255.255.255.224

interface GigaEth0/1.40
encap dot1Q 40
ip add 172.16.40.1 255.255.255.224

int GigaEth0/1.50
encap dot1Q 50
ip add 172.16.50.1 255.255.255.224

Switch commands

PC 1 - switchport access vlan 30
PC 2 - switchport access vlan 40
PC 3 - switchport access vlan 50
Link back to R1 - trunk link

DHCP Router

ip dhcp excluded-address 172.16.30.1
ip dhcp excluded-address 172.16.40.1
ip dhcp excluded-address 172.16.50.1

ip dhcp pool forVLAN30
network 172.16.30.0 255.255.255.224
default-router 172.16.30.1
ip dhcp pool forVLAN40
network 172.16.40.0 255.255.255.224
default-router 172.16.40.1
ip dhcp pool forVLAN50
network 172.16.50.0 255.255.255.224
default-router 172.16.50.1
- link back to switch - 
ip address 172.16.50.2 255.255.255.224

For some reason the VLAN50 PC can get the DHCP request and IP but all others fail, I have tried adding helper-addresses to see if that helps but they end up at the DHCP router and then just give up.

  • Is R1 a different device than the DHCP router? – Ron Maupin Dec 28 '15 at 0:32
  • @RonMaupin R1 is a different device, imagine the diagram going down from the top, at the top is R1, then switch, on that same level is the 3 pc's, then at the bottom, connected to the switch is the DHCP router – Danny Watson Dec 28 '15 at 0:32
  • You should really just create a diagram for your question. – Ron Maupin Dec 28 '15 at 0:48
1

DHCP requests are sent from the hosts to the DHCP server via broadcast, and broadcasts don't normally cross a layer-3 boundary (router). You can either directly connect the DHCP server to each layer-2 domain, or you can use helper addresses. One way to achieve this is to use a trunk link from the switch to the DHCP router (replace interfaces as needed for the link):

Switch:

interface GigabitEthernet0/1
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 30 - 50
 switchport mode trunk
 switchport mode nonegotiate
 no shutdown
!

DHCP Router:

interface GigabitEthernet0/1.30
 encapsulation dot1Q 30
 ip address 172.16.30.2 255.255.255.224
 no shutdown
!
interface GigabitEthernet0/1.40
 encapsulation dot1Q 40
 ip address 172.16.40.2 255.255.255.224
 no shutdown
!
interface GigabitEthernet0/1.50
 encapsulation dot1Q 50
 ip address 172.16.50.2 255.255.255.224
 no shutdown
!

Another way is to put helper addresses on the R1 interfaces:

R1:

interface GigabitEthernet0/1.30
 encapsulation dot1Q 30
 ip address 172.16.30.1 255.255.255.224
 ip helper-address 172.16.50.2
!
interface GigabitEthernet0/1.40
 encapsulation dot1Q 40
 ip address 172.16.40.1 255.255.255.224
 ip helper-address 172.16.50.2
!
interface GigabitEthernet0/1.50
 encapsulation dot1Q 50
 ip addres 172.16.50.1 255.255.255.224
! Helper is not needed since the broadcast need not be routed
0

Thank you to @RonMaupin for his help.

After a bit of trying everything, I realised that while I had set the switch to R1 as a trunk link, I had not set the switch to R2 - DHCP Router as a trunk link, so it was set as an access port and only allowed VLAN50 through, hence why 30,40 could not connect.

So if you are having a similar problem to me, check if your helper-addresses are sorted, that could have been the problem from the start, and also check your trunk links.

  • @RonMaupin Loosely your answer helped find the ultimate goal so I shall give you the tick :) – Danny Watson Dec 28 '15 at 1:16

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.