Ubuntu/Linux network problem handling summary

学习和工作中,总是遇到奇奇怪怪的一些问题,处理之后记录在这里。


1. The network service fails to start due to the change of the network card name

lo        Link encap:Local Loopback  
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:12536  Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1 
RX bytes:594 (594.0 B)  TX bytes:594 (594.0 B)

Then I tried ifup eth0, and the result is that there is no such device.
Then restarting the network service /etc/init.d/networking restart also failed.

Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details.
 failed!

Check the status /etc/init.d/networking status error: Failed to start Raise network interf….
2. Check the network card name dmesg |grep eth

[    0.000000] psci: probing for conduit method from ACPI.
[   xx.2xxx25] netif_napi_add() called with weight 256 on device eth%d
[   xx.1xxx76] r8169 xxx:03 enp2s3: renamed from eth3
[   xx.2xxx12] r8169 xxx:01 enp2s1: renamed from eth1
[   xx.2xxx71] r8169 xxx:02 enp2s2: renamed from eth2
[   xx.3xxx96] r8169 xxx:00 enp2s0: renamed from eth0

Found that the network card name has changed
4. Modify the network configuration file:
vim /etc/network/interfaces
Replace all eth0 in it with the new network card name: enp2s0

auto enp2s0
iface enp2s0 inet static
address 192.168.5.39
gateway 192.168.5.1
netmask 255.255.255.0

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325810735&siteId=291194637