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?