CentOS 7设置网卡开机自动启用
一、查看网卡配置
root权限
[root@dbsyn ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 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: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 08:94:ef:67:2e:7c brd ff:ff:ff:ff:ff:ff inet 10.1.10.3/24 brd 10.1.10.255 scope global eno1 valid_lft forever preferred_lft forever inet6 fe80::173d:fad7:e606:525f/64 scope link valid_lft forever preferred_lft forever 3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000 link/ether 08:94:ef:67:2e:7d brd ff:ff:ff:ff:ff:ff 4: eno3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000 link/ether 08:94:ef:67:2e:7e brd ff:ff:ff:ff:ff:ff 5: eno4: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000 link/ether 08:94:ef:67:2e:7f brd ff:ff:ff:ff:ff:ff
可以看到已使用的网卡, 网卡名为eno1
二、修改网卡配置文件
网卡配置文件存放路径:/etc/sysconfig/network-script/ifcfg-<interface-name>
[root@dbsyn ~]# vim /etc/sysconfig/network-scripts/ifcfg-eno1 ... ONBOOT=yes ...
将ONBOOT=no改为ONBOOT=yes后,保存退出(:wq)
三、重启网络服务
[root@dbsyn ~]# service network restart
或者重启也行