centos7 重新插上网线 需要重启网络服务

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 重新插上网线 需要重启网络服务相关的知识,希望对你有一定的参考价值。

参考技术A

vim /etc/sysconfig/network-scripts/ifcfg-ens33(ifcfg-ens33这个文件因不同虚拟机而不同,有些虚拟机的文件名是ifcfg-eth0,其他的都是固定的路径)

进入之后发现 ONBOOT的属性设置为 no 

,于是就把 no 改为 yes


ONBOOT=yes意思是:系统在启动时激活网卡 保存退出编辑之后使用service network restart命令重启网卡服务即可联网 设置完成之后下次就不会出现这样的问题了!

How To:Linux下如何通过命令检查网卡是否插上网线

主要工具为ethtool来检查,主要关注的字段为"Link detected",注意如下的输出,其中em4实际物理上并未插上网线,而em1是插上网线的:

# ethtool em4
Settings for em4:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: Twisted Pair
        PHYAD: 2
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: g
        Wake-on: d
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: no
# ethtool em1
Settings for em1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Link partner advertised link modes:  100baseT/Full 
                                             1000baseT/Full 
        Link partner advertised pause frame use: Transmit-only
        Link partner advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on
        Supports Wake-on: g
        Wake-on: d
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: yes

 

以上是关于centos7 重新插上网线 需要重启网络服务的主要内容,如果未能解决你的问题,请参考以下文章

连上网线上不了网。win10系统

笔记本插拔网线后网络无法连接

路由器设置后不能上网,显示感叹号!(高悬赏)

电脑网线插完还没网络怎么办

解决Ubuntu连不上网的方法都有哪些

ubuntu连不上网