虚拟机安装cenos7后ifcfg看网卡无inet地址掩码等信息

在虚拟机安装centos7,进入系统使用ifconfig命令时,只有lo网卡( 127.0.0.1的ip地址)和eno16777736网卡,而且此网卡没有inet地址、掩码等信息。 


这时候查看/etc/sysconfig/network-scripts  目录下是否存在ifcfg-eth0 文件不存在 

查看ifcfg-eno16777736这样一个文件



more ifcfg-eno16777736


[xxxxx@localhost network-scripts]$ more ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=7170eda3-8183-41fc-b0b8-ee924d05ddc2
ONBOOT=no
PREFIX0=24
HWADDR=00:0C:29:61:34:7D
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

之前在其他帖子里看到,cp ifcfg-eno16777736 ifcfg-eth0,然后在ifcfg-eth0li 把ONBOOT由no改为yes,而后重启网卡服务。

我试了下,可行的。

然后我尝试不这么操作,不复制出ifcfg-eth0文件,直接将ifcfg-eno16777736里的ONBOOT由no改为yes,而后重启网卡服务,发现问题也得到了解决。

执行 ifconfig 出现正确网络信息,ipv4地址出现


eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.88  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::20c:29ff:fe61:347d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:61:34:7d  txqueuelen 1000  (Ethernet)
        RX packets 102  bytes 10385 (10.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 128  bytes 13681 (13.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0




lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 818  bytes 71132 (69.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 818  bytes 71132 (69.4 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

猜你喜欢

转载自www.cnblogs.com/matengfei123/p/9034766.html