CentOS 启用网卡

版本:CentOS 7

 

 

临时启用

首先查看网卡:

[test@localhost ~]$ ip addr
1: lo:  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: enp2s0:  mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether a4:17:91:00:32:b8 brd ff:ff:ff:ff:ff:ff
3: enp3s0:  mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether a4:17:91:00:32:b9 brd ff:ff:ff:ff:ff:ff
4: enp4s0:  mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether a4:17:91:00:32:ba brd ff:ff:ff:ff:ff:ff
5: enp5s0:  mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether a4:17:91:00:32:bb brd ff:ff:ff:ff:ff:ff
6: wwp0s21u4i4:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 72:78:1a:e2:ce:da brd ff:ff:ff:ff:ff:ff
7: enp10s0f0:  mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether a4:17:91:00:32:bc brd ff:ff:ff:ff:ff:ff
8: enp10s0f1:  mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether a4:17:91:00:32:bd brd ff:ff:ff:ff:ff:ff
    inet 192.168.6.101/24 brd 192.168.6.255 scope global noprefixroute dynamic enp10s0f1
       valid_lft 7105sec preferred_lft 7105sec
    inet6 fe80::a939:63c9:159c:3168/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
9: wlp8s0:  mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 04:f0:21:64:ca:ab brd ff:ff:ff:ff:ff:ff

 

启用(重启后还是未启用)

ifup your-eth-name

 

 

永久生效:

[test@localhost ~]$ cd /etc/sysconfig/network-scripts/
[test@localhost network-scripts]$ ls
ifcfg-enp10s0f0  ifcfg-enp3s0  ifcfg-lo     ifdown-eth   ifdown-isdn  ifdown-routes  ifdown-TeamPort  ifup-aliases  ifup-ippp  ifup-plip   ifup-ppp     ifup-Team      ifup-wireless      network-functions-ipv6
ifcfg-enp10s0f1  ifcfg-enp4s0  ifdown       ifdown-ippp  ifdown-post  ifdown-sit     ifdown-tunnel    ifup-bnep     ifup-ipv6  ifup-plusb  ifup-routes  ifup-TeamPort  init.ipv6-global
ifcfg-enp2s0     ifcfg-enp5s0  ifdown-bnep  ifdown-ipv6  ifdown-ppp   ifdown-Team    ifup             ifup-eth      ifup-isdn  ifup-post   ifup-sit     ifup-tunnel    network-functions

 

编辑对应网卡的 ifcfg- 文件,将 ONBOOT设为yes

[test@localhost network-scripts]$ cat ifcfg-enp10s0f1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp10s0f1
UUID=cc7fe815-bd52-4ea3-afe1-6d28a0636e40
DEVICE=enp10s0f1
ONBOOT=yes

 

最后重启网络服务生效:

service network restart

 

你可能感兴趣的:(CentOS 启用网卡)