1. 检查 /var/adm/messages 文件是否有错误

大多数情况下,链接断开消息记录在 /var/adm/messages 文件中。
我们只需要在文件中搜索正确的错误。

Sep 18 11:51:08 server1 qfe: [ID 349649 kern.notice] NOTICE: SUNW,qfe0: No response from Ethernet network : Link Down - cable problem 
Oct 1 08:37:06 server2 unix: SUNW,hme0: 100 Mbps full-duplex Link Up

8. 使用 SNMP 检查链接状态

snmpwalk 命令很少用于查找链接状态。
但它也可以用于查询远程主机的链接状态,这在某些情况下非常有用。
此处查询以获取链接状态的 snmp 类是 interfaces.ifTable 。

# snmpwalk -v1 -c public localhost interfaces.ifTable | egrep "Descr|OperStatus"
IF-MIB::ifDescr.1 = STRING: lo0 
IF-MIB::ifDescr.2 = STRING: ce0 
IF-MIB::ifDescr.3 = STRING: ce1 
IF-MIB::ifDescr.4 = STRING: ce2 
IF-MIB::ifDescr.5 = STRING: ce3 
IF-MIB::ifOperStatus.1 = INTEGER: up(1)
IF-MIB::ifOperStatus.2 = INTEGER: up(1) 
IF-MIB::ifOperStatus.3 = INTEGER: up(1) 
IF-MIB::ifOperStatus.4 = INTEGER: down(2) 
IF-MIB::ifOperStatus.5 = INTEGER: up(1)

说明:

  1. up(1),down(2)

  2. 'public' 是此处默认的 SNMP v1/v2c 读取社区字符串,在系统上可以不同。

  3. 我们可以针对远程主机名而不是 localhost 运行相同的命令。

4. 使用 dladm 检查链接状态(Solaris 10 和 11)

从solaris 10 开始,可以使用dladm 命令为所有网络接口提供更格式化的输出以及链接状态和链接速度。

# dladm show-dev
e1000g0      link: up            speed: 1000  Mbps       duplex: full
e1000g1      link: unknown   speed: 0       Mbps       duplex: half

对于solaris 11,命令略有变化:

# dladm show-link
LINK                CLASS     MTU    STATE    OVER
net0                phys      1500   up       -
net1                phys      1500   up       -

或者,我们也可以使用以下命令,它提供了更详细的信息。

# dladm show-phys
LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
net0              Ethernet             up         1000   full      e1000g0
net1              Ethernet             up         1000   full      e1000g1

3. 使用 kstat 检查链接状态(Solaris 8 和 9)

kstat 是另一个用于检查链接状态的有用命令。
要检查设备驱动程序类型 ce 的所有接口的链接状态:

# kstat -p qfe:::link_up
qfe:0:qfe0:link_up        1
qfe:1:qfe1:link_up        1

...或者只是一个实例:

# kstat -p e1000g:0::link_up
e1000g:0:mac:link_up    1

注意:link_up (1=up,0=down)

7. 检查 ifconfig 输出中的 RUNNING 标志

另一种快速检查接口链接状态的简单方法是检查“ifconfig -a”命令输出。
当链路断开时,RUNNING 标志被清除。

# ifconfig -a
......
e1000g0: flags=1000843[UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.1.25 netmask ffffff00 broadcast 192.168.1.255
        ether 0:c:29:92:7b:cd
......
如何确定 Solaris 中网络接口的链接状态

在solaris 中有几种不同的方法可以检查链接状态(向上/向下)。
下面介绍几种方法,并举例说明在Solaris 中检查以太网接口的网络链接状态。
dladm 之类的一些方法在 solaris 8 和 9 中不可用。
在这种情况下,我们可以使用 kstat 和 ndd 命令。

on it road .com

6.在ok提示下检查链接速度

在solaris SPARC 系统上,我们可以观察各个接口以查看它们是否有链接。
在客户端的 OBP 提示符下,使用“watch-net-all”命令测试并查看网络设备。

ok> watch-net-all
/pci@7c0/pci@0/network@4,1
1000 Mbps full duplex  Link up
Looking for Ethernet Packets.
'.' is a Good Packet.  'X' is a Bad Packet.
Type any key to stop.
.................................................
/pci@7c0/pci@0/network@4
Timed out waiting for Autonegotiation to complete
Check cable and try again
Link Down
/pci@7c0/pci@0/pci@8/network@1,1
Timed out waiting for Autonegotiation to complete
Check cable and try again
Link Down
/pci@7c0/pci@0/pci@8/network@1
Timed out waiting for Autonegotiation to complete
Check cable and try again
Link Down

2. 使用 ndd 检查链接状态(Solaris 8 和 9)

在solaris 8 和9 中,dladm 命令将不起作用。
在这种情况下,可以使用 ndd 命令检查链接状态。
首先我们需要设置我们要检查的特定接口的实例。

# ndd -set /dev/ce instance 0         ### instance set to "0" checks ce0 status
# ndd   /dev/ce link_status
1

注意:link_status 1=up,0=down)

8. mpathd 通知

如果我们使用 IPMP,mpathd 守护程序将检测 NIC 故障和修复并将它们记录在 /var/adm/messages 文件中。

"NIC failure detected on qfe0"                     - in.mpathd has detected that NIC qfe0 is repaired and operational
"Successfully failed back to NIC qfe0 to NIC qfe1" - in.mpathd has restored network traffic back to NIC qfe0, which is now repaired and operational.
日期:2020-09-17 00:15:09 来源:oir作者:oir