Jump to content

Systemd/networkd: Difference between revisions

→‎DHCP: Add router advertisements info
imported>Mweinelt
imported>Mweinelt
(→‎DHCP: Add router advertisements info)
Line 87: Line 87:
Examples should be concise and give proper hints on how to achieve a reliably working <code>network-online.target</code>.
Examples should be concise and give proper hints on how to achieve a reliably working <code>network-online.target</code>.


=== DHCP ===
=== DHCP/RA ===


Acquire a DHCP lease on an interface and make <code>network-online.target</code> wait until addresses and routes from the DHCP exchange are configured.
Common scenario for dynamic configuration, DHCP for IPv4 and router advertisements for IPv6 connectivity. Make <code>network-online.target</code> wait until addresses and routes are configured.


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
   systemd.network.networks."10-dhcp-wan" = {
   systemd.network.networks."10-dhcp-wan" = {
     matchConfig.Name = "enp1s0";
     matchConfig.Name = "enp1s0";
     networkConfig.DHCP = "yes";
     networkConfig = {
     # make acquiring a DHCP lease a dependency for network-online.target
      DHCP = "ipv4";
     linkConfig.RequiredForOnline = true;
      IPv6AcceptRA = true;
    };
     # making routing on this interface a dependency for network-online.target
     linkConfig.RequiredForOnline = "routable";
   };
   };
</syntaxhighlight>
</syntaxhighlight>
Anonymous user