ubuntu18 usb网卡网速只有10M解决方法

手上有个win10平板,经折腾,刷成了ubuntu18,但自带的wifi经千辛万苦驱动起来后,内网ping值高达200+,遂购买usb网卡一张,ping值降到2以内,可以接受,但是网速只有10m,无法接受

一.修改网卡参数

1.1 查询网卡名

ip addr或ifconfig均可

xue@xue-EZpad6:~$ ip addr
2: enx00e04c3603d8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:e0:4c:36:03:d8 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.110/24 brd 10.0.0.255 scope global dynamic noprefixroute enx00e04c3603d8
       valid_lft 73698sec preferred_lft 73698sec
    inet6 fe80::75f7:f5c3:e075:ade6/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

1.2 安装ethtool工具

sudo apt install ethtool

xue@xue-EZpad6:~$ ethtool enx00e04c3603d8
Settings for enx00e04c3603d8:
        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: on
Cannot get wake-on-lan settings: Operation not permitted
        Current message level: 0x00007fff (32767)
                               drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol
        Link detected: yes

问题就在这里,Speed: 10Mb/s

1.3 通过测试,命令如下

sudo ethtool -s enx00e04c3603d8 speed 100 duplex full autoneg off

speed 100 设置速度(我的网卡最大只支持100Mb/s),duplex full 设置全双工模式,  autoneg off 关闭自动协商

注:最重要的是第三个参数,开启了自动协商,设置速度是无效的,因为网卡和路由器协商的结果就是10Mb/s,只有关闭了协商,才能让网卡强制运行100Mb/s模式.

 

二.设置开机启动

经过ethtool设置后,只是当前有效,重启设备后即失效,故需把命令添加到开机启动中,让他自动生效

2.1 编辑/lib/systemd/system/rc.local.service,设置启动参数,添加如下代码

sudo vim /lib/systemd/system/rc.local.service 

[Install]
WantedBy=multi-user.target
Alias=rc-local.service

2.2设置软连接,开机启动回去/etc/……这个目录下去找文件

ln -s /lib/systemd/system/rc.local.service /etc/systemd/system/rc.local.service

2.3创建/etc/rc.local,写入需要开启启动的命令

sudo vim /etc/rc.local

#!/bin/bash
ethtool -s enx00e04c3603d8 speed 100 duplex full autoneg off
exit 0

:x保存退出

2.4 为/etc/rc.local附加执行权限

sudo chmod +x /etc/rc.local

2.5 重启设备

reboot

2.6 用ethtool检查结果

xue@xue-EZpad6:~$ ethtool enx00e04c3603d8
Settings for enx00e04c3603d8:
        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: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: off
Cannot get wake-on-lan settings: Operation not permitted
        Current message level: 0x00007fff (32767)
                               drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol
        Link detected: yes

Speed: 100Mb/s

成功.

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
解决Ubuntu网速慢的方法有多种。首先,可以通过检查网络硬件的详细信息来确定网络连接的情况,可以使用以下命令:sudo lshw -numeric -class network、sudo ip addr show、sudo ip route show、sudo traceroute forum.ubuntu.org.cn 。 其次,如果网速仍然很慢,尤其是网页加载速度缓慢,可能是DNS的问题。可以通过修改配置将本地设置为一个DNS解析服务器来解决这个问题 。具体操作如下: 1. 安装dnsmasq,用于做DNS缓存:sudo apt-get install dnsmasq 。 2. 编辑dnsmasq的配置文件:sudo vi /etc/dnsmasq.conf,在文件中找到"resolv-file=/etc/resolv.dnsmasq.conf"这一行,并修改为该行。 3. 确保/etc/resolv.conf文件中的DNS信息正确,然后执行sudo cp /etc/resolv.conf /etc/resolv.dnsmasq.conf。 4. 将/etc/resolv.conf文件中的DNS改为127.0.0.1:nameserver 127.0.0.1。 5. 如果使用adsl上网,需要修改/etc/ppp/peers/dsl-provider文件,注释掉"usepeerdns"这一行,以免它覆盖/etc/resolv.conf文件的内容。 6. 重启dnsmasq服务:sudo /etc/init.d/dnsmasq restart。 另外,如果遇到traceroute指令报错,请先安装traceroute:sudo apt-get install traceroute 。如果显示软件包被引用...的错误,请修改apt源,使用国内源的下载速度会更快。 综上所述,以上是解决Ubuntu网速慢的一些常用方法。希望对您有帮助。<span class="em">1</span><span class="em">2</span><span class="em">3</span><span class="em">4</span>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值