NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.45k stars 13.65k forks source link

cannot set networking.defaultGateway(6).metric without networking.defaultGateway(6).address #93035

Open starcraft66 opened 4 years ago

starcraft66 commented 4 years ago

Describe the bug I have two interfaces that can reach the internet attached to my computer. NixOS is defaulting to setting the default IPv4 and IPv6 routes via the wrong interface so I found that I need to use the networking.defaultGateway and networking.defaultGateway6 options to properly define the routing metric on my interfaces. Unfortunately, the networking.defaultGateway.address and networking.defaultGateway6.address parameters are mandatory and setting them to "" results in my configuration applying but not doing anything at all. I want the ip addresses on these interfaces to be auto-configured via DHCP and RA.

To Reproduce Steps to reproduce the behavior:

I set the following in my configuration.nix:

networking.defaultGateway.address = "";
networking.defaultGateway.interface = "enp3s0.51";
networking.defaultGateway.metric = 10;
networking.defaultGateway6.address = "";
networking.defaultGateway6.interface = "enp3s0.51";
networking.defaultGateway6.metric = 10;

Expected behavior I would expect my default route to the internet via enp3s0.51 to have a routing metric of 10.

However, it retains the default routing metric of 204.

tristan@luna:~$ ip -6 route
[snip]
default via fe80::921b:eff:fe0c:e1b0 dev Management proto ra metric 203 pref medium
default via fe80::921b:eff:fe0c:e1b0 dev Home proto ra metric 204 pref medium

Metadata

tristan@luna:~$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.7.8, NixOS, 20.03.2516.674ab2dffa5 (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.6`
 - channels(root): `"nixos-20.03.2516.674ab2dffa5"`
 - channels(tristan): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info