Ubuntu 22.04 server network card has no IP address

The ssh connection server cannot be connected, the prompt is as follows;
Insert image description here
Connect the monitor,ip addr ls Command to check the IP address, there is a network card but no IP address
Insert image description here

solution:

sudo dhclient enp10s0

Used to obtain network configuration information through the DHCP protocol and assign an IP address to the network interface named enp10s0. Replace enp10s0 with the name of the local network interface.

But once it restarts, the IP address is gone again. No solution has been found so far


Fix:

By chance, I was told the solution by a classmate

cd /etc/netplan  
sudo nano 00-installer-config.yaml

Insert image description here
There was a problem with the name of the network card interface before. It was enp9s0. Just change it to the correct name enp10s0 (ifconfig query)
Insert image description here

Guess you like

Origin blog.csdn.net/MrKingloveyou/article/details/133143338