linux 网卡的位置,网卡诊断和调整工具 ethtool 确定多网卡Linux服务器网口位置

ethtool 是一个 Linux 下的网络驱动程序的诊断和调整工具,可获取网络设备的相关信息,包括连接状态、驱动版本、PCI 总线定位等等。

Ethtool命令:用途

显示或修改以太网卡的配置信息。语法

ethtool [ -a | -c | -g | -i | -d | -k | -r | -S |] ethX

ethtool [-A] ethX [autoneg on|off] [rx on|off] [tx on|off]

ethtool [-C] ethX [adaptive-rx on|off] [adaptive-tx on|off] [rx-usecs N] [rx-frames N] [rx-usecs-irq N] [rx-frames-irq N] [tx-usecs N] [tx-frames N] [tx-usecs-irq N] [tx-frames-irq N] [stats-block-usecs N][pkt-rate-low N][rx-usecs-low N] [rx-frames-low N] [tx-usecs-low N] [tx-frames-low N] [pkt-rate-high N] [rx-usecs-high N] [rx-frames-high N] [tx-usecs-high N] [tx-frames-high N] [sample-interval N]

ethtool [-G] ethX [rx N] [rx-mini N] [rx-jumbo N] [tx N]

ethtool [-e] ethX [raw on|off] [offset N] [length N]

ethtool [-E] ethX [magic N] [offset N] [value N]

ethtool [-K] ethX [rx on|off] [tx on|off] [sg on|off] [tso on|off]

ethtool [-p] ethX [N]

ethtool [-t] ethX [offline|online]

ethtool [-s] ethX [speed 10|100|1000] [duplex half|full] [autoneg on|off] [port tp|aui|bnc|mii] [phyad N] [xcvr internal|external]

[wol p|u|m|b|a|g|s|d...] [sopass xx:yy:zz:aa:bb:cc] [msglvl N]描述

Ethtool命令用于获取以太网卡的配置信息,或者修改这些配置。

ethX是以太网卡的名称,Linux系统将检测到的第一块以太网卡命名为eth0, 第二块为eth1,…….。标志

-a查看网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或停用off

-A修改网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或停用off

-cdisplay the Coalesce information of the specified ethernet card

-CChange the Coalesce setting of the specified ethernet card

-gDisplay the rx/tx ring parameter information of the specified ethernet card

-Gchange the rx/tx ring setting of the specified ethernet card

-i显示网卡驱动的信息,如驱动的名称、版本等

-d显示register dump信息, 部分网卡驱动不支持该选项

-e显示EEPROM dump信息,部分网卡驱动不支持该选项

-E修改网卡EEPROM byte

-k显示网卡Offload参数的状态:on 或 off,包括rx-checksumming、tx-checksumming等。

-K修改网卡Offload参数的状态

-p用于区别不同ethX对应网卡的物理位置,常用的方法是使网卡port上的led不断的闪;N指示了网卡闪的持续时间,以秒为单位。

-r如果auto-negotiation模块的状态为on,则restarts auto-negotiation

-S显示NIC- and driver-specific 的统计参数,如网卡接收/发送的字节数、接收/发送的广播包个数等。

-t让网卡执行自我检测,有两种模式:offline or online

-s修改网卡的部分配置,包括网卡速度、单工/全双工模式、mac地址等示例查看机器上网卡的速度:百兆还是千兆,请输入:

ethool eth0

操作完毕后,输出信息中‘Speed:’ 这一项就指示了网卡的速度。停止网卡的发送模块TX,请输入:

ethtool -A tx off eth0

操作完毕后,可输入:ethtool -a eth0,查看tx模块是否已被停止。查看网卡eth0采用了何种驱动,请输入:

ethtool -i eth0

操作完毕后,显示 driver: bnx2;version: 1.4.30 等信息。关闭网卡对收到的数据包的校验功能,请输入:

ethtool -K eth0 rx off

操作完毕后,可输入:ethtool –k eth0,查看校验功能是否已被停止。如果机器上安装了两块网卡,那么eth0对应着哪块网卡呢?输入:

ethtool -p eth0 10

操作完毕后,看哪块网卡的led灯在闪,eth0就对应着哪块网卡。查看网卡,在接收/发送数据时,有没有出错?请输入:

ethtool –S eth0将千兆网卡的速度降为百兆,请输入:

ethtool -s eth0 speed 100

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux系统中,网卡通常对应着网口。要确定网口对应的配置文件,可以通过以下几种方法来查找: 1. 使用ifconfig命令查看当前系统中的网卡信息。在终端中输入ifconfig命令,会列出当前系统中所有的网卡及其对应的IP地址、MAC地址等信息。通过观察网卡的名称,如eth0、eth1等,可以确定网口对应的配置文件。 2. 查看/etc/sysconfig/network-scripts/目录下的配置文件。在该目录下,每个网卡对应一个配置文件,文件名的格式通常为ifcfg-网卡名称,如ifcfg-eth0、ifcfg-eth1等。通过查看这些配置文件,可以确定网口对应的配置文件。 3. 使用ethtool命令查看网卡的详细信息。在终端中输入ethtool 网卡名称命令,如ethtool eth0,可以查看该网卡的详细信息,包括网口的标识符、驱动程序等。通过这些信息,可以确定网口对应的配置文件。 总结起来,要确定Linux系统中网口对应的配置文件,可以通过使用ifconfig命令、查看/etc/sysconfig/network-scripts/目录下的配置文件以及使用ethtool命令来获取相关信息。 #### 引用[.reference_title] - *1* [linux服务器)如何确认网卡网口)对应的配置文件](https://blog.csdn.net/dbdd_cf/article/details/88863064)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值