Skip to content
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

Invalid networking.nix for IPv6-only machines #151

Open
fleaz opened this issue May 3, 2023 · 2 comments
Open

Invalid networking.nix for IPv6-only machines #151

fleaz opened this issue May 3, 2023 · 2 comments

Comments

@fleaz
Copy link

fleaz commented May 3, 2023

Hey,

just used this tool on a VM on Hetzner for which I didn't configured an IPv4 address. The generated networking.nix is invalid and can't be applied because there is an empty /32 IPv4 route.

Generated networking.nix:

{ lib, ... }: {
  # This file was populated at runtime with the networking
  # details gathered from the active system.
  networking = {
    nameservers = [ "8.8.8.8"
 ];
    defaultGateway = "";
    defaultGateway6 = {
      address = "fe80::1";
      interface = "eth0";
    };
    dhcpcd.enable = false;
    usePredictableInterfaceNames = lib.mkForce false;
    interfaces = {
      eth0 = {
        ipv4.addresses = [
          { address="100.64.194.249"; prefixLength=32; }
        ];
        ipv6.addresses = [
          { address="2a01:4f8:c0c:65c2::1"; prefixLength=64; }
{ address="fe80::9400:2ff:fe27:2e0b"; prefixLength=64; }
        ];
        ipv4.routes = [ { address = ""; prefixLength = 32; } ];
        ipv6.routes = [ { address = "fe80::1"; prefixLength = 128; } ];
      };
      
    };
  };
  services.udev.extraRules = ''
    ATTR{address}=="96:00:02:27:2e:0b", NAME="eth0"
    
  '';
}

This is what the interfaces look like on a fresh IPv6 only machine booted into their stock Ubuntu:

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 96:00:02:27:4a:20 brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    altname ens3
    inet 100.66.8.195/32 metric 100 scope global dynamic eth0
       valid_lft 86280sec preferred_lft 86280sec
    inet6 2a01:4f9:c012:859b::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::9400:2ff:fe27:4a20/64 scope link 
       valid_lft forever preferred_lft forever

# ip -4 r
169.254.169.254 via 172.31.1.1 dev eth0 proto dhcp src 100.66.8.195 metric 100 
172.31.1.1 dev eth0 proto dhcp scope link src 100.66.8.195 metric 100 

# ip -6 r
::1 dev lo proto kernel metric 256 pref medium
2a01:4f9:c012:859b::/64 dev eth0 proto kernel metric 256 pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
default via fe80::1 dev eth0 proto static metric 1024 onlink pref medium

Happy to provide more information and help debug this if needed.

Best,
Felix

@jmmaloney4
Copy link

On vultr, I was able to get ipv6 to work immediately. It doesn't appear to have generated a networking.nix, or have any networking setup in the configuration.nix or hardware-configuration.nix. I did run into a separate problem, however, which is that GitHub does not support IPv6, rendering nixpkgs unusable.

@Chobbes
Copy link

Chobbes commented Apr 4, 2024

Ran into the same issue. Additionally nixos-infect only uses the single ipv4 nameserver 8.8.8.8, so DNS doesn't work by default. Had to edit /etc/resolv.conf in order to get a rebuild to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants