[Nix-dev] How to add an additional IP address besides the DHCP configured address?

Ertugrul Söylemez ertesx at gmx.de
Wed Feb 18 18:47:39 CET 2015


> I would like to add the IP address 172.16.48.17/28 to my enp0s3
> interface but I would also like to keep the DHCP configured address.
> [...]
> Is this possible or should I use networking.localCommands?

The proper way to do this is to instruct the DHCP *server* to assign the
addresses.  Most servers can assign IP addresses based on MAC addresses.
All options below are hacks, because they circumvent the lease system of
DHCP, so they are unsafe.

The most proper unsafe way is to configure the DHCP *client* to assign
the additional address.  Unfortunately when you configure dhcpcd to
assign a static address, it does not ask the server to get a lease at
all.  Perhaps you can figure out a way to do both.  The relevant option
is `networking.dhcpcd.extraConfig` and the `static` option from
dhcpcd.conf(5).

A less proper way is to use a hook and assign the additional address
yourself.  The most general interface to that seems to be
`networking.dhcpcd.runHook`.  It's less proper, because then the client
does not manage that address.

See also the section "3rdparty link management" (sic) in dhcpcd(8).  It
seems to offer an addtional option, but I did not follow all the
references.

If all else fails you can disable the DHCP client *daemon* altogether
and do one-shot setups instead.  This is a horrible setup that cries for
network problems, because now even the regular dynamic address falls
outside of the lease system.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150218/392465e1/attachment.bin 


More information about the nix-dev mailing list