GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::DHCP::WATCH (3)

.ds Aq ’

NAME

Net::DHCP::Watch - A class for monitoring a remote DHCPD server.

CONTENTS

SYNOPSIS



  use Net::DHCP::Watch;
  # server name
  my $Server = dhcpd.mydomain.com;
  # this machine ip and ethernet address
  my $IP     = 192.168.1.1;
  my $Ether  = 01:23:45:67:89:ab;
  # Net::DHCP::Watch object
  my $dhcpw = new Net::DHCP::Watch({
                server => $Server,
                client => $IP,
                ether  => $Ether
        });

  # Open network
  $dhcpw->watch();
  # Get status
  my $stat = $dhcpw->status;
  # print results
  if ( $stat->{Bad} ) print $stat->{Time},
    ": Remote DHCP on $Server unavailable (",$stat->{Bad},").\n";

  if ( $stat->{Ok}  ) print $stat->{Time},
    ": Remote DHCP on $Server online.\n";



DESCRIPTION

Net::DHCP::Watch is a module to help monitor remote DHCP servers. It opens an udp socket to send and receive responses to and from a DHCP server. It stores the last connection status information.

This module serves to implement This module can help to write some simple code to implement a reliable DHCP service over complex or simple networks.

METHODS

<B>newB> Creates a new Net::DHCP::Watch object. The parameters are passed through a hash with the following keys:
Server DHCP server name or IP address to be monitored (not the local machine performing the monitoring).
Client Name or IP addres to use for the local machine performing the monitoring. Since there is no obvious way to determine that, it is mandatory.
Ether Ethernet address of the local machine performing the monitoring. Since there is no obvious way to determine that, it is mandatory. You can pass a 6 element array of bytes or a ’:’ separated string of hex values. In UNIX machines you can tipically do something like this:



        my $ether = qx[ /sbin/ifconfig eth0 | tail +1 |\
                        head -1 | awk {print \$5}];
        chomp($ether);



Timeout The timeout for network operation (default 10s).
<B>watchB> Prepares for monitoring. Opens an UDP socket to the server. This method could fail or interfere with the operation of a local DHCPd server.
<B>unwatchB> Closes monitoring. You should use this method before starting any local DHCP server.
<B>statusB> Try to comunicate with the server and returns the status in a hash. The hash contains three keywords. Ok will be true if the attempt completed successfully, Bad will be true if the attempt was not; they will contain the number of successful (or unsuccessful) contiguous attempts made. Time contains the GMT time string of the last attempt.

EXAMPLES

See the directory examples in source distribution for an example.

BUGS

There should be a Net::DHCP class to handle the DHCP protocol.

LIMITATIONS

On platforms without alarm() function defined the monitoring can hang forever if some network problems show up (cable problem, etc)?

The machine that is running the test MUST BE a KNOWN client of the remote DHCP server.

AUTHOR

Evilio del Rio, edelrio@icm.csic.es

ACKNOWLEDGEMENTS

I would like to acknowledge the valuable contributions of the people who made suggestions to improve this code, specially to Nick Garfield who provided the solution for monitoring disjoint networks.

SEE ALSO

perl(1), IO::Socket(3), Net::hostent(3). RFCs 2131 and 2132.

Ralph Droms & Ted Lemon, <B>The DHCP HandbookB>, MacMillan (Indianapolis), 1999.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 WATCH (3) 2003-10-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.