Cannot access the Internet after replacing the computer mainboard

I probably know the cause and the problem, but I can’t solve it. The original network interface device name is enp3s0, and there is a setting of networking.interfaces.enp3s0.useDHCP = true at the same time. But after replacing the mainboard, this device cannot be seen in ifconfig, and there is an additional device called enp5s0. Even if I manually set the ip/netmask/broadcast of this network interface, the Internet still cannot be accessed, but the internal network is available (for example, to access the router). I can’t find out the problem further, it has kept me out of work for several hours.

Note that because there is no network, I cannot successfully execute the sudo nixos-rebuild switch command after modifying configuration.nix.

This is what it looks like after I manually up and set the new enp5s0 interface:

➜  ~ ifconfig
enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.108  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::3e7c:3fff:febb:4b6b  prefixlen 64  scopeid 0x20<link>
        ether 3c:7c:3f:bb:4b:6b  txqueuelen 1000  (Ethernet)
        RX packets 25165  bytes 5386454 (5.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 25369  bytes 2814915 (2.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 100605  bytes 8992674 (8.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 100605  bytes 8992674 (8.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

➜  ~

Due to the absence of the previous network interface, several related services failed during systemd startup, resulting in an increase in the overall system startup time.

If replacing the motherboard (or network interface card device) may cause such a result, shouldn’t the network interface name be written in configuration.nix?

What do you mean that you can’t access internet? Do you have a dns or default route configured?
What is the output of ip route? Can you ping something outside your local network, for example does ping 1.1.1.1 work?

1 Like

You let me out of the sea of suffering. I looked at ip route show and found that there is no default route. After adding it, I can access the public network. Finally successfully executed the sudo nixos-rebuild switch command to solve the problem perfectly. Thank you!!!

Now I have commented out networking.interface.enp3s0.use DHCP = true, but changed networking.useDHCP to true. Because I don’t want this to happen again.