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: reimplement useDHCP in a sensible way #167327
Conversation
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.
Seems reasonable 👍
I guess we should also revert the changes in nixos-generate-config
then, correct?
Also not sure about the state of networkd-docs in NixOS, but if there are any, this should be noted there as well.
I think it still makes sense to generate config for known interfaces in order to reduce the impact of the |
I haven't used scripted networking in quite a while, but doesn't that hang if an interface from If we already go down that route, |
The problem with |
Would be OK with that. Also, my concerns only apply to the use of scripted networking, how |
I'd like to see this in 22.05 as this is an important step towards networkd adoption. |
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.
Also, I'd like to see this implemented:
I'd say that useDHCP should indeed default to true, but we should also generate per-interface config and comment that.
@lheckemann do you want to apply the remaining tasks or do you want me to take over? :)
…DHCP = true;` Previously this wasn't done in the `forEach`-expression for `cfg.interfaces` and thus `networking.useDHCP` didn't have any effect if no further interface was statically configured.
According to `systemd.network(5)` of systemd v249 this is a valid option. Fixes evaluation of the wildcard network definitions.
Currently we're still using scripted networking by default. A problem with scripted networking is that having `useDHCP` on potentially non-existing interfaces (e.g. an ethernet interface for USB tethering) can cause the boot to hang. Closes NixOS#107908
I think we need to have another look at the test, because in spite of some glaring issues (as you've pointed out), it was passing!? EDIT: Oh, I see, you fixed that too :D |
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking | ||
# (the default) this is the recommended approach. When using systemd-networkd it's | ||
# still possible to use this option, but it's recommended to explicitly set it | ||
# per-interface using `networking.interfaces.<interface>.useDHCP`. |
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'd say that the optimal configuration is to have both when using networkd: explicit useDHCP per interface for the ones that should be configured for network-online.target
, because they're the ones usually used for internet access, and global useDHCP for any extra interfaces that are used occasionally. This is what nixos-generate-config should generate IMHO.
FYI, I see:
I think the only relevant option I have is auto-generated:
(in particular, no networkd) EDIT: I'm also suspicious of some lesser regression in behavior since 21.11 (in this config), but I haven't had time to look deeper so far. |
# We set RequiredForOnline to false, because it's fairly | ||
# common for such devices to have multiple interfaces and | ||
# only one of them to be connected (e.g. a laptop with | ||
# ethernet and WiFi interfaces). Maybe one day networkd will | ||
# support "any"-style RequiredForOnline... |
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.
It does now! systemd.network.wait-online.anyInterface = true;
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/plans-for-the-networkd-infrastructure/23086/3 |
Configuring dhcp on a per-interface basis is problematic if an interface isn't present at boot time. NixOS/nixpkgs#167327
Configuring dhcp on a per-interface basis is problematic if an interface isn't present at boot time. NixOS/nixpkgs#167327
What service is this referring to? Is it |
Make aragorn act more like a dumb ap should (disable dhcp for ipv4 and ipv6). As a nice side effect, this seems to unbreak ipv6 browsing. Also remove legacy commands about `networking.useDHCP` being deprecacted. It no longer is: NixOS/nixpkgs#167327.
Description of changes
cc people I've talked about this with: @fpletz @Ma27 @globin @WilliButz
This seems like a decent default, with the caveat that the wait-for-online service will not succeed. This can be fixed by setting useDHCP on a specific interface, and doing so is still recommended for this reason.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes