Linux 查看网卡全双工 还是半双工 以及设置网卡为半双工

资讯 2024-07-09 阅读:96 评论:0
在Linux中怎么看网卡是全双工工作还是半双工工作? What does Linux think of a net card as a full-time job or a half-time job? Linux:~ # mii-t...
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

在Linux中怎么看网卡是全双工工作还是半双工工作?

What does Linux think of a net card as a full-time job or a half-time job?

Linux:~ # mii-tool
eth0: no link
eth1: no autonegotiation, 100baseTx-HD, link ok

Linux:~ # mii-tool -F 
mii-tool: option requires an argument -- F 
usage: mii-tool [-VvRrwl] [-A media,... | -F media] [interface ...] 
   -V, --version     display version information 
   -v, --verbose     more verbose output 
   -R, --reset       reset MII to poweron state 
   -r, --restart     restart autonegotiation 
   -w, --watch       monitor for link status changes 
   -l, --log         with -w, write events to syslog 
   -A, --advertise=media,... advertise only specified media 
   -F, --force=media     force specified media technology 
media: 100baseT4, 100baseTx-FD, 100baseTx-HD,10baseT-FD, 10baseT-HD, 
(to advertise both HD and FD) 100baseTx, 10baseT

Linux:~ # mii-tool eth0: no link eth1: no autonegotiation, 100baseTx-HD, link ok

Linux:~ # mii-tool -F 100baseTx-HD

//切换网卡得状态为半双工状态 Linux:~ # mii-tool eth0:100 Mbit, half duplex, no link eth1:100 Mbit, half duplex, link ok

#mii-tool eth0:100Mbit, half duplex, no link eth1:100Mbit, half duplex, link ok

出处:jekay100.cublog.cn 更新时间: 2007年03月30日 DNS客户端配置文件/etc/resolv.conf /etc/resolv.conf 里面存放的是各大通信公司DNS服务器列表;下面的三个地址可以用一用;当然您可以打电话问你的服务商; nameserver 202.96.134.133 nameserver 202.96.128.143 nameserver 202.96.68.38;改变网络接口的速度和协商方式的工具miitool 和ethtool 通过mii-tool和ethtool工具来调整网卡的速度、双工等,这样能提高网卡的效率;

Source: jekay100.cublog.cn Update: 30/03/2007 DNS client configuration document/etc/resolv.conf/etc/resolv.conf contains a list of DNS servers of major communications companies; the following three addresses can be used; of course, you can call your service provider; nameserver 202.96.134.133 nameserver 202.96.128.143 nameserver 202.68.38; tools to change the speed and consultation of network interfaces can improve the efficiency of the webcards by adjusting the speed, double-work, etc. through mi-tool and ethtool tools;

mii-tool 介绍

iii-tool Introduction

mii-tool - view, manipulate media-independent interface status (mii-tool 是查看,管理介质的网络接口的状态) 有时网卡需要配置协商方式,比如10/100/1000M的网卡半双工、全双工、自动协商的配置 。但大多数的网络设备是不用我们来修改协商,因为大多数网络设置接入的时候,都采用自动协商来解决相互通信的问题。但在有的情况下,需要我们手动来设置网卡的协商方式; mii-tool 就是能指定网卡的协商方式。

But most of the network equipment does not need us to modify the consultation because most network settings use automatic consultation to solve the problem of communication. In some cases, we need to manually set up the network card; mii-tool is the method of consultation that can assign the card.

注明:我在使用mii- tool工具修改协商模式时,提示是错误的,因为是在虚拟机中做的,不过虚拟机中的网卡我查看是支持全双工模式的,可是提 示错误SIOCGMIIPHY on 'eth0' failed: Operation not supported,问题出在那里也不清楚,用google查了下,发现不少人都是这样的错误,也没说明原因;不过多数人提示可以使用ethtool工具去修改,我测试了下,还行!

Note: When I used the mi-tool tool to modify the consultation mode, the reminder was wrong, because it was made in a virtual machine, but the netcard in the virtual machine I looked at was in support of the full-time mode, but the error SIOCGMIIPHY on 'eth0' mentioned: Cooperation not supported: problem was unknown there, Google found many such errors and no explanation; but most people suggested using the ethtool tool to modify them, and I tested them, and it was fine!

还有一种方法是修改/etc/modules.conf配置文件;

Another method is to modify/etc/modules.conf profile;

#ethtool -s eth0 autoneg off #ethtool -s eth0 duplex full

在/etc/modules.conf添加内容 alias eth0 bcm5700 line_speed=100 full_duplex=1 options bcm5700 line_speed=100 full_duplex=1 重起!

Add to/etc/modules.conf alias eth0 bcm 5700 line_speed=100 full_duplex=1 options bcm5700line_speed=100 full_duplex=1 reboot!

[root@localhost]# mii-tool --help usage: mii-tool
[-VvRrwl] [-A media,... | 
-F media] [interface ...] 
-V, --version display version information 
-v, --verbose more verbose output 注:显示网络接口的信息; 
-R, --reset reset MII to poweron state 注:重设MII到开启状态; 
-r, --restart restart autonegotiation 注:重启自动协商模式; 
-w, --watch monitor for link status changes 注:查看网络接口连接的状态变化; 
-l, --log with -w, write events to syslog 注:写入事件到系统日志; 
-A, --advertise=media,...advertise only specified media 注:指令特定的网络接口; 
-F, --force=media force specified media technology 注:更改网络接口协商方式;media: 100baseT4, 100baseTx-FD, 100baseTx-HD,10baseT-FD, 10baseT-HD, (to advertise both HD and FD) 100baseTx, 10baseT

查看网络接口的协商状态

[root@localhost]# mii-tool -v eth0 
eth0: negotiated 100baseTx-FD, link ok 
product info: vendor 00:00:00, model 0 rev 0 
basic mode: autonegotiation enabled 
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 
advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 
link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
注:上面的例子,我们可以看得到是自动协商;

See the consultation status of the network interface

 for example: 

更改网络接口的协商方式,我们要用到-F选项,后面可以接 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD等参数;

Change the way the network interface is negotiated, we need to use the -F option, which can be followed by parameters such as 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD, 10baseT-HD;

[root@localhost]# mii-tool -F 100baseTx-FD 
[root@localhost]#mii-tool -v eth0 
eth0: 100 Mbit, full duplex, link ok 
product info: vendor 00:00:00, model 0 rev 0 
basic mode: 100 Mbit, full duplex 
basic status: link ok 
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD

也可以使用ethtool工具修改:

[root@localhost]# ethtool -s eth0 speed 100 duplex full 

You can also use the ethtool tool to modify:


ethtool - Display or change ethernet card settings(ethtool 是用来显示和更改网卡设置的工具);这个工具比较复杂,功能也特别多。

Ethtool - Display or change Ethernet card settings (ethtool is the tool used to display and change network card settings); this tool is more complex and particularly functional.

ethtool 显示网络端口设置功能

[root@localhost]# ethtool eth0 
Settings for eth0: 
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full 
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes 
Advertised link modes: 10baseT/Half 10baseT/Full 
100baseT/Half 100baseT/Full 
Advertised auto-negotiation: No 注:自动协商关闭 
Speed: 100Mb/s 注:速度 100Mb 
Duplex: Full 注:全双工
Port: MII 
PHYAD: 32
Transceiver: internal 
Auto-negotiation: off 
Supports Wake-on: pumbg 
Wake-on: d
Current message level: 0x00000007 (7) 
Link detected: yes 注:eth0已经激活;

 [root@localhost]#ethtool eth0 Setings for eth0: Supported portes: [TP MII] Supported Links: 10baseT/Half 10baseT/Full 100baseT/Full 100baseT/Full 100baseT/Half 100baseT/Falf 100baset: 100baseT/FullSupports auto-negotiation: Yes Advertised Link Modes: 10baseT/Half 10baseT/Full 100baseT/Herf 100baseT/FullAdverted Auto-negot: No Note: Automatic Consultation Closed: 100Mb/Supres

ethtool 设置网卡的协商模式;

ethtool -s DEVNAME 
[ speed 10|100|1000 ] 
[ duplex half|full ] [
port tp|aui|bnc|mii|fibre ] 
[ autoneg on|off ] 

[root@localhost]# ethtool -s eth1 speed 10 duplex half 
[root@localhost]# ethtool eth1 
Settings for eth1: 
     Supported ports: [ TP MII ] 
     Supported link modes: 10baseT/Half 10baseT/Full 
                           100baseT/Half 100baseT/Full 
     Supports auto-negotiation: Yes 
     Advertised link modes: 10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
     Advertised auto-negotiation: No 
     Speed: 10Mb/s 注:速度 10M/s 
     Duplex: Half  注:半双工 
     Port: MII 
     PHYAD: 32 
     Transceiver: internal 
     Auto-negotiation: off 
     Supports Wake-on: pumbg 
     Wake-on: d 
     Current message level:0x00000007 (7) 
     Link detected: no 注:eth1没有激活;

 [root@localhost]#ethtool -seth1 speak 10 duplex half [root@localhost]#ethtool et1 Setings for eth1: Supportedports: [TP MII]Supported Links: 10baseT/Half 10baseT/Full100baseT/Half 100baseT/FullSupports auto-negotiation: Yes Advertised Link Modes: 10baseT/Half 10baset/Half 10baset/Falf 10baset/Full100baseT/Haf100baseT/FullAdvert: 

[root@localhost]# ethtool -s eth1 speed 100 duplex full 
[root@localhost]# ethtool eth1 
Settings for eth1: 
     Supported ports: [ TP MII ] 
     Supported link modes: 10baseT/Half 10baseT/Full 
                           100baseT/Half 100baseT/Full 
     Supports auto-negotiation: Yes 
     Advertised link modes: 10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full 
     Advertised auto-negotiation: No 
     Speed: 100Mb/s 注:速度 100M/s 
     Duplex: Full 注:全双工 
     Port: MII 
     PHYAD: 32 
     Transceiver: internal 
     Auto-negotiation: off 
     Supports Wake-on: pumbg 
     Wake-on: d 
     Current message level:0x00000007 (7) 
     Link detected: no 注:eth1网卡没有激活;

 [root@localhost]#ethtool-seth1 speak 100 duplex Full [root@localhost]#ethtool et1 Setings for eth1: Supportedports: [TP MII] Supported Links: 10baseT/Half 10baseT/Full100baseT/FullSupports auto-negotiation: Yes Advettised Links: 10baseT/Half100baseT/FulSupports: Full Manual: Germany: 32

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 区块链社区有哪些?区块链社区是什么?

    区块链社区有哪些?区块链社区是什么?
    展开全文...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
  • 0.00003374个比特币等于多少人民币/美金

    0.00003374个比特币等于多少人民币/美金
    0.00003374比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00003374比特币等于2.2826 1222美元/16.5261124728人民币。比特币(BTC)美元(USDT)人民币(CNY)0.00003374克洛克-0/22216.5261124728比特币对人民币的最新汇率为:489807.72 CNY(1比特币=489807.72人民币)(1美元=7.24人民币)(0.00003374USDT=0.0002442776 CNY)。汇率更新于2024...
  • 0.00015693个比特币等于多少人民币/美金

    0.00015693个比特币等于多少人民币/美金
    0.000 15693比特币等于多少人民币?根据比特币对人民币的最新汇率,0.000 15693比特币等于10.6 1678529美元/76.86554996人民币。比特币(BTC)【比特币价格翻倍】美元(USDT)人民币(CNY)0.000/克洛克-0/5693【数字货币矿机】10.6 167852976.8655254996比特币对人民币的最新汇率为:489,807.72 CNY(1比特币= 489,807.72人民币)(1美元=7.24人民币)(0.00015693 U...
  • 带你进入一次元宇宙,让你亲身体会如何在元宇宙中抓住自己的机会

    带你进入一次元宇宙,让你亲身体会如何在元宇宙中抓住自己的机会
    元宇宙是个怎样的世界?鑫哥今天带你进入一次元宇宙。今天用最简单明了的语言来解释一下元宇宙,还有如何利用元宇宙实现财富自由。What kind of world is Yuan cosmos? Brother Jin took you into the Yuan cosmos today. Today, explain the Yuan cosmos in the simplest language, and how to use the Yuan cosmos for the...
标签列表