日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

linux网络配置、测试及故障诊断方法和工具三

發布時間:2025/4/5 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux网络配置、测试及故障诊断方法和工具三 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
DNS客戶端配置文件/etc/resolv.conf<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

/etc/resolv.conf 里面存放的是各大通信公司DNS服務器列表;下面的三個地址可以用一用;當然您可以打電話問你的服務商;

nameserver 202.96.134.133
nameserver 202.96.128.143
nameserver 202.96.68.38

?

改變網絡接口的速度和協商方式的工具miitool ethtool

通過mii-toolethtool工具來調整網卡的速度、雙工等,這樣能提高網卡的效率;

mii-tool 配置網絡設備協商方式的工具

mii-tool 介紹

mii-tool - view, manipulate media-independent interface status mii-tool 是查看,管理介質的網絡接口的狀態)

有時網卡需要配置協商方式 ,比如10/100/1000M的網卡半雙工、全雙工、自動協商的配置 。但大多數的網絡設備是不用我們來修改協商,因為大多數網絡設置接入的時候,都采用自動協商來解決相互通信的問題。但在有的情況下,需要我們手動來設置網卡的協商方式;

mii-tool 就是能指定網卡的協商方式。

注明:我在使用mii-tool工具修改協商模式時,提示是錯誤的,因為是在虛擬機中做的,不過虛擬機中的網卡我查看是支持全雙工模式的,可是提示錯誤SIOCGMIIPHY on 'eth0' failed: Operation not supported,問題出在那里也不清楚,用google查了下,發現不少人都是這樣的錯誤,也沒說明原因;不過多數人提示可以使用ethtool工具去修改,我測試了下,還行!還有一種方法是修改/etc/modules.conf配置文件;

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
重起!

mii-tool 更改網絡接口協商的方法;

[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

注:上面的例子,我們可以看得到是自動協商。注意紅字的部份;

更改網絡接口協商方式;

更改網絡接口的協商方式,我們要用到-F選項,后面可以接 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD等參數;

把網絡接口eth0改為 1000Mb/s全雙工的模式

[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

ethtool 工具關于網絡協商功能介紹

ethtool - Display or change ethernet card settingsethtool 是用來顯示和更改網卡設置的工具);這個工具比較復雜,功能也特別多;

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已經激活;

ethtool 設置網卡的協商模式;

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

把網卡eth0 速度改為10Mb/s,采用半雙工;

[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沒有激活;

把網卡eth0 速度改為100Mb/s,采用全雙工;

[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網卡沒有激活;

轉載于:https://blog.51cto.com/13233/82559

總結

以上是生活随笔為你收集整理的linux网络配置、测试及故障诊断方法和工具三的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。