1.nano /etc/network/interfaces
2.将enp0s3注释掉,添加 eth0,如下所示
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#allow-hotplug enp0s3
#iface enp0s3 inet dhcp
auto eth0
#allow-hotplug eth0
iface eth0 inet static
address 192.168.10.12
netmask 255.255.255.0
gateway 192.168.10.1
#dhcp
nano /etc/default/grub.bak 文件
修改内容如下:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to
找到GRUB_CMDLINE_LINUX将参数的值设置为:GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"4.grub-mkconfig -o /boot/grub/grub.cfg重新生成GRUB引导配置文件,执行完成后,重启系统 ,如果linux系统是安装是虚拟机里面的如:virtualbox 中的,virtualbox 应该设置网络为桥接模式。
5.重启完成后,修改nano /etc/resolv.conf 增加:nameserver 8.8.8.8