0

Basically I want to set a static IP with systemd, but I want to get everything else (read "the routes of the network") via DHCP. This is easily done on macos for example which has the option "use DHCP with static IP address".

If I combine Address with DHCP=yes (as in Using dhcp and static ip on same nic on linux with systemd-networkd) then I get two addresses asigned to the interface, the static one plus the DHCP assigned one. I just want the static one.

If systemd.network's options don't allow for something like this, how would a systemd.service configuration look like that maybe uses dhcpcd or similar to accomplish this?

4
  • Why not just use DHCP & be done with it? Commented Jan 12 at 10:56
  • 1
    The usual method is to set a reserved IP in the DHCP server freedesktop.org/software/systemd/man/latest/…
    – HBruijn
    Commented Jan 12 at 14:11
  • yeah, I know. this is for development purposes. while trying out dhcp server settings I want the local network to just keep on running (albeit without internet) and not have the servers gain new ips or be not reachable because they loose their ip. i give them a fixed ip and that's that. but routes I want to change by simply changing the dhcp server settings. ip ranges don't conflict so there is no issue.
    – John Smith
    Commented Jan 14 at 18:29
  • and in any case macos can do it. I think even windows can. because sometimes you have control over the client and not the dhcp. makes enough sense to me. linux should not loose out in configurability against those 2 xD
    – John Smith
    Commented Jan 14 at 18:30

0

You must log in to answer this question.

Browse other questions tagged .