DigitalOcean: Incorrect network configuration
damszew opened this issue · 0 comments
damszew commented
I keep getting an error in network-addresses-eth0.service
after fresh nixos-infect
on DigitalOcean Ubuntu 22.04:
# systemctl status network-addresses-eth0.service
× network-addresses-eth0.service - Address configuration of eth0
Loaded: loaded (/etc/systemd/system/network-addresses-eth0.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Tue 2024-06-04 04:13:36 UTC; 3min 37s ago
Process: 797 ExecStart=/nix/store/b8yrzi78zczwpy5592awwr3nk0i1jcmg-unit-script-network-addresses-eth0-start/bin/network-addresses-eth0-start (code=exited, status=1/FAILURE)
Main PID: 797 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
CPU: 50ms
Jun 04 04:13:36 perun systemd[1]: Starting Address configuration of eth0...
Jun 04 04:13:36 perun network-addresses-eth0-start[797]: adding address 68.183.215.64/20... done
Jun 04 04:13:36 perun network-addresses-eth0-start[797]: adding address 10.19.0.5/16... done
Jun 04 04:13:36 perun network-addresses-eth0-start[797]: adding address fe80::1476:abff:fe53:1586/64... adding route 68.183.208.1/32... done
Jun 04 04:13:36 perun network-addresses-eth0-start[797]: adding route /128... 'ip route add /128 dev eth0' failed: Error: any valid prefix is expected rather than "/128".
Jun 04 04:13:36 perun systemd[1]: network-addresses-eth0.service: Main process exited, code=exited, status=1/FAILURE
Jun 04 04:13:36 perun systemd[1]: network-addresses-eth0.service: Failed with result 'exit-code'.
Jun 04 04:13:36 perun systemd[1]: Failed to start Address configuration of eth0.
Network configuration on stock Ubuntu 22.04 before nixos-infect
:
# 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 16:76:ab:53:15:86 brd ff:ff:ff:ff:ff:ff
altname enp0s3
altname ens3
inet 68.183.215.64/20 brd 68.183.223.255 scope global eth0
valid_lft forever preferred_lft forever
inet 10.19.0.5/16 brd 10.19.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::1476:abff:fe53:1586/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether ba:1f:41:33:a2:3d brd ff:ff:ff:ff:ff:ff
altname enp0s4
altname ens4
inet 10.114.0.2/20 brd 10.114.15.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::b81f:41ff:fe33:a23d/64 scope link
valid_lft forever preferred_lft forever
# ip -4 r
default via 68.183.208.1 dev eth0 proto static
10.19.0.0/16 dev eth0 proto kernel scope link src 10.19.0.5
10.114.0.0/20 dev eth1 proto kernel scope link src 10.114.0.2
68.183.208.0/20 dev eth0 proto kernel scope link src 68.183.215.64
# ip -6 r
::1 dev lo proto kernel metric 256 pref medium
fe80::/64 dev eth1 proto kernel metric 256 pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
networking.nix
generated by script:
{ lib, ... }: {
# This file was populated at runtime with the networking
# details gathered from the active system.
networking = {
nameservers = [
"8.8.8.8"
];
defaultGateway = "68.183.208.1";
defaultGateway6 = {
address = "";
interface = "eth0";
};
dhcpcd.enable = false;
usePredictableInterfaceNames = lib.mkForce false;
interfaces = {
eth0 = {
ipv4.addresses = [
{ address = "68.183.215.64"; prefixLength = 20; }
{ address = "10.19.0.5"; prefixLength = 16; }
];
ipv6.addresses = [
{ address = "fe80::1476:abff:fe53:1586"; prefixLength = 64; }
];
ipv4.routes = [{ address = "68.183.208.1"; prefixLength = 32; }];
ipv6.routes = [{ address = ""; prefixLength = 128; }];
};
eth1 = {
ipv4.addresses = [
{ address = "10.114.0.2"; prefixLength = 20; }
];
ipv6.addresses = [
{ address = "fe80::b81f:41ff:fe33:a23d"; prefixLength = 64; }
];
};
};
};
services.udev.extraRules = ''
ATTR{address}=="16:76:ab:53:15:86", NAME="eth0"
ATTR{address}=="ba:1f:41:33:a2:3d", NAME="eth1"
'';
}