回覆列表
  • 1 # 用戶1297067868426654

    iplink命令或者通過mii-tool指令[root@localhostroot]#mii-tooleth0:negotiated100baseTx-FD,linkoketh1:nolink或[root@localhostroot]#mii-tool-veth0:negotiated100baseTx-FD,linkokproductinfo:vendor00:50:43,model2rev3basicmode:autonegotiationenabledbasicstatus:autonegotiationcomplete,linkokcapabilities:100baseTx-FD100baseTx-HD10baseT-FD10baseT-HDadvertising:100baseTx-FD100baseTx-HD10baseT-FD10baseT-HDflow-controllinkpartner:100baseTx-FD100baseTx-HD10baseT-FD10baseT-HDeth1:nolinkproductinfo:vendor00:50:43,model2rev3basicmode:autonegotiationenabledbasicstatus:nolinkcapabilities:100baseTx-FD100baseTx-HD10baseT-FD10baseT-HDadvertising:100baseTx-FD100baseTx-HD10baseT-FD10baseT-HDflow-control或[root@localhostroot]#mii-tool-w21:20:33eth0:negotiated100baseTx-FD,linkok21:20:33eth1:nolink//mii-tool主要是用於配置網卡工作模式的指令,同時也可以進行查詢、監控等工作!2)[root@localhost/]#/etc/init.d/networkstatusConfigureddevices:loeth0eth1Currentlyactivedevices:loeth0等同於[root@localhostroot]#service--status-all........................Configureddevices:loeth0eth1Currentlyactivedevices:loeth0........................3)ifconfig-a[root@localhost/]#ifconfig-aeth0Linkencap:EthernetHWaddr00:09:6B:09:08:FCinetaddr:192.168.10.1Bcast:192.168.10.255Mask:255.255.255.0inet6addr:fe80::209:6bff:fe09:8fc/64Scope:LinkUPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1RXpackets:106732953errors:0dropped:0overruns:0frame:0TXpackets:104379788errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:100RXbytes:2351331877(2.1GiB)TXbytes:391707945(373.5MiB)Baseaddress:0x2500Memory:fbfe0000-fc000000eth1Linkencap:EthernetHWaddr00:09:6B:09:08:FDBROADCASTMULTICASTMTU:1500Metric:1RXpackets:0errors:0dropped:0overruns:0frame:0TXpackets:0errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:1000RXbytes:0(0.0b)TXbytes:0(0.0b)Baseaddress:0x2540Memory:fbfc0000-fbfe00004)ethtoolethtooleth0Settingsforeth0:Supportedports:[MII]Supportedlinkmodes:10baseT/Half10baseT/Full100baseT/Half100baseT/Full1000baseT/Half1000baseT/FullSupportsauto-negotiation:YesAdvertisedlinkmodes:10baseT/Half10baseT/Full100baseT/Half100baseT/Full1000baseT/Half1000baseT/FullAdvertisedauto-negotiation:YesSpeed:100Mb/sDuplex:FullPort:TwistedPairPHYAD:1Transceiver:internalAuto-negotiation:onSupportsWake-on:gWake-on:dCurrentmessagelevel:0x000000ff(255)Linkdetected:yesethtooleth1Settingsforeth1:Supportedports:[MII]Supportedlinkmodes:10baseT/Half10baseT/Full100baseT/Half100baseT/Full1000baseT/Half1000baseT/FullSupportsauto-negotiation:YesAdvertisedlinkmodes:10baseT/Half10baseT/Full100baseT/Half100baseT/Full1000baseT/Half1000baseT/FullAdvertisedauto-negotiation:YesSpeed:Unknown!(0)Duplex:HalfPort:TwistedPairPHYAD:1Transceiver:internalAuto-negotiation:onSupportsWake-on:gWake-on:dCurrentmessagelevel:0x000000ff(255)Linkdetected:no從上面可以看出eth0處於連接狀態,eth1沒有連接二.查看網卡的配置一般在linux下查看網絡配置可以使用ifconfig命令,可以顯示當前網卡的基本配置信息。終端輸入ifconfig會出現一下內容:eth0Linkencap:EthernetHWaddr00:0C:29:0C:4B:0Finetaddr:192.168.37.128Bcast:192.168.37.255Mask:255.255.255.0UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1RXpackets:33errors:0dropped:0overruns:0frame:0TXpackets:17errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:100RXbytes:2823(2.7Kb)TXbytes:2722(2.6Kb)Interrupt:10Baseaddress:0x1080他們分別表示:Eth0:網絡接口linkencap:網絡類型HWaddr:網卡物理地址Inetaddr:IP地址Bcast:廣播地址Mask:子網掩碼UP:正在使用的網絡接口RXpackets,TXpackets接收和傳輸的數據包個數RXbyte,TXbyte表示接搜和傳輸的具體數目Interrupt:終端信息Baseaddress:內存地址三.網卡配置文件如果希望每次啟動linux時,都能為你的網卡配置正確的網絡地址,可以採用下列兩種方法:1.每次開機後,使用ifconfig手動重新設置網卡的配置;2.在開機流程中,將網絡配置的設置保存在某些RCScript中。第一種方式麻煩,第二種方式涉及到在哪個RCScript中配置網卡是比較適當的?Linux啟動過程中會執行以下三個RCScript。1./etc/rc.d/init.d/rc.sysinit;2./etc/rc.d/init.d/rc;3./etc/rc.d/init.d/rc.local為了維護Linux的穩定性,建議不要修改前兩項。但是,用ifconfig配置第三個RCScript的話,導致嚴重的問題:由於最後執行這個程序,在其執行之前,可能已經執行了數十項網絡服務。因此,會造成一堆網絡服務因為網卡尚未啟動而無法順利的啟動。四、網卡配置文件解決上述問題的方法:每一個網絡介質都對應一個配置文件,超級用戶可以通過這些配置文件來配置網卡。網卡配置文件存放在/etc/sysconfig/network-scripts/目錄中;/etc/sysconfig/network-scripts/ifcfg-interface-name設置文件ifcfg-interface-name包含了初始化接口所需的大部分周詳信息。其中interface-name將根據網卡的類型和排序而不同,一般其名字為eth0、eth1、ppp0等,其中eth表示以太(eth0)類型網卡,0表示第一塊網卡,1表示第二塊網卡,而ppp0則表示第一個point-to-poirtprotocol網絡接口。在ifcfg文件中定義的各項目取決於接口類型。下面的值較問常見:》DEVICE=name,其中,name是物理設備名。》IPADDR=addr,其中,addr是IP地址。》NETMASK=mask,其中,mask是網絡掩碼值。》NETWORK=addr,其中addr是網絡地址。》BROADCAST=addr,其中,addr是廣播地址。》GATEWAY=addr,其中addr是網關地址。》ONBOOT=answer,其中,answer是yes(引導時激活設備)或no(引導時不激活設備)》USERCTL=answer,其中,answer是yes(非root用戶能控制該設備)或no》BOOTPROTO=proto,其中,proto取下列值之一:none,引導時不使用協議;static靜態分配地址;bootp,使用BOOTP協議,或dhcp,使用DHCP協議。(2)根據上述各參數的意義,設定linpcl.lintec.edu.cn機器的設置文件如下:[root@linpclroot]#cat/etc/sysconfig/networking/devices/ifcfg-rth0DEVICE=eth0ONBOOT=yesBOOTPROTO=staticIPADDR=192.168.0.2NETMASK=255.255.255.0GATEWAY=192.168.0.1

  • 中秋節和大豐收的關聯?
  • 雞蛋灌餅土豆絲做法擺攤商用?