centos 7.4 添加新网卡,停启用网卡

vm: VirtualBox 图形用户界面 版本 5.2.4 r119785 (Qt5.6.2)
os: centos 7.4 x86_64

# yum install redhat-lsb*

# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.4.1708 (Core) 
Release:	7.4.1708
Codename:	Core


# uname -a
Linux oradb 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

vm界面添加一个新网卡,进入系统查看

# ip a
1: lo:  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
2: enp0s3:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:e0:67:fc brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.100/24 brd 192.168.56.255 scope global enp0s3
       valid_lft forever preferred_lft forever
3: enp0s8:  mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 08:00:27:82:88:46 brd ff:ff:ff:ff:ff:ff
4: virbr0:  mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 52:54:00:f7:de:fa brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic:  mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
    link/ether 52:54:00:f7:de:fa brd ff:ff:ff:ff:ff:ff
    

其中 3: enp0s8 为新加的网卡

# ifconfig enp0s8 up
enp0s8: ERROR while getting interface flags: No such device

# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:NetworkManager(8)
[root@oradb ~]# 
[root@oradb ~]# systemctl status network
● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: active (exited) since Mon 2018-01-29 11:08:46 CST; 9min ago
     Docs: man:systemd-sysv-generator(8)

Jan 29 11:08:39 oradb systemd[1]: Starting LSB: Bring up/down networking...
Jan 29 11:08:42 oradb network[834]: Bringing up loopback interface:  [  OK  ]
Jan 29 11:08:46 oradb network[834]: Bringing up interface enp0s3:  [  OK  ]
Jan 29 11:08:46 oradb systemd[1]: Started LSB: Bring up/down networking.


# cd /etc/sysconfig/network-scripts/
[root@oradb network-scripts]# ls -l|more
total 244
-rw-r--r--  1 root root   417 Dec  1 09:34 ifcfg-enp0s3

手动创建 网卡配置文件

# cp ./ifcfg-enp0s3 ./ifcfg-enp0s8

# vi ifcfg-enp0s8 
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s8"
HWADDR="08:00:27:82:88:46"
DEVICE="enp0s8"
ONBOOT="yes"
IPV6_PRIVACY="no"

# ifconfig enp0s8 up

Determining IP information for enp0s8... done.

# ip link set  enp0s8 down 
# ip link set  enp0s8 up

你可能感兴趣的:(#,linux,rhel,centos)