惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Docker
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
MyScale Blog
MyScale Blog
H
Help Net Security
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Proofpoint News Feed
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏

博客园 - stone8386

微信调试工具,内网穿透工具,Localtunnel 使用 BackgroundService 创建 Windows 服务 centos8在更新yum源时提示失败 错误:为 repo ‘AppStream’下载元数据失败 c# 连接 sql server 数据库时报错,证书链是由不受信任的颁发机构颁发的。 锐浪报表 手工注册发布软件 - C/S报表开发 免COM DLL注册发布(绿色发布) - C/S报表开发 net 6 使用 加密sqlite 如何修复identity 2的默认登录路由中的错误 docker 启动 redis集群 android studio 生成 keystore 命令 identityserver4 对接钉钉 centos yum install 找不到软件包 docker 挂载文件出错 在linux 或docker中使用 system.drawing.common docker 发布到私有docker registry docker 不能访问外网 ngxin 配置ssl Install Docker Compose docker registry
centos 网卡状态
stone8386 · 2019-04-04 · via 博客园 - stone8386

由于ifconfig命令没法看到网卡的一些状态, 以下有5种方法查看网卡状态,是否连通网线

1)# dmesg | grep eth
.....
e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
e1000: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None

2)# mii-tool
eth0: negotiated 100baseTx-FD, link ok
eth1: negotiated 100baseTx-FD, link ok

3)# ethtool eth0 | grep Link
Link detected: yes

4)# cat /sys/class/net/eth0/operstate
up

5)# ip link show
2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:0c:29:b0:ef:e4 brd ff:ff:ff:ff:ff:ff
3: eth1: mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:0c:29:b0:ef:ee brd ff:ff:ff:ff:ff:ff

----------------------------------------------------------------------------

ifconfig -a

使用ifconfig 命令可以获取所有网卡设备的信息,如果需要查看哪些设备连接网线,需要通过 RX packets或者TX packets进行判断,如果数值为0的话通常表示没有硬件连接。

缺点:
不能直接显示设备连接情况,需要通过其它参数进行判断。如果网口连接过网线,可能会导致数据不准确,需要使用ifdown、ifup命令重启设备。
ip a

使用这个命令可以获取本机上所有设备的状态信息, 通过 “qdisc mq state”后面的值是UP还是DOWN来判断是否已经连接网线。
(此命令对于网线,光纤,InfiniBand类型设备都可以进行支持)
nmcli dev status

使用这个命令可以获取本机上所有设备的状态信息, 通过CONNECTIONZ字段就可以很方便看出是否有设备连接。
推荐的使用方式!

此外,还可以使用service network status 命令查看当前配置的网卡设备信息。