更改Linux下网卡速度

主要有以下4步骤:

1.linux中安装ethtool工具

sudo apt-get install ethtool

2.查看网卡编号

ifconfig

显示如下:
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  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<UP,BROADCAST,RUNNING,MULTICAST>  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<link>
        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<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        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]/ //设置网口类型

完成

在这里插入图片描述

  • 5
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值