Operating System - Linux
1828896 Members
2381 Online
109985 Solutions
New Discussion

Re: redhat network status unpluged

 
SOLVED
Go to solution
mohannad
Frequent Advisor

redhat network status unpluged

hi,

im trying to find a command or a way to detect network fauilers on redhat es 5.

mii and ethtool are no use ethtool link status is always yes and its not even supported for my driver also the mii tool , also thers no ifplugd for the kernel 2.6 only working version is for 2.4.

the ifconfig always giv status up.

any ideas?

i noted that when ever the network is un pluged the avahi deamon starts to dump errors into the messages

but i need a more relaiable way for detecting the unpluged network


regards,
5 REPLIES 5
Steven E. Protter
Exalted Contributor
Solution

Re: redhat network status unpluged

Shalom,

Pick an IP address on the network at a location that means there is a network if it can be pinged.

ping -c 1 -W 30
rc=$?

if [ $rc -ne 0 ]
then
echo "No network!!!"
else
echo "Network up"
fi

The ping statement is 1 ping timeout 30 seconds.

The code has echo statements where you can place code and do notification of network failure.

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
mohannad
Frequent Advisor

Re: redhat network status unpluged

hi,

yeah i know this way but im looking for a way for linux to recognize an unpluged network card.

regards,
mohannad
Hemmetter
Esteemed Contributor

Re: redhat network status unpluged

Hi,

you can use "ethtool"

it gives (among other information):

Link detected: yes

rgds
HGH

Steven E. Protter
Exalted Contributor

Re: redhat network status unpluged

Shalom Mohannad,

My script provides the basis for the system knowing the network is disconnected.

Replacing the echo statement with what you want the system to do accomplishes the goal.

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
StarAdmin
New Member

Re: redhat network status unpluged

If youâ re specifically looking for an unplugged cable between the server & switch I think the switch is best place to monitor this. Have your switch send SNMP traps to your monitoring system when it detects the link is down.

We also have the HP NIC agents running so that when a network cable is unplugged an SNMP trap is sent to our monitoring system. This picks up if the link is down but as the traps are generated from the server you need network connectivity in order for the traps to reach their destination.

If you need more in-depth checking like errors or collisions (duplex mismatch, dodgy cable etc..) or that the routes are up youâ ll need something a bit more than the basic up/down type events above, really depends on what exactly youâ re after.