查看网卡ip addr
输出
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp101s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 80:80:80:80:80:80 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.131/24 brd 192.168.0.255 scope global noprefixroute enp101s0f0
valid_lft forever preferred_lft forever
inet6 fe80::fe80:fe80:fe80:fe80/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp101s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 80:80:80:80:80:e9 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:36:5f:9a brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
得知 使用的网卡是 enp101s0f0
网卡配置
cd /etc/sysconfig/network-scripts
ll | grep enp101s0f0
输出-rw-------. 1 root root 383 12月 22 10:54 ifcfg-enp101s0f0
编辑网卡,使用root用户vim ifcfg-enp101s0f0
把ONBOOT内容改为yesONBOOT=yes
ONBOOT : 系统启动时,是否激活网卡。no:不激活,yes: 激活
重启网卡应用生效systemctl restart network
如果如上重启后,还未生效,重启系统命令reboot,重启系统