您的位置:首页 > 理论基础 > 计算机网络

linux下强大的网络管理工具ethtool学习小结

2016-01-16 23:36 881 查看
1.ethtool

ethtool 提供了强大的网卡及网卡驱动管理能力,其具体的实现框架和网络驱动程序及网络硬件关系紧密,容易修改和扩展,能够为 Linux 网络开发人员和管理人员提供对网卡硬件,驱动程序和网络协议栈的设置,查看以及及调试等功能。

2.命令使用格式

ethtool [option] interface
常用的选项有:

-s #修改网卡的部分配置,包括网卡速度、单工/全双工模式、mac地址等。加上-s选项修改的内容才会生效
-a #查看网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或 停用off
-A #修改网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或 停用off
-k #显示网卡Offload参数的状态:on 或 off,包括rx-checksumming、tx-checksumming等
-K #修改网卡Offload参数的状态
-S #显示NIC- and driver-specific 的统计参数,如网卡接收/发送的字节数、接收/发送的广播包个数等
-i #显示网卡驱动的信息,如驱动的名称、版本等


3.常用的操作举例

(1)查看网卡的接口信息
ethtool eth1 #查看网络接口eth1的信息
(2)关闭网卡eth1的自动协商
ethtool -s eth1 autoneg off
(3)修改网卡速率为 100Mb/s
ethtool -s eth4 speed 100
(4)查看网卡驱动信息
ethtool -i eth0
(5)查看网卡的一些工作统计信息
ethtool –S eth0
(6)停止和查看网卡的发送模块TX的状态
ethtool -A tx off eth0 #修改tx的状态
ethtool -a eth0 #查看tx的状态
(7)关闭网卡对收到的数据包的校验功能
ethtool -K rx off eth0 #关闭校验
ethtool –k eth0 #查看校验启动状态

备注:

如果想查看一个网卡支持的最大网络带宽,比如是100M网卡,还是1000M网卡,就可以使用ethtool来查看

[root@localhost ]#ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s  <<在这里显示的有哦
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbag
Wake-on: g
Current message level: 0x00000001 (1)
Link detected: yes


学习资料参考于:
http://www.ibm.com/developerworks/cn/linux/1304_wangjy_ethtools/ http://man.linuxde.net/ethtool
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: