Networking Forums

Networking Forums > Computer Networking > Linux Networking > How to check network status on the Linux machine

Reply
Thread Tools Display Modes

How to check network status on the Linux machine

 
 
Andrew
Guest
Posts: n/a

 
      12-04-2004, 05:13 AM
Hi:

Recently, I wrote a program on a Linux machine which is able to
detect whether the machine is connected to the network. I used the
Linux netstat program with the –i option to do the trick. netstat has
a running flag (shown as a R when exercute netstat –i command), which
will be turned on if the network cable is plugged into the machine and
vice versa. However, it turns out that on some motherboards (I am
using on broad network cards) the netstat will fail to detect the
connection status. That is, no matter the network cable is plugged in
or not, the running flag (R) is always on.

The Linux system that works:
ASUS P4PEX motherboard and unpatched Redhat 9.0 OS

The Linux system that doesn't work:
Gigabyte GA8IPE-1000G motherboard and updatched Redhat 9.0 OS

The bad news for me is that I have to make the program work on the
second Linux system (with Gigabyte motherboard) :'( Does
anyone have any clue where the problem lies? I have been stuck on this
problem for some time now. Can anybody please help? Thank you for your
time
 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      12-04-2004, 05:49 AM
On 2004-12-04, Andrew <(E-Mail Removed)> wrote:
> vice versa. However, it turns out that on some motherboards (I am
> using on broad network cards) the netstat will fail to detect the


And mii-tool what does return on such machine?
Davide

--
Q: Why is Microsoft's Product Support a failure?
A: Because Microsoft needs a Support Group instead.
 
Reply With Quote
 
Bit Twister
Guest
Posts: n/a

 
      12-04-2004, 05:57 AM
On 3 Dec 2004 22:13:43 -0800, Andrew wrote:
> Hi:
>
> Recently, I wrote a program on a Linux machine which is able to
> detect whether the machine is connected to the network. I used the
> Linux netstat program


ping -c 1 -w 2 gateway_ip_addy_here > /dev/null
if [ $? -ne 0 ] ; then
echo network is not up
fi
 
Reply With Quote
 
Damjan
Guest
Posts: n/a

 
      12-06-2004, 05:54 PM
> Recently, I wrote a program on a Linux machine which is able to
> detect whether the machine is connected to the network. I used the
> Linux netstat program with the –i option to do the trick.


mii-tool and ethtool will tell you if the ethernet cable is pluged, but only
if your network card (and driver) support it.

You can also use programs like netplugd to do things on plug/unplug events.

--
damjan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remotely login into a pure IPv6 Linux machine from a DualStack windows machine chaitan Linux Networking 1 11-21-2007 05:37 PM
How to set my Linux machine to have two network cards with two IPs keanewoon@gmail.com Linux Networking 4 05-28-2007 02:31 PM
Simple client/server socket program works on one Linux machine, it doesnot work on other machine GS Linux Networking 2 05-09-2006 12:55 PM
Proper routes for linux machine with two network ports to same network fuzzybr80@gmail.com Linux Networking 2 04-07-2006 08:14 PM
How do I check the status of a new line connection Clive Savage Broadband 4 04-22-2005 05:25 PM



1 2 3 4 5 6 7 8 9 10 11