a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 88|回复: 0

[综合辅导] Linux认证辅导:Linux/Unix命令Ethtool

[复制链接]
发表于 2012-8-4 12:07:07 | 显示全部楼层 |阅读模式
Linux认证辅导:Linux/Unix命令Ethtool
! y( ~9 h  d0 H* N8 gLinux/Unix命令之Ethtool9 R; C. i' `0 m5 D. O
描述:( _& ?& O  u9 ]7 z
Ethtool是用于查询及设置网卡参数的命令。" G6 ~8 v# B3 A
概要:
% X; Y* b( \2 T, R) l+ Yethtool ethX //查询ethX网口基本设置
" P) E" o& c! {$ `% `9 U  K0 jethtool –h //显示ethtool的命令帮助(help), F  p' t" }7 O$ [7 m$ T- F  _
ethtool –i ethX //查询ethX网口的相关信息8 K. _4 N+ `! K" E! s
ethtool –d ethX //查询ethX网口注册性信息( p; g% D$ {) U# n
ethtool –r ethX //重置ethX网口到自适应模式" b8 i0 @# ^& M8 ]
ethtool –S ethX //查询ethX网口收发包统计" z- ~- ^5 k* U: K& y
ethtool –s ethX [speed 10|100|1000]\ //设置网口速率10/100/1000M( C7 s0 E7 ?2 L0 p/ N6 Z
[duplex half|full]\ //设置网口半/全双工
9 C6 h" C) {% Z[autoneg on|off]\ //设置网口是否自协商. h8 @$ l1 j6 b( u
[port tp|aui|bnc|mii]\ //设置网口类型
- t7 S- f& Q- W& K[phyad N]\
! H* k' z8 S2 T[xcvr internal|exteral]\
$ Z8 q5 \$ ~8 r0 }% u* F[wol p|u|m|b|a|g|s|d…]\! i. _! k% p5 J2 z
[sopass xx:yy:zz:aa:bb:cc]\
$ a1 T! b8 S3 x3 [. {[msglvl N]
& u9 ], U: K5 P8 |0 P' _举例:# e% D+ Z  J4 H
1)[root@linux /]# ethtool eth1- H5 a8 q% Q4 r2 _- q6 }
Settings for eth1:' [( _+ R+ |* r. a
Supported ports: [ TP ]4 U0 h+ F3 b: d1 d( S% u; Z
Supported link modes: 10baseT/Half 10baseT/Full4 b6 C- m  [* F, f7 D: X
100baseT/Half 100baseT/Full
6 E, X3 q3 F8 [* D  M1000baseT/Full0 f& ^! m8 r- ^' w2 e
Supports auto-negotiation: Yes
3 K. F( t9 t& a2 j# R; gAdvertised link modes: 10baseT/Half 10baseT/Full
$ K8 d3 [/ F" e# q" M/ @+ h100baseT/Half 100baseT/Full, ^& J6 e- j0 k
1000baseT/Full
9 z# f0 N6 I5 X4 K# ]+ t# _' QAdvertised auto-negotiation: Yes4 r" |' d) |: H9 @6 w
Speed: 1000Mb/s2 [  X4 C% u. g, V2 A5 U# i0 c
Duplex: Full
" [+ }; ]7 o7 r" v* A9 d/ fPort: Twisted Pair5 F7 e7 A' c2 |$ @. ~- {
PHYAD: 0
3 Q) x: n0 L4 W! uTransceiver: internal
, K: A5 u" e. C( w) XAuto-negotiation: on: G1 f2 ^1 B  H$ L7 j: J5 m8 L
Supports Wake-on: umbg
* R: j$ \0 i' F# k5 wWake-on: d1 C9 X" I& \9 g1 z- G& e) _
Link detected: yes2 x* L' u3 ^2 U9 u+ p
2)[root@linux /]# ethtool -i eth14 h0 n) G* A  e, ?5 T
driver: e1000! A1 z" ?. D5 V' P6 i
version: 5.0.43-k1: `5 `' x$ a% R3 G* B9 g* l1 q
firmware-version: N/A
6 i2 b7 I0 p8 C. c" k5 [) Nbus-info: 06:08.1
% x3 q5 y0 E4 [3)[root@linux /]# ethtool -S eth1
% j3 b% F* N4 K7 INIC statistics:$ o4 I7 B/ [" o* r
rx_packets: 580683000 K" V4 n+ M: H/ ^  ?( L6 t
tx_packets: 87124083
# E6 H4 r2 X- Nrx_bytes: 1589713008: M* Y& s/ Y1 R# Y
tx_bytes: 2165825901
  Q& _  D. k. e/ w  k: zrx_errors: 0
' X0 R9 o  c4 m% s/ ttx_errors: 02 g  f: f  U, z
rx_dropped: 0, {5 c( N2 h* T, l8 M% u$ D
tx_dropped: 0
7 m$ n. i% m% tmulticast: 0
' h( |3 i# W- F3 Ucollisions: 0! ^% S2 W; o" s) P
rx_length_errors: 0
% I( y& p5 B) q7 {rx_over_errors: 04 h" p  t2 z2 F$ o. N5 x. W
rx_crc_errors: 0: V4 R8 \/ t' g  b& s$ ~8 U- ^
rx_frame_errors: 0
( X, n" i3 P' Yrx_fifo_errors: 0
' W# G) f6 K4 z! m4 V! _rx_missed_errors: 0( R1 E* Z% w2 \" t; J
tx_aborted_errors: 0, W* m' S7 `. k( F( X
tx_carrier_errors: 0
% f- g7 k+ y9 Atx_fifo_errors: 0. w, ]. n& `) u4 Q
tx_heartbeat_errors: 0
6 r) ?" ~6 b$ Ytx_window_errors: 0
" T# p( d, m7 @0 t4)[root@linux /]# ethtool -s eth1 autoneg off speed 100 duplex full6 Z/ W+ D) ]# W9 h# a1 }1 s
相关:  C6 K& k. L6 ^$ y
1)[root@linux /]# which ethtool
, V8 y1 K: s: K; T/sbin/ethtool$ |8 ]4 m. f( w4 K5 d: s# {
2)[root@linux /]# rpm -qf /sbin/ethtool
6 F6 s1 N1 B' z- @. M- _ethtool-1.6-5
- y' Z" `# y( B3)怎样使ethtool设置永久保存在网络设备中?
- V& r* y/ F: P: }解决方法一:! G" u. U1 q9 Q+ e" g% X
ethtool设置可通过/etc/sysconfig/network-scripts/ifcfg-ethX文件保存,从而在设备下次启动时激活选项。
* I2 v1 j! H  e$ v& H! y+ j例如:ethtool -s eth0 speed 100 duplex full autoneg off6 d1 {7 e& ~* A1 @( U* F. }
此指令将eth0设备设置为全双工自适应,速度为100Mbs。若要eth0启动时设置这些参数, 修改文件/etc/sysconfig/network-scripts/ifcfg-eth0 ,添加如下一行:
% G/ m/ G9 X( rETHTOOL_OPTS=”speed 100 duplex full autoneg off”
$ z. M2 X3 K1 i7 D: j7 g. p2 w& S解决方法二:
2 z. B! R, M% ~* k# s将ethtool设置写入/etc/rc.d/rc.local之中。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-4 15:53 , Processed in 0.267021 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表