-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/{networkd,dhcpcd}: remove udev-settle hack #107382
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
15d6eac
nixos/{networkd,dhcpcd}: remove udev-settle hack
rnhmjoj 6532529
nixos/stage-1: install networkd link files
rnhmjoj 8e59a68
nixos/udev: add option to install rules in initrd
rnhmjoj 7384c81
nixos/tests/networking: test interface renaming
rnhmjoj aafaf3b
nixos/docs: add section on renaming interfaces
rnhmjoj d683d26
nixos/release-notes: warn on interface renaming
rnhmjoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<section xmlns="http://docbook.org/ns/docbook" | ||
xmlns:xlink="http://www.w3.org/1999/xlink" | ||
xmlns:xi="http://www.w3.org/2001/XInclude" | ||
version="5.0" | ||
xml:id="sec-rename-ifs"> | ||
<title>Renaming network interfaces</title> | ||
|
||
<para> | ||
NixOS uses the udev | ||
<link xlink:href="https://systemd.io/PREDICTABLE_INTERFACE_NAMES/">predictable naming scheme</link> | ||
to assign names to network interfaces. This means that by default | ||
cards are not given the traditional names like | ||
<literal>eth0</literal> or <literal>eth1</literal>, whose order can | ||
change unpredictably across reboots. Instead, relying on physical | ||
locations and firmware information, the scheme produces names like | ||
<literal>ens1</literal>, <literal>enp2s0</literal>, etc. | ||
</para> | ||
|
||
<para> | ||
These names are predictable but less memorable and not necessarily | ||
stable: for example installing new hardware or changing firmware | ||
settings can result in a | ||
<link xlink:href="https://github.com/systemd/systemd/issues/3715#issue-165347602">name change</link>. | ||
If this is undesirable, for example if you have a single ethernet | ||
card, you can revert to the traditional scheme by setting | ||
<xref linkend="opt-networking.usePredictableInterfaceNames"/> to | ||
<literal>false</literal>. | ||
</para> | ||
|
||
<section xml:id="sec-custom-ifnames"> | ||
<title>Assigning custom names</title> | ||
<para> | ||
In case there are multiple interfaces of the same type, it’s better to | ||
assign custom names based on the device hardware address. For | ||
example, we assign the name <literal>wan</literal> to the interface | ||
with MAC address <literal>52:54:00:12:01:01</literal> using a | ||
netword link unit: | ||
</para> | ||
<programlisting> | ||
<link linkend="opt-systemd.network.links">systemd.network.links."10-wan"</link> = { | ||
matchConfig.MACAddress = "52:54:00:12:01:01"; | ||
linkConfig.Name = "wan"; | ||
}; | ||
</programlisting> | ||
<para> | ||
Note that links are directly read by udev, <emphasis>not networkd</emphasis>, | ||
and will work even if networkd is disabled. | ||
</para> | ||
<para> | ||
Alternatively, we can use a plain old udev rule: | ||
</para> | ||
<programlisting> | ||
<link linkend="opt-services.udev.initrdRules">services.udev.initrdRules</link> = '' | ||
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \ | ||
ATTR{address}=="52:54:00:12:01:01", KERNEL=="eth*", NAME="wan" | ||
''; | ||
</programlisting> | ||
|
||
<warning><para> | ||
The rule must be installed in the initrd using | ||
<literal>services.udev.initrdRules</literal>, not the usual | ||
<literal>services.udev.extraRules</literal> option. This is to avoid race | ||
conditions with other programs controlling the interface. | ||
</para></warning> | ||
</section> | ||
|
||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmph not particularily fond of having this option defined here. This module is for configuring systemd-udevd in stage 2; not stage 1
how about instead of having an
initrdRules
here; we move this option tostage-1.nix
and name itboot.initrd.extraUdevRules
? It's a bit weird to have the the option for initrd defined here asudevd
in initrd andudevd
in stage-2 might be two completely differentudevd
implementations at this moment.I'm working on an alternative initrd implementation using systemd. But it's hard to introduce this change as now the
udev
module in stage-2 has a hard dependency on thestage-1.nix
module. Because now thestage-2
udev module calls out tostage-1.nix
I can not disablestage-1.nix
indisabledModules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll send a draft PR with these suggested changes and i'll backlink it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think renaming this option is fine - as long as we do this before the 20.05 branchoff, it probably doesn't even need the
mkRenamedOption
alias.