首页 > 其他分享 >树莓派使用ethtool永久配置网口信息与工作模式

树莓派使用ethtool永久配置网口信息与工作模式

时间:2024-06-12 10:14:22浏览次数:14  
标签:ethtool 树莓 Full 10baseT 100baseT 网口 Half eth0

1、安装ethtool软件

使用指令
sudo apt-get install ethtool

成功显示:

pi@jcr:~ $ sudo apt-get install ethtool
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ethtool is already the newest version (1:5.9-1).
0 upgraded, 0 newly installed, 0 to remove and 46 not upgraded.

2、查看当前网口状态

如查看eth0:使用指令
ethtool eth0

成功显示:

pi@raspberrypi:~ $ ethtool eth0
Settings for eth0:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Auto-negotiation: on
        master-slave cfg: preferred slave
        master-slave status: slave
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: external
        MDI-X: Unknown
netlink error: Operation not permitted
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes

3、打开网络配置文件:

使用指令

sudo nano /etc/network/interfaces

4、编辑接口配置:找到你的以太网接口配置(通常是eth0),并添加pre-up命令来设定速度、双工模式和关闭自动协商。例如,要设置100Mbps的速度和半双工模式,可以添加如下行:

添加命令

auto eth0
iface eth0 inet dhcp
    pre-up ethtool -s eth0 speed 100 duplex half autoneg off

如果你的树莓派使用静态IP,确保保留或正确配置相应的静态IP设置。

5、保存并退出,然后重启网络服务使更改生效:

使用指令

sudo systemctl restart networking

6、完成后重启树莓派查看

使用指令

sudo reboot
#重启完成后使用指令
ethtool eth0

成功显示

pi@raspberrypi:~ $ ethtool eth0
Settings for eth0:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 100Mb/s
        Duplex: Half
        Auto-negotiation: off
        master-slave cfg: preferred slave
        master-slave status: slave
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: external
        MDI-X: Unknown
netlink error: Operation not permitted
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes

标签:ethtool,树莓,Full,10baseT,100baseT,网口,Half,eth0
From: https://www.cnblogs.com/mr07/p/18243351

相关文章

  • 树莓派 linux安装PyBlueZ报错:fatal error: bluetooth/bluetooth.h: No such file or d
    IwanttobuildacfilebasedonBlueZbutseemsnobluetooth.hfileinmysystem.fatalerror:bluetooth/bluetooth.h:NosuchfileordirectoryIamsurethebluetoothdongleisrunningcorrectlyandIhavebuiltBluezsuccessfully.UpdateFormyca......
  • 无屏幕和键盘配置树莓派WiFi和SSH
    不算是什么新功能了,在树莓派3B发布后不久,树莓派官方Raspbian系统久加入了允许在开机前对WiFi网络进行配置的机制。注意,这个方法仅适用于全新安装树莓派系统到SD卡之后没有做过任何Wi-Fi配置的情况下有效。如果你之前配置过Wi-Fi,再用本方法系统会默认使用已有的......
  • 玩转树莓派之系统安装篇
    介绍树莓派是树莓派基金会下的一个明星产品(单板计算机),已经迭代到第五代了;它性能强大、开源、拓展性强、体积小,搞物联网开发的人基本都听说过这个玩意!笔者手上刚好有一块4B的板子,让我们一起来玩转树莓派安装准备硬件树莓派4B4G内存版32GBSD卡读卡器电源适配器键盘鼠标......
  • 树莓派连接Windows10 PC以太网线上网
    前言昨天参加RT-Thread线下活动发现有人用Windows10PC的以太网来给Renesas的板子HMI-Board联网,实现MQTT分布式通信,今天闲来无事也想要在树莓派上面试一试教程按下WIN+S快捷键,搜索控制面板在打开的控制面板页面,找到网络和共享中心并点击进去在打开的网络和共享中心页面,......
  • 百兆网口和千兆网口指示含义的区别
    网口指示灯状态:千兆网口和百兆网口灯的含义不同千兆网口:根据核心板提供给ETH0_LED1、ETH0_LED1的信号当与其连接的是百兆网口PHY芯片的设备时,LED1(绿灯)亮,LED2(黄灯)不亮当有数据发送或者接收时,闪烁;当与其连接的是千兆网口PHY芯片的设备时,LED2(黄灯)亮,LED1(绿灯)不亮,当有数据发送或......
  • NET工控,上位机,Modbus485网口/串口通讯(鸣志步进电机,鸣志伺服电机,松下伺服电机,华庆
    先上两个通用Modbus帮助类,下面这个是多线程不安全版,在多线程多电机同一端口通信下,可能造成步进电机丢步或者输出口无响应等,还有个多线程安全版,只是基于这个不安全版加上了LOCK,THISusingModbus.Device;usingSunny.UI;usingSystem;usingSystem.IO.Ports;usingSystem.Li......
  • 树莓派重新刷系统
    树莓派重新刷系统https://www.raspberrypi.com/software/operating-systems/country=CNctrl_interface=DIR=/var/run/wpa_supplicantGROUP=netdevupdate_config=1network={ssid="热点/wifi名称"psk="热点/wifi密码"priority=2}......
  • 三大网口类型:千兆网口、2.5G网口和5G网口
    在现代网络中,我们常常面临着选择不同类型的网口的情况,其中包括千兆网口、2.5G网口和5G网口。本文将详细介绍这些网口类型以及如何根据需求选择适合的网口。千兆网口首先,我们来了解一下千兆网口,也称为GigabitEthernet。它是最为常见和广泛使用的网口类型之一。千兆网......
  • 树莓派安装向日葵教程
    树莓派安装向日葵教程RaspberryPi版本:2024-03-15-raspios-bookworm-arm64-full.img下载麒麟arm版本客户端向日葵远程控制app官方下载-贝锐向日葵官网安装依赖包sudoapt-getupdatesudoapt-getinstalllibgtk-3-0或者sudoaptinstalllibappindicator3-1......
  • 树莓派3B+中下载miniconda3
    1、引言在树莓派3B中下载miniconda后(3.16的版本2018年的相当老旧;)才发现他并不能下载3.7以上的版本,3.6可以,、、使用该命令对conda升级后也不能实现;condaupdate-nroot-cdefaultsconda查阅资料才发现Linux操作系统为32位的要下载armv7结尾的.sh文件,但是Miniconda对arm......