《Linux杂记》Linux设置网卡速度与模式

1.Ethtool是用于查询及设置网卡参数的命令

ethtool ethX      //查询ethX网口基本设置
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]\         //设置网口速率10/100/1000M
[duplex half|full]\           //设置网口半/全双工
[autoneg on|off]\            //设置网口是否自协商
[port tp|aui|bnc|mii]\         //设置网口类型
[phyad N]\                
[xcvr internal|exteral]\
[wol p|u|m|b|a|g|s|d...]\
[sopass xx:yy:zz:aa:bb:cc]\
[msglvl N]

接下来笔者就带领大家看看具体是操作的,首先可以查看一下网口配置情况。

《Linux杂记》Linux设置网卡速度与模式_第1张图片

图1

2.ethtool设置永久保存在网络设备中

解决方法:
将ethtool设置写入/etc/rc.local之中。

《Linux杂记》Linux设置网卡速度与模式_第2张图片

图2

【注】本配置使用的系统是Ubuntu16.04,32位和64位是一样的,其他版本的系统可能路径稍微有些不同,但命令都是一样的。

3.安装ethtool方法(最新的版本是4.13,截止到2018-01-04):

如果系统没有安装ethtool,以下是安装方法。

wget https://www.kernel.org/pub/software/network/ethtool/ethtool-4.13.tar.xz
tar -xvf ethtool-4.13.tar
cd ethtool-4.13
./configure && make && make install

【注】笔者使用的系统是Ubuntu16.04。

你可能感兴趣的:(《Linux杂记》Linux设置网卡速度与模式)