Friday, March 22, 2013

How to install DHCP server on Solaris

[caption id="attachment_389" align="aligncenter" width="464"]logo-solaris How to install DHCP server on Solaris[/caption]

How to install DHCP server on Solaris



Preamble


This document is intended to show how to create DHCP server on Solaris using only command line tools. Of course exist GUI tool, named dhcpmgr, located in /usr/sadm/admin/bin directory, but first usually system administrators prefer and do they work via command line and second graphical environment can be inappropriate in some situations because of security, bandwidth or other reasons.

Installation


1. For our installation we will assume our domain is example.com and default gateway is 10.0.1.1

2. First step is to configure server itself, defining directory where the files will be located, type of repository (can be text files, binary files or NIS+ repository), lease time and default gateway. IN this example will be used domain example.com, text files as repository and leased time 2 days
# dhcpconfig -D -p /var/dhcp -r SUNWfiles -d example.com -l 172000 -a 10.0.1.1 Created DHCP configuration file. Created dhcptab. Added "Locale" macro to dhcptab. Added server macro to dhcptab - sol3. DHCP server started.

3. Next we should create network from where the IP addresses will be leased.
# pntadm -C 10.0.1.0

4. Just in case let check the list of configured networks
# pntadm -L 10.0.1.0

5. Lets put in repository addresses from 10.0.1.64 to 10.0.1.79 to be managed by DHCP server
# for i in `echo "echo 10.0.1.{64..79}"|bash`; do pntadm -r SUNWfiles -p /var/dhcp -A $i 10.0.1.0; done

6. And check what the situation with addresses is.
# pntadm -P 10.0.1.0 Client ID Flags Client IP Server IP Lease Expiration Macro Comment 01000C2913E7E8 00 10.0.1.79 10.0.1.12 08/31/2008 UNKNOWN 00 00 10.0.1.78 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.77 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.76 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.75 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.74 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.73 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.72 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.71 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.70 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.69 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.68 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.67 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.66 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.65 10.0.1.12 Zero UNKNOWN 00 00 10.0.1.64 10.0.1.12 Zero UNKNOWN

7. For our surprise someone already lease 10.0.1.79, so our server work

No comments:

Post a Comment