1. 下载ethtool源代码
git clone git://git.kernel.org/pub/scm/network/ethtool/ethtool.git
2. tar -xzf ethtool-3.15.tar.gz
cd ethtool-3.15
3. 源码中是没有configure文件的首先要编译生成该文件
4. 依次执行:
aclocal、autoconf、autoheader、automake --add-missing生成configure文件
5. ./configure --host=arm-xilinx-linux-gnueabiCC=arm-xilinx-linux-gnueabi-gcc LDFLAGS=-static
6. make
7. 把生成的ethtool可执行文件拷贝到linux根文件系统的/bin目录即可
ethtool命令使用简介:
命令描述:
ethtool 是用于查询及设置网卡参数的命令。
使用概要:
ethtool ethx //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0、eth1等等
ethtool –h //显示ethtool的命令帮助(help)
ethtool –i ethX //查询ethX网口的相关信息
ethtool –d ethX //查询ethX网口注册性信息
ethtool –r ethX //重置ethX网口到自适应模式
ethtool –S ethX //查询ethX网口收发包统计
ethtool –s ethX [speed 10|100|1000] [duplexhalf|full] [autoneg on|off] //设置网口速率10/100/1000M、设置网口半/全双工、设置网口是否自协商
使用举例:
1)[root@linux/]# ethtool eth1
Settings for eth1:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: d
Link detected: yes
2)[root@linux/]# ethtool -i eth1
driver: e1000
version: 5.0.43-k1
firmware-version: N/A
bus-info: 06:08.1