ubuntu设置网卡速率

    xiaoxiao2021-03-25  129

    在公司下载代码的时候,发现自己的速率只有10M左右,太慢了~,而且同步代码更是巨卡。 在网上查看原因没找到,后来经过公司的IT来看,说是我的网络设置有问题,看他在那里忙活了一会,就ok了。我看到它使用了ethtool 这个命令,于是乎,我自己就在网上查了查,了解了一下并实践了一下,感觉还是写到这里,做个备注吧。下面的内容都是来自网络。

    使用ethtool

    第一次使用可能需要你安装,按照提示安装即可 其中比较常用的就是 -s 参数 用ethtool设置网卡的速度参数 ethtool -s 【网卡名】【速度设置】【工作模式】【是否自适应】 Example

    ethtool -s eth0 speed 1000 duplex full autoneg on root@CP-PC-0056:~# 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: No Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Link partner advertised pause frame use: No Link partner advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: MII PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) drv probe ifdown ifup Link detected: yes

    想了解更多,我们可以查看帮组信息,能够得到下面一大坨信息:

    root@CP-PC-0056:~# ethtool -h ethtool version 3.13 Usage: ethtool DEVNAME Display standard information about device ethtool -s|--change DEVNAME Change generic options [ speed %d ] #设置速率 [ duplex half|full ] #设置工作模式【半双工or全双工】 [ port tp|aui|bnc|mii|fibre ] [ mdix auto|on|off ] [ autoneg on|off ] #设置是否自动协商 [ advertise %x ] [ phyad %d ] [ xcvr internal|external ] [ wol p|u|m|b|a|g|s|d... ] [ sopass %x:%x:%x:%x:%x:%x ] [ msglvl %d | msglvl type on|off ... ] ethtool -a|--show-pause DEVNAME Show pause options ethtool -A|--pause DEVNAME Set pause options [ autoneg on|off ] [ rx on|off ] [ tx on|off ] ethtool -c|--show-coalesce DEVNAME Show coalesce options ethtool -C|--coalesce DEVNAME Set coalesce options [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|--show-ring DEVNAME Query RX/TX ring parameters ethtool -G|--set-ring DEVNAME Set RX/TX ring parameters [ rx N ] [ rx-mini N ] [ rx-jumbo N ] [ tx N ] ethtool -k|--show-features|--show-offload DEVNAME Get state of protocol offload and other features ethtool -K|--features|--offload DEVNAME Set protocol offload and other features FEATURE on|off ... ethtool -i|--driver DEVNAME Show driver information ethtool -d|--register-dump DEVNAME Do a register dump [ raw on|off ] [ file FILENAME ] ethtool -e|--eeprom-dump DEVNAME Do a EEPROM dump [ raw on|off ] [ offset N ] [ length N ] ethtool -E|--change-eeprom DEVNAME Change bytes in device EEPROM [ magic N ] [ offset N ] [ length N ] [ value N ] ethtool -r|--negotiate DEVNAME Restart N-WAY negotiation ethtool -p|--identify DEVNAME Show visible port identification (e.g. blinking) [ TIME-IN-SECONDS ] ethtool -t|--test DEVNAME Execute adapter self test [ online | offline | external_lb ] ethtool -S|--statistics DEVNAME Show adapter statistics ethtool -n|-u|--show-nfc|--show-ntuple DEVNAME Show Rx network flow classification options or rules [ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 | rule %d ] ethtool -N|-U|--config-nfc|--config-ntuple DEVNAME Configure Rx network flow classification options or rules rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... | flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4 [ src %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ] [ dst %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ] [ proto %d [m %x] ] [ src-ip %d.%d.%d.%d [m %d.%d.%d.%d] ] [ dst-ip %d.%d.%d.%d [m %d.%d.%d.%d] ] [ tos %d [m %x] ] [ l4proto %d [m %x] ] [ src-port %d [m %x] ] [ dst-port %d [m %x] ] [ spi %d [m %x] ] [ vlan-etype %x [m %x] ] [ vlan %x [m %x] ] [ user-def %x [m %x] ] [ dst-mac %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ] [ action %d ] [ loc %d]] | delete %d ethtool -T|--show-time-stamping DEVNAME Show time stamping capabilities ethtool -x|--show-rxfh-indir DEVNAME Show Rx flow hash indirection ethtool -X|--set-rxfh-indir DEVNAME Set Rx flow hash indirection equal N | weight W0 W1 ... ethtool -f|--flash DEVNAME Flash firmware image from the specified file to a region on the device FILENAME [ REGION-NUMBER-TO-FLASH ] ethtool -P|--show-permaddr DEVNAME Show permanent hardware address ethtool -w|--get-dump DEVNAME Get dump flag, data [ data FILENAME ] ethtool -W|--set-dump DEVNAME Set dump flag of the device N ethtool -l|--show-channels DEVNAME Query Channels ethtool -L|--set-channels DEVNAME Set Channels [ rx N ] [ tx N ] [ other N ] [ combined N ] ethtool --show-priv-flags DEVNAME Query private flags ethtool --set-priv-flags DEVNAME Set private flags FLAG on|off ... ethtool -m|--dump-module-eeprom|--module-info DEVNAME Query/Decode Module EEPROM information and optical diagnostics if available [ raw on|off ] [ hex on|off ] [ offset N ] [ length N ] ethtool --show-eee DEVNAME Show EEE settings ethtool --set-eee DEVNAME Set EEE settings [ eee on|off ] [ advertise %x ] [ tx-lpi on|off ] [ tx-timer %d ] ethtool -h|--help Show this help ethtool --version Show version number
    转载请注明原文地址: https://ju.6miu.com/read-24140.html

    最新回复(0)