Score:0

Cannot use ethernet after motherboard swap

ug flag

I swapped motherboard in my ubuntu 22.04 server and I get no connection through ethernet.

I did try this No ethernet connection in Ubuntu 19.04 after changing motherboard changing my /etc/netplan/50-cloud.init.yaml to use the new enp0s31f6 interface, and I got connection to the network. Then had to unplug the machine and the ethernet did not work after it booted up, redoing the suggested netplan reconfigure did not work a second time. ping: connect: Network is unreachable

Im not sure how I can provide all information as I cannot copy paste information and I have lots of docker containers running flooding the information.

lshw -C network

*-network
    description: Ethernet interface
    product: Ethernet Connection(2) I219-V
    vendor: Intel Corporation
    physical id: 1f.6
    bus info: pci@000:00::1f.6
    logical name: enp0s31f6
    version: 31
    serial:4c:cc:6a:67:f2:3c
    size: 1Gbit/s
    capacity: 1Gbit
    configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=5.15.0-75-generic duplex=full firmware=0.8.4 latency=0 link=yes multicast=yes ...
    ....

/etc/netplan/50-cloud-init.yaml

network:
    ethernets:
      #        enp3s0:
        enp0s31f6:
            dhcp4: true
    version: 2  

ip route does not show my gateway, so I try to add it with

sudo ip route add 192.168.0.1 dev enp0s31f6
sudo ip route add default via 192.168.0.1

Now the network adapter seems to be alive, I can start to ping something but there is no response.

my /etc/resolv.conf is looking strange

nameserver 127.0.0.53
options edns0 trust-ad
search.

Sorry for typos as all information is copied manually. I dont know what im doing and it feels like I've tried alot. Do you have any ideas what could be wrong?

edit I noticed that after adding the default route to my gateway, resetting the interface with ip link set enp0s31f6 down and up, brings me back to ping: connect: Network is unreachable

edit removed /etc/network/interfaces content and posted /etc/netplan/50-cloud-init.yaml

Marco avatar
br flag
Newer Ubuntu does not use "ifupdown" (/etc/network/interface) anymore. The standard network renderer are networkd(server) or NetworkManager(desktop). Can you add the content of `/etc/netplan/50-cloud.init.yaml` to your question.
Rasmus avatar
ug flag
ah that explains it. I added the content of the netplan cloud-init.yaml to the question
Marco avatar
br flag
Looks like you are mixing dhcp and static config. The netplan files configures for getting it from the network via dhcp, but you try to configure the network manually. Swapping motherboard with onboard lan will change the MAC address. Make sure your router knows your new MAC address and gives out the network config on request.
Rasmus avatar
ug flag
@Marco, Thanks that was part of the problem. The router knew the MAC address from years ago and had a different static IP. However from the ubuntu machines perspective I dont want anything static fancy setup now. I only want my router to provide it with a static IP. What do I need to do to restore it on my machine?
Marco avatar
br flag
As I said, the netplan config is using dhcp. If your router is configured correctly everything should work. Maybe reboot the computer to make sure your manual configuration is reset.
Rasmus avatar
ug flag
I've rebooted after each change , and I deleted and added the MAC adress in my router but the problem remain :/ If the netplan config is correct, shouldnt ip route show a route to the router?
mpboden avatar
do flag
The contents of `/etc/resolv.conf` look normal. This IP address is the local caching stub resolver. Look at `ls -l /etc/resolv.conf`, it should be a symlink to `/run/systemd/resolve/resolv.conf`. Please update your question with the output of `ip a` and `resolvectl status`. The first will show if interface has an IP address. 2nd will see if uplink DNS servers have been defined, which should come from the router. As to default route, this should be populated automatically when the interface gets an IP address. Since you have no default route, I'm questioning if you actually have an IP address.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.