I've read that DHCP servers add a column to your iptable in your router. A new dynamically created IP address with a network interface and a subnet mask. Then the IP address is matched with your MAC address and your client becomes part of a network.

How does the DHCP server know which network interface and subnet it should use in which process?


1 Answer 1


I've read that the DHCP server adds a column to your iptable in your router.

No. DHCP is between a host and the DHCP servers using broadcast, so the DHCP server is on the same network as the host and knows about the network.

There is also DHCP relay, where the relay stands in for the server and talks to the server for the host, telling the server which network to use. The relay must be on the same network as the host because DHCP uses broadcast.

  • Yes, but who chooses the interface and the subnet, can the computer forward this to the relay agent or something?
    – Vexea
    Nov 20, 2021 at 18:33
  • 2
    The network is the one to which the host is connected. A DHCP server on the same network as the host uses that network, or the DHCP relay tells the server the network where the relay is connected. A relay agent or the DHCP server are connected to the network where the host is connected, and that is the network used. The host has no idea if there is a relay or not, it just uses broadcast.
    – Ron Maupin
    Nov 20, 2021 at 18:38
  • When I would create a new computer and plug the ethernet cable in, can I choose wich subnet in the interface the computer is connected?
    – Vexea
    Nov 20, 2021 at 18:51
  • 1
    The network to which it is connected would already be determined by the configuration of the other devices already on the network. If all the devices connected to that network are in the network, then that is the network. Choosing a different network for your host makes no sense because it would not communicate with the other devices. The DHCP server or relay will be connected to the network and already addressed on that network.
    – Ron Maupin
    Nov 20, 2021 at 18:55
  • When you add a new computer you add it to a fysical interface right? You don't yet add it to a subnet in the interface, so how would it know wich subnet in the fysical interface or am I missing something?
    – Vexea
    Nov 20, 2021 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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