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
DHCPClient(3) User Contributed Perl Documentation DHCPClient(3)

  Net::DHCPClient - A DHCP Client API

  use Net::DHCPClient;

  my $dhcp = new Net::DHCPClient( maccaddr => '0a:0a:0a:0a:0a:0a', 
                                  interface => 'eth0' );

  $dhcp->discover( 61 => '0a 0a 0a 0a 0a 0a' );

This module provides methods for implementing a DHCP client. It allows perl scripts to interacts with DHCP servers.

This module is used by constructing a new DHCPClient object via the constructor method, providing it (minimally) with the machine address and the network interface that is to be used for the DHCP transaction with the DHCP server.

Information after each DHCP call is stored in the instance variables of the object. Refer to RFC2131 for the designations of the named fields. Options (sometimes called vendor extensions) are stored in an instance variable in the object called options as a references to a hash. The options themselves are keys by the decimal designation of the option, and the values of the hash are string representations of the hex values that should be passed to the DHCP server with the options. Please refer to RFC2132 for a complete listing.

Some common option fields are available through methods in this object for convenience. They are listed in this document.

This document is not a replacement for RFC2131 or RFC2132, and you will probably need a copy of them handy if you are coding DHCP clients.

The constructor is the only class method that should be invoked. It takes as its parameters minimally the machine address and the interface for which the DHCP transaction should take place.

Object methods must be invoked against objects created via the new method.

There are two kinds of object methods -- those that invoke DHCP transactions and those that interpret the results of a DHCP transaction. I am grouping them separately for this reason.

DHCPClient transaction object methods

All of the DHCPClient transaction methods take named parameters as their arguments, where paramters are named for the decimal representation of the options that can be set in the DHCP packet, and set to a string representation of the hex values that should be set for the named parameter in the DHCP packet. Whew. Fear not, examples are below.

decline
The decline method declines an offer from a DHCP server.
discover
The discover method broadcasts a DHCPDISCOVER on the local subnet.
inform
The inform method requests information from a DHCP server.
release
The release method releases the lease of the IP address.
request
The request method requests a DHCP lease.

DHCPClient result object methods

These methods are built as conveniences to get the data that is contained in the result of a DHCP transaction returned in a usable form. All of the data can be had by going through the object instance variables by hand, but I would not recommend it. These methods will not return anything useful until a DHCP transaction has taken place.

Note -- unless otherwise noted, an IP address returned by an object method listed in this documentation should be considered to be a string containing the address is dotted notation.

broadcast
Returns the broadcast address.
client_ip
Returns the IP address of the client that made the request to the DHCP server.
domain_name
Returns the domain name that the server has provided.
domain_name_server
Returns a list of IP addresses of the domain name servers.
netbiod_nameserver
Returns a list of the IP addresses of the netbiod domain name servers (i.e. NT Domain servers)
ntp_server
Returns a list of IP address of the Network Time Protocol server.
relay_ip
Returns the IP address of the agent that relayed your DHCP request to the DHCP server (probably a router).
reply
Returns a string indicating what the server reply was.
server_identifier
Returns a server identifier -- it is usually an IP address of the server, but does not necessarily need to be. This method assumes an IP address.
server_ip
Returns the IP address of the DHCP server that handled your request.
subnet_mask
Returns the subnet mask.
time_server
Returns a list of the IP addresses of the time servers.
your_ip
Returns the IP address that the DHCP server has offered to your client.

     Revision 1.0  2001/04/19
     Initial release

  Joshua Walgenbach
  Indiana Unversity
  jwalgenb@indiana.edu

  Copyright 2000, Joshua Walgenbach
  All rights reserved

This program is free software; you can redistribute it and/or modify it under the terms of either:

a) the "Artistic License" which comes with this Kit, or

b) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.

2001-04-19 perl v5.32.1

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

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