1.命令作用
查询或控制网络驱动程序和硬件设置(query or control network driver and hardware settings);即用于查询/设置网卡/设备参数信息
2.命令语法
Usage: ethtool [OPTION] devname [speed 10|100|1000] [duplex half|full] [autoneg on|off]
3.参数详解
OPTION:
- -p --identify,通过物理机上LED闪烁,定位物理网卡接口位置与网卡名称的对应关系
- -s --change,允许修改部分网络设备;如speed(带宽)、duplex(半/全双工)、autoneg(是否自协商)、port(网口类型)、wol(网卡唤醒参数设置);具体可取值可--help查看
- -t --test,网卡自测
- -i,查询网卡的相关信息
- -d,查询网卡注册信息
- -r,重置网卡到自适应模式
- -S,查询网卡收发包统计
4.常用用例
4.1.查看网络带宽
[root@localhost llll]# ethtool ens33 | grep Speed
Speed: 1000Mb/s
4.2.查看网络设备名称与物理网卡对应关系
[root@localhost llll]# ethtool -p ens33 10
# 机房配置网络时,多张网卡,执行该命令后,查看服务器网卡指示灯闪烁的,就是对网卡
4.3.设置网口最大速率10/100/1000M
ethtool -s 网络设备名称 [speed 10|100|1000] [duplex half|full] [autoneg on|off]
# 设置网口半/全双工、设置网口是否自协商
# 修改后可通过 ethtool ens33 | grep -E "Duplex|Auto-negotiation"
4.4.最大速率的取值
# 修改的值只能从如下输出的10、100、1000中选择,不能设置为200、500这样的值
[root@localhost llll]# ethtool ens33
Settings for ens33:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
4.5.其他说明
注意:
①执行该命令修改: ethtool -s ens1f0 speed 1000 autoneg off
②虚拟机修改网速无效
③物理机修改网速后,服务器远程连接不上了,后端的接口登录失败
④常用还是查看最大带宽与网络设备与物理网卡对应关系,其他都不怎么使用
2371

被折叠的 条评论
为什么被折叠?



