Operating System - HP-UX
1822070 Members
3510 Online
109640 Solutions
New Discussion юеВ

Re: check lan for network cable plug or no ?

 
SOLVED
Go to solution
Anh.Quan
Frequent Advisor

check lan for network cable plug or no ?

Dear Experts,

As you know, in Windows, when we plug in network cable, network symbol will change to other status.

Please help me. How can i know which lans have network cable ?

Many Thanks,
Vu
8 REPLIES 8
Geoff Wild
Honored Contributor
Solution

Re: check lan for network cable plug or no ?

Well, you can use the linkloop command to test connectivity.

Use lanscan to check for the mac address...

linkloop -i OUTGOINGPPA MACADDRESSOFREMOTEMACHINE

Example
linkloop -i 2 0x00306E385244
Link connectivity to LAN station: 0x00306E385244
-- OK



Here's another little script to check all your lan cards:

# cat /usr/local/bin/lancards
#!/usr/bin/sh
# script to check speed and settings of lan cards
PATH=/usr/sbin:/usr/bin
ppas=`lanscan | awk '$3~/^[0-9]$/{print $3}' | xargs`
for i in $ppas
do
printf "Card at PPA %s - " $i
ipa=`ifconfig lan${i} 2>/dev/null | awk '{ip=$2}END{if(ip==""){printf("Not assigned")}else{printf("%s ",ip)}}'`
printf "IP Address: %15s- " "$ipa"
lanadmin -x $i 2>/dev/null | awk '{$1="";printf("%s",$0)}'
echo ""
done

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Ajitkumar Rane
Trusted Contributor

Re: check lan for network cable plug or no ?

Apart from the linkloop command which checks for the physical layer you can also check the
ifconfig
the output will miss the UP status if the cable is not connected.

Also I had a work instruction for the lan error that is :
# ll /var/adm/nett*
-rw-r--r-- 1 root root 36205 Jul 5 16:18 /var/adm/nettl.LOG000

If the date/time stamp on nettl.LOG000 matches the date / time of the error reported in the request , this may indicate something had been logged by the system logging facilities. If this is an old date stamp then there will be no relevant information in the log file.

# netfmt -Nlf /var/adm/nettl.LOG000 >

Tail or vi the and look at the errors reported.

In this case a bad cable detected was reported suggesting there was a connectivity problem between the lan card, cable and switch which caused the problem.

# tail -30

going Offline @ [11/0/9/1/0/6/0] [Cable Disconnected]


**************************100 Mb/s LAN/9000 Networking**********************@#%
Timestamp : Wed Jul 05 METDST 2006 16:11:29.785074
Process ID : [ICS] Subsystem : BTLAN
User ID ( UID ) : -1 Log Class : ERROR
Device ID : 5 Path ID : 0
Connection ID : 0 Log Instance : 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<7002> 10/100BASE-T driver detected bad cable connection between
the adapter in slot(Crd In#) 5 and the hub or switch.

btlan[ 5] [HP A5506B PCI 10/100Base-TX 4 Port]
going Offline @ [11/0/9/1/0/4/0] [Cable Disconnected]

Best Regards,

Ajit
Amidsts difficulties lie opportunities
RAC_1
Honored Contributor

Re: check lan for network cable plug or no ?

You can also do lanadmin -g "nmid_of_lan_card" and check it.
There is no substitute to HARDWORK
Steven E. Protter
Exalted Contributor

Re: check lan for network cable plug or no ?

Shalom Vu,

The card has lights on the back too, which will light up and indicate a good connection. The color scheme's vary from card to card.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Asif Sharif
Honored Contributor

Re: check lan for network cable plug or no ?

Hi Qvu,

Use linkloop command of netfmt command to see the connectivity.
netfmt -Nlf /var/adm/nettl.LOG000

Regards,
Asif Sharif
Regards,
Asif Sharif
Jim Keeble
Trusted Contributor

Re: check lan for network cable plug or no ?

lanadmin -g

For example, "lanadmin -g 0" gathers the state of and statistics for lan0.

Administrative status = up indicates only that the card has been initialized by the driver and passed self test.

Opertational status = up is the flag you are looking for. It indicates that the link is up electrically, meaning the cable is plugged into an operational network port network port. Here's an example of a working port:

# netstat -in
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
lan0 1500 16.113.144.0 16.113.145.161 427280 0 125216 0 0
lo0 4136 127.0.0.0 127.0.0.1 100678 0 100678 0 0
# lanadmin -g 0

LAN INTERFACE STATUS DISPLAY
Thu, Jan 4,2007 06:18:15

PPA Number = 0
Description = lan0 HP PCI 1000Base-T Release B.11.23.05
Type (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 100000000
Station Address = 0x306ef493ee
Administration Status (value) = up(1)
Operation Status (value) = up(1)
Last Change = 110
Inbound Octets = 134165467
Inbound Unicast Packets = 78990
Inbound Non-Unicast Packets = 1404078
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 34556
Outbound Octets = 9934783
Outbound Unicast Packets = 93478
Outbound Non-Unicast Packets = 494
Outbound Discards = 0
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 655367

Ethernet-like Statistics Group

Index = 1
Alignment Errors = 0
FCS Errors = 0
Single Collision Frames = 0
Multiple Collision Frames = 0
Deferred Transmissions = 0
Late Collisions = 0
Excessive Collisions = 0
Internal MAC Transmit Errors = 0
Carrier Sense Errors = 0
Frames Too Long = 0
Internal MAC Receive Errors = 0

You may also be interested in whether the spped and duplex are what you expected. That command is:

# lanadmin -x 0
Speed = 100 Full-Duplex.
Autonegotiation = On.
rick jones
Honored Contributor

Re: check lan for network cable plug or no ?

Jim's answer is the one to go with (IMO). The operational state displayed via lanadmin is the definitive answer

Ifconfig will only show things if the interface has been plumbed.

Linkloop is good, but it depends on another linkloop-aware system within the broadcast domain. Any UX system will be such; there is a port of linkloop to "linux"

http://freshmeat.net/projects/linkloop/

of course there is the chance that the link is up on the system where linkloop is run, but something on the other side of a switch is down, so a lack of response on linkloop could be a false positive on cable disconnect on the system.
there is no rest for the wicked yet the virtuous have no pillows
Anh.Quan
Frequent Advisor

Re: check lan for network cable plug or no ?

Dear All,

Many thanks for your support ! I resolved my problems. Many Thanks!

Vu