更改Linux下网卡速度

主要有以下4步骤:

1.linux中安装ethtool工具

sudo apt-get install ethtool

2.查看网卡编号

ifconfig

显示如下:
ens33: flags=4163  mtu 1500
        ether 00:0c:29:de:8e:73  txqueuelen 1000  (Ethernet)
        RX packets 59157  bytes 4378916 (4.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4540  bytes 392294 (392.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enx00e04c36000e: flags=4163  mtu 1500
        inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::b641:d48e:8aad:b245  prefixlen 64  scopeid 0x20
        ether 00:e0:4c:36:00:0e  txqueuelen 1000  (Ethernet)
        RX packets 3355  bytes 509406 (509.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3029  bytes 293971 (293.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2691  bytes 231360 (231.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2691  bytes 231360 (231.3 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

我的网卡有两个,分别是ens33、enx00e04c36000e: (不同电脑下linux中网卡不一样)


3.查看需要更改的网卡信息:我想查看的是enx00e04c36000e

ethtool enx00e04c36000e

Settings for enx00e04c36000e:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  Not reported
	Advertised pause frame use: No
	Advertised auto-negotiation: No
	Advertised FEC modes: Not reported
	Speed: 10Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 32
	Transceiver: internal
	Auto-negotiation: off
    Cannot get wake-on-lan settings: Operation not permitted
	Current message lev

其中速度模式有四种
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full


4.更改自己需要的网卡速度 应项目需要我更改的是enx00e04c36000e的外接USB网卡设定为10M全双工

sudo ethtool -s enx00e04c36000e autoneg off speed 10 duplex full

补充说明: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]/ //设置网口类型

完成

更改Linux下网卡速度_第1张图片

你可能感兴趣的:(Linux)