3

First of all, I'd like to point out that I've read any related questions asked here.

So, on my desktop computer (running Ubuntu) I have three NICs - eth0, eth2, eth3. I have links connecting these ports to a switch (proprietary of the company I am part of). eth0 is configured as the DHCP server (isc-dhcp). In the switch, eth2 is part of VLAN20 (10.0.20.1/24) and eth3 is part of VLAN10(10.0.10.1/24). eth0 (the dhcp server) is part of VLAN30(10.0.30.1/24). The server IP address is 10.0.30.2. Currently, the dhcp server successfully assigns ip addresses in the 10.0.30 subnet (I believe due to the fact that this is the subnet the server is part of). So, eth2 is 10.0.30.10 and eth3 is 10.0.30.11 (the pool is 10.0.30.10 - 10.0.30.100).

However, I would like to be able to assign IP addresses corresponding to the subnet of the interface. For example, eth3 is part of VLAN10(10.0.10.1/24), so it should get a 10.0.10.x address, and eth2 should get a 10.0.20.x address. I want the DHCP server to assign IP addresses depending on the subnet the client is in.

I did some reading and I realized that DHCP relay is needed. I configured this on my switch for VLAN 10 and VLAN 20. Also, I enabled option-82 for DHCP. I also installed isc-dhcp-relay and in the dhcp-relay.conf file I added the ip address of the server (10.0.30.2) and the interface of the server (eth0). I tracked some packets with Wireshark and noticed that the clients (eth2 and eth3) are communicating with the relay agent successfully.

What am I missing and what should I configure more to make the DHCP server assign different IP addresses for different subnets/vlans?

  • dhcp relay is not needed for a multihomed DHCP server. – Rui F Ribeiro May 27 '16 at 13:43
  • how come? isn't that exactly the way for the switch to find out the subnet the client is part of? AFAIK, the dhcp relay agent acts as a mediator between the client and the server, and the server can find out the subnet address of the client based on information provided by the relay agent, describing at which port the relay agent received the packet (i.e. the client's port) – nenko182 May 27 '16 at 18:23
  • If you have a leg of the DHCP server in each network, you do not need the relay. The relay is only needed to proxy the DHCP requests of several networks to a specific IP in one network; as the DHCP has an IP/is listening in each network, this is not needed. Plus usually the relay is configured in the firewall/router of those networks, and not in the DHCP server. I have here a corporate network with a couple hundred VLANs, and a cluster of two DHCP servers in one network answering to all VLANs. – Rui F Ribeiro May 27 '16 at 18:32
  • okay, so, I did the configuration without the dhcp relay agent. however, the ports still get an ip address from the pool, which the server is in. I want the ports to get an ip address corresponding to the subnet they are in. – nenko182 May 31 '16 at 10:47

Your Answer

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

Browse other questions tagged or ask your own question.