0

I have dhcpd running with multiple subnets. I have duplicated MAC address, but in different subnets, which are configured as different VLANS. Can this MAC bring some problems to DHCP?

How DHCP knows, that the lease request comes from different VLANS? Will it give addresses properly?

2
  • MAC address is specific address for each network device like network card.When you didnt do MACChanger.It was not same MAC Address.DHCP server can not cross VLAN.You should configure DHCP Relay Agent for another subnets. Commented Jan 10, 2017 at 13:15
  • The DHCP Relay link here : access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/… Commented Jan 10, 2017 at 13:21

2 Answers 2

1

The answer to your question is yes, this works very well.

During startup the isc dhcpd server will first read subnet blocks in its configuration file. After this the daemon determines which interfaces to use based on matching subnets. As soon as the server is started client DHCP requests are answered. Those are handled based on the interface the request is made to. The MAC address of the server interface is irrelevant during this process.

Suppose you have two VLANs available. The VLANs normally derive their MAC address from their parent interface, so it is very well possible you have duplicate MAC addresses:

[test@testrouter ~]$ ip addr show enp3s0.2

2: enp3s0.2@enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue    state UP group default qlen 1000
link/ether 02:00:00:00:00:20 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.1/24 brd 192.168.2.255 scope global enp3s0.20 valid_lft forever preferred_lft forever

[test@testrouter ~]$ ip addr show enp3s0.3

3: enp3s0.3@enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 02:00:00:00:00:20 brd ff:ff:ff:ff:ff:ff
inet 192.168.3.1/24 brd 192.168.3.255 scope global enp3s0.20 valid_lft forever preferred_lft forever

Now, we create two subnets in the dhcpd.conf file like this:

subnet 192.168.2.0 netmask 255.255.255.0 {
  range 192.168.2.101 192.168.2.151;
 option subnet-mask 255.255.255.0;
  option routers 192.168.2.1;
}

 subnet 192.168.3.0 netmask 255.255.255.0 {
  range 192.168.3.101 192.168.3.151;
  option subnet-mask 255.255.255.0;
  option routers 192.168.3.1;
}

During startup of the dhcpd server the following messages appear in the log file:

[test@testrouter ~]$ journalctl -u dhcpd | grep LPF

dhcpd[1263]: Listening on LPF/enp3s0.2/02:00:00:00:00:20/192.168.2.0/24
 dhcpd[1263]: Sending on   LPF/enp3s0.2/02:00:00:00:00:20/192.168.2.0/24
 dhcpd[1263]: Listening on LPF/enp3s0.3/02:00:00:00:00:20/192.168.3.0/24
 dhcpd[1263]: Sending on   LPF/enp3s0.3/02:00:00:00:00:20/192.168.3.0/24

As you can see the right interface is matched. The 192.168.3.0/24 subnet is served via the enp3s0.3 interface, although the MAC address of both interfaces is the same.

Last but not least: It is possible to change the MAC address of a VLAN interface. Please use the ip command like this:

ip link set dev enp3s0.3 address 02:00:00:00:00:20
4
  • That's not correct, the MAC address is actually what is only used by basically all DHCP servers, after all it is supposed to be identifying your interface uniquely. Commented Jan 3, 2017 at 1:40
  • 1
    phk, as shown in the example, the ip address is used by dhcpd to determine on which serverinterface to listen. I can assure you the example is working. Maybe you mean that the MAC address can be used to identify a client interface. Commented Jul 12, 2018 at 19:28
  • I stand corrected. Commented Jul 14, 2018 at 16:17
  • great changes/ additions to the answer phk, thanks! Commented Jul 16, 2018 at 0:51
0

In a correct VLAN implementation each VLAN has a unique subnet.

As you say your DHCP server knows that the MAC address is associated with different subnets. In that sense the DHCP knows indirectly they are associated with different VLANs.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.