1

Are there any limits to how many addresses can be assigned to one client DHCP host from DHCP server? Can I assign whole /8 subnet to one interface via DHCP?

MrSnowMan
  • 119
  • 2

1 Answers1

2

Are there any limits to how many addresses can be assigned to one client DHCP host from DHCP server?

IPv6

No. An IPv6 DHCP server can advertise any prefix size to clients that request prefix delegation.

IPv4

In most common scenarios only one for each interface as the DHCP response is based on the MAC address of the requesting NIC and AFAIK only designed to carry a single IP-address

Having said that, from the client you can request more than one ip-address , with a bit of additional configuration, as the reference ISC DHCP client does support the creation of a "pseudo" interface, with which you can request a single extra address for each pseudo interface that you create.

man dhclient.conf

pseudo "name" "real-name" { declarations ... }

Under some circumstances it can be useful to declare a pseudo-interface and have the DHCP client acquire a configuration for that interface. Each interface that the DHCP client is supporting normally has a DHCP client state machine running on it to acquire and maintain its lease. A pseudo-interface is just another state machine running on the interface named real-name, with its own lease and its own state.

If you use this feature, you must provide a client identifier for both the pseudo-interface and the actual interface, and the two identifiers must be different. You must also provide a separate client script for the pseudo-interface to do what you want with the IP address. For example:

  interface "ep0" {
        send dhcp-client-identifier "my-client-ep0";
   }
   pseudo "secondary" "ep0" {
        send dhcp-client-identifier "my-client-ep0-secondary";
        script "/etc/dhclient-secondary";
   }

The client script for the pseudo-interface should not configure the interface up or down - essentially, all it needs to handle are the states where a lease has been acquired or renewed, and the states where a lease has expired. See dhclient-script(8) for more information.

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • Does anyone have a reference to a suitable IPv4 'separate client script' that would run `ip address add` and `ip address del` to add and remove the secondary address to the interface? – Michael Firth Mar 16 '22 at 13:48