菜鸟笔记
提升您的技术认知

查看linux下网卡状态或 是否连接-ag真人游戏

 1)  通过mii-tool指令
       [root@localhost root]# mii-tool
        eth0: negotiated 100basetx-fd, link ok
        eth1: no link
       或
       [root@localhost root]# mii-tool -v
        eth0: negotiated 100basetx-fd, link ok
          product info: vendor 00:50:43, model 2 rev 3
          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 flow-control
          link partner: 100basetx-fd 100basetx-hd 10baset-fd 10baset-hd
        eth1: no link
          product info: vendor 00:50:43, model 2 rev 3
          basic mode:   autonegotiation enabled
          basic status: no link
          capabilities: 100basetx-fd 100basetx-hd 10baset-fd 10baset-hd
          advertising:  100basetx-fd 100basetx-hd 10baset-fd 10baset-hd flow-control
       或
      [root@localhost root]# mii-tool -w
       21:20:33 eth0: negotiated 100basetx-fd, link ok
       21:20:33 eth1: no link

      //mii-tool主要是用于配置网卡工作模式的指令,同时也可以进行查询、监控等工作!

  
   2)
     [root@localhost /]# /etc/init.d/network status
      configured devices:
      lo eth0 eth1
      currently active devices:
      lo eth0
     等同于
     [root@localhost root]# service --status-all
      ............
      ............
      configured devices:
      lo eth0 eth1
      currently active devices:
      lo eth0
      ............
      ............
   3)ifconfig -a
    [root@localhost /]# ifconfig -a
    eth0  link encap:ethernet  hwaddr 00:09:6b:09:08:fc 
          inet addr:192.168.10.1  bcast:192.168.10.255  mask:255.255.255.0
          inet6 addr: fe80::209:6bff:fe09:8fc/64 scope:link
          up broadcast running multicast  mtu:1500  metric:1
          rx packets:106732953 errors:0 dropped:0 overruns:0 frame:0
          tx packets:104379788 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          rx bytes:2351331877 (2.1 gib)  tx bytes:391707945 (373.5 mib)
          base address:0x2500 memory:fbfe0000-fc000000
   eth1   link encap:ethernet  hwaddr 00:09:6b:09:08:fd 
          broadcast multicast  mtu:1500  metric:1
          rx packets:0 errors:0 dropped:0 overruns:0 frame:0
          tx packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          rx bytes:0 (0.0 b)  tx bytes:0 (0.0 b)
          base address:0x2540 memory:fbfc0000-fbfe0000 

 4)ethtool

ethtool eth0
settings for eth0:
        supported ports: [ mii ]
        supported link modes:   10baset/half 10baset/full
                                100baset/half 100baset/full
                                1000baset/half 1000baset/full
        supports auto-negotiation: yes
        advertised link modes:  10baset/half 10baset/full
                                100baset/half 100baset/full
                                1000baset/half 1000baset/full
        advertised auto-negotiation: yes
        speed: 100mb/s
        duplex: full
        port: twisted pair
        phyad: 1
        transceiver: internal
        auto-negotiation: on
        supports wake-on: g
        wake-on: d
        current message level: 0x000000ff (255)
        link detected: yes

ethtool eth1

settings for eth1:
        supported ports: [ mii ]
        supported link modes:   10baset/half 10baset/full
                                100baset/half 100baset/full
                                1000baset/half 1000baset/full
        supports auto-negotiation: yes
        advertised link modes:  10baset/half 10baset/full
                                100baset/half 100baset/full
                                1000baset/half 1000baset/full
        advertised auto-negotiation: yes
        speed: unknown! (0)
        duplex: half
        port: twisted pair
        phyad: 1
        transceiver: internal
        auto-negotiation: on
        supports wake-on: g
        wake-on: d
        current message level: 0x000000ff (255)
        link detected: no
从上面可以看出eth0 处于连接状态,eth1没有连接

网站地图