Re: How to detect whether the network interface is up or not.



"Jimmy" <lofenee@xxxxxxxxxxxx> writes:

I have a single application server host, and I want to get a daemon run on
it to detect whether the network interface is up or not.

I have tried to build a TCP connection from and to the server itself via the
interface to be detected, hoping the KEEPALIVE may help. But even if I
unplugged the cable from the interface and 'ifconfig' showed it was DOWN,
the connection still appears 'alive'. Using 'ping', it indicated that
outside host is not available, however the 'DOWN' interface was to the
server itself.

I wonder if the 'ioctl' can help to detect such case by getting the status
of the interface.

Does anyone know how to detect such case?

You could use ifconfig or do what ifconfig does (no standard API), but
this is useless information.

As you've noted, a ping to oneself still works even if the interface
is down, because a ping to oneself doesn't need to go thru the
interface. And on the other hand, if an interface is up, this doesn't
mean that you can do anything with it anyways, since the cable could
be disconnected behind the HUB, or some router could be down, so you
cannot communicate to the host you want to communicate anyways.

The only meaningful tests are ping(1), which tells you that packets can
go between your host and the remote one you're interested in, and to
connect to the remote application which tells you that the remote
application is available or not.


--
__Pascal Bourguignon__ http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
.



Relevant Pages

  • Re: What doesnt lend itself to OO?
    ... The whole idea that a subsystem is just ... > The first line exists in the server. ... objects between client and server i.e. as far as the client code is ... > external interface is the traditional input interface whose ...
    (comp.object)
  • Re: Questions about a simple RMI example
    ... remote interface and this is why you need it on the client. ... client and server side code from the RMI API. ...
    (comp.lang.java.programmer)
  • Re: VPN Client and Local Service
    ... > We have a LAN and use VPN to connect to remote ... > Exchange server in back office (we are the client ... we need to build up the VPN ... interface, with the IP address different from that of the main ...
    (Security-Basics)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... If you think I'm giving a verbose pseud write access to my server, ... interface appears in C Sharp as consisting of sbyte arrays. ... failed to see that a for loop is not just a while loop because a while ... chilling effect on freedom of speech. ...
    (comp.programming)
  • Re: Cannot get NAT to route in RRAS
    ... The basic problem is that you are using an ADSL modem on the server. ... I would suggest that you set up a demand-dial interface to act as the ... Static Route wizard, create a default route using this interface (ie put ...
    (microsoft.public.win2000.ras_routing)