Configuring a DHCP Server


DHCP server configuration consists of two steps : configuring the server and then starting it. There are two ways of configuring the server: a command-line method that uses the dhcpconfig command and the use of a graphical utility, dhcpmgr . The dhcpconfig command method is the fastest way to configure a server, but it requires more detailed knowledge of the process and is more advanced, whereas the dhcpmgr utility is easier to use, validates the input values as they are entered, and uses default values automaticallyunlike dhcpconfig , where the values must be specified.

dhcpmgr

The dhcpmgr command runs in an X Windows environment, such as CDE, and is located in the /usr/sadm/admin/bin directory.

The following steps describe the server configuration process when you use the dhcpmgr graphical utility:

  1. Start the dhcpmgr utility by running the following command in the background from the command line in any window:

     ultra10# /usr/sadm/admin/bin/dhcpmgr & 

    The following window appears, enabling you to configure either a DHCP server or a BOOTP relay server. A BOOTP relay server is one that acts on behalf of a DHCP server and forwards requests from a DHCP client onto a DHCP server. These steps concentrate on configuring a DHCP server, so click the Configure as DHCP Server button and then the OK button to do this, as shown in Figure 11.1.

    Figure 11.1. Initial DHCP Server Configuration window.

    graphics/11fig01.jpg

  2. The next window determines the format of the datastore. There are three formats available in Solaris 9:

    • Text Files The datastore is stored as ASCII files, which are readable with standard Unix utilities. This is the default option.

    • Binary Files The datastore is stored as binary files, requiring you to use either the dhcpmgr utility or the dhtadm or pntadm commands to view the data. This option provides better performance, particularly for large networks.

    • NIS+ The datastore is stored as an NIS+ table and requires that the NIS+ naming service be available and the DHCP server must be configured as an NIS+ client.

    Select the Text Files option and click the > button to continue, as shown in Figure 11.2.

    Figure 11.2. Datastore format window.

    graphics/11fig02.jpg

  3. Now that you have determined the format of the datastore, the next window prompts for the directory in which the contents of the data-store are to be located. The default value is /var/dhcp . Accept this by clicking the > button to continue, as shown in Figure 11.3.

    Figure 11.3. Datastore location window.

    graphics/11fig03.jpg

  4. The next window determines where the client DHCP host records will be stored. If you were solely using DNS for host resolution, then you would select this option and enter the name of the DNS domain that manages these hosts . For this example, the local /etc/hosts file is being selected to manage the local DHCP clients , with DNS being available for remote name resolution, as shown in Figure 11.4. Click the > button to continue.

    Figure 11.4. Host record storage window.

    graphics/11fig04.jpg

  5. The lease policy in the next window determines how long a leased IP address will be valid. The default of one day is normally sufficient and is being used here. Another important option on this screen is whether clients can renew their leases. The default is to leave this enabled so that a client can renew a lease when it expires and retain the same IP address. Figure 11.5 shows this window with the desired values. Click the > button to continue.

    Figure 11.5. Lease policy window.

    graphics/11fig05.jpg

  6. The specification of any DNS domain and relevant DNS servers is configured next. If you are not using DNS, then there is no need to enter anything here. If you are using DNS, then the utility attempts to insert the domain name and server IP addresses of any servers that are known. Figure 11.6 shows the DNS domain xyz.com with a DNS server IP address of 192.168.28.28 . Click the > button to continue.

    Figure 11.6. DNS configuration window.

    graphics/11fig06.jpg

  7. The next window specifies the network on which IP addresses are to be allocated. Known networks are displayed in a pull-down menu along with the relevant network mask. For this example, the network 192.168.29.0 is going to be the network for which IP addresses will be allocated. Figure 11.7 demonstrates this. Click the > button to proceed.

    Figure 11.7. Network address window.

    graphics/11fig07.jpg

  8. The next window specifies the type of network you are using, either a LAN or a point-to-point network. Also, you configure the routing, either by using the Router Discovery Protocol (RDISC) or, if you have a dedicated default router, you can enter the router's IP address. Figure 11.8 shows that the router discovery protocol is being used to dynamically determine the routers on the network. Click the > button to proceed.

    Figure 11.8. Network type and routing window.

    graphics/11fig08.jpg

  9. If you are using the NIS naming service, then the next window is the place to enter the NIS domain name and the IP addresses of your NIS servers. If you are not using NIS, then you should leave the fields blank, as shown in Figure 11.9, and proceed to the next screen.

    Figure 11.9. NIS configuration window.

    graphics/11fig09.jpg

  10. If you are using the NIS+ naming service, then the next window is the place to enter the NIS+ domain name and the IP addresses of your NIS+ servers. If you are not using NIS+, then you should leave the fields blank and proceed to the next screen. Figure 11.10 shows that NIS+ is not being used.

    Figure 11.10. NIS+ configuration window.

    graphics/11fig10.jpg

  11. The final DHCP server configuration window shows a summary of the information entered so far. Confirm that the configuration is acceptable and click the Finish button as shown in Figure 11.11.

    Figure 11.11. DHCP server configuration summary window.

    graphics/11fig11.jpg

  12. A popup window appears because even though the DHCP server configuration is complete, there is no list of IP addresses to use. To begin allocating IP addresses to clients, the DHCP tables must be configured. Click Yes in the window to begin populating the tables. Figure 11.12 shows this window.

    Figure 11.12. DHCP address configuration window.

    graphics/11fig12.jpg

  13. When you select the Yes option in the preceding step, the address configuration wizard starts, which guides you through the remainder of the setup. Figure 11.13 displays a window where the range of addresses is defined, as well as comments for the administrator. For this example, a block of 50 IP addresses is going to be reserved for use by DHCP and a comment will remind the administrator that these addresses are to be used by hosts on the Alpha site located on the 3 rd floor. Click the > button to continue.

    Figure 11.13. DHCP address scope window.

    graphics/11fig13.jpg

  14. Having defined the block of IP addresses as 50, you are now prompted to specify the starting IP address. The block of 50 IP addresses is allocated sequentially, starting at the address entered here. For this example, 192.168.29.31 is to be the first address. The server name is inserted into this window as the name of the server that will manage the IP addresses. The last part of this window identifies a root for the hostnames that will be assigned to clients that use these IP addresses. In this example, the root name alpha3 is used to represent the 3 rd floor of the Alpha site. The first hostname in this block of IP addresses will therefore be alpha3-31 . Figure 11.14 demonstrates these values. Click the > button to continue.

    Figure 11.14. DHCP starting address window.

    graphics/11fig14.jpg

  15. A scrolling list of the allocatable IP addresses and associated hostnames is displayed. You have to confirm that these details are to be added to the DHCP database. Click the > button to proceed and accept the values, as shown in Figure 11.15.

    Figure 11.15. DHCP allocatable address confirmation window.

    graphics/11fig15.jpg

  16. When you have confirmed that the IP addresses are correct, you are prompted for information on how to configure the clients. A pull-down menu lists a number of macros that can be selected. The default option is to select the one with the hostname of the DHCP server. This macro would normally contain all of the information a DHCP client requires and was created as part of the server configuration process. Figure 11.16 shows this window.

    Figure 11.16. DHCP client macro selection window.

    graphics/11fig16.jpg

  17. To view the contents of any of the macros, click the View button and another window appears detailing the contents of the values that will be applied to the clients that use this DHCP server. Figure 11.17 displays the macro relating to the DHCP server that has just been configured ultra10 .

    Figure 11.17. DHCP client macro window.

    graphics/11fig17.jpg

  18. The last thing to do is to specify the type of lease that is going to be provided for each of the IP addresses in the block that has been added to the DHCP database. There are two choices: dynamic , where the IP addresses are allocated on a first-come first- served basis, and permanent , where a client reserves the same IP address each time it connects to the network. For this example, dynamic leasing is being used, as demonstrated in Figure 11.18. Click the > button to proceed to the final confirmation window.

    Figure 11.18. DHCP lease type window.

    graphics/11fig18.jpg

  19. There is a final confirmation window that appears, showing a summary of the information entered so far. Click the Finish button to accept these values and exit from the address configuration wizard. Figure 11.19 shows the confirmation window for the values entered in the example.

    Figure 11.19. DHCP address confirmation window.

    graphics/11fig19.jpg

  20. The main DHCP manager window appears again, which now includes the addresses that have been added to the database. Figure 11.20 shows the window as it appears following the example configuration. From the File menu, select Exit to close dhcpmgr . The DHCP server is now configured and ready to use.

    Figure 11.20. DHCP Manager window.

    graphics/11fig20.jpg

graphics/alert_icon.gif

DHCP lease types cannot be mixed within the same block of allocated IP addresses. If you needed both permanent leases and dynamic leases, you would have to create a separate block of addresses for each.


A configuration file is created when you run the server configuration utility. This file is located in /etc/inet/dhcpsvc.conf and should not be edited by hand. The configuration file created during this session is shown here:

 ultra10# cat /etc/inet/dhcpsvc.conf DAEMON_ENABLED=TRUE RUN_MODE=server RESOURCE=SUNWfiles PATH=/var/dhcp CONVER=1 HOSTS_RESOURCE=files 
graphics/alert_icon.gif

The DHCP server configuration file, /etc/inet/dhcpsvc.conf , was stored in /etc/default/dhcp in previous Solaris releases. In an exam question, it could be an option that distracts you from the correct answer.


dhcpconfig

The dhcpconfig utility is intended for use by more advanced system administrators and lends itself well to configuration using scripts. It is a command-line tool for configuring the DHCP server and is a much quicker way of creating the server than using the graphical utility, dhcpmgr . Specifically , dhcpconfig provides options to

  • Configure a new DHCP server.

  • Convert an existing datastore to a different format, making the new format ready for use.

  • Import data from other DHCP servers and export data to other DHCP servers.

  • Unconfigure an existing DHCP server, with additional options to remove host entries and the DHCP database files.

graphics/note_icon.gif

In previous releases of Solaris, dhcpconfig was a menu-driven utility. This has changed with Solaris 9, where it is now a command-line utility. Also, an additional datastore format, binary files ( SUNWbinfiles) , was released with Solaris 9previous releases had only two formats, text files ( SUNWfiles) and NIS+ table ( SUNWnisplus) .


To configure the DHCP server, you must first define the datastore type and the directory to be used for storing the database tables. Additionally, you can specify a DNS domain name and a DNS server. The following example shows the command which configures a DHCP server to use a text file datastore (SUNWfiles), with /var/dhcp being the repository directory ( -p option). It also identifies the DNS domain ( -d option) and a DNS server ( -a option) and that the local /etc/inet/hosts file ( -h option) is to store hostname and IP address details:

 ultra10# dhcpconfig -D -r SUNWfiles -p /var/dhcp -d xyz.com -a 192.168.28.28 -h files Created DHCP configuration file. Created dhcptab. Added "Locale" macro to dhcptab. Added server macro to dhcptab - ultra10. DHCP server started. 

Note that the messages received on the screen as the configuration proceeds let you know what is happening. The configuration file /etc/inet/dhcpsvc.conf is created along with the dhcptab table. Two macros have been defined in the table and the server process, in.dhcpd , is now running.

This server doesn't actually do anything at this point because it is not managing any specific network and does not have a list of IP addresses under its control. This is done next.

Use the dhcpconfig command again to specify the network for which the DHCP server is going to provide a service. The following example also uses a single router, specified with the -t option:

 ultra10# dhcpconfig -N 192.168.28.0 -t 192.168.28.28 Added network macro to dhcptab - 192.168.28.0. Created network table. 

Note that an additional macro has been added to the dhcptab table. This table is described in greater detail later in this chapter.

An advantage of using the ASCII file type of datastore is that the tables are easily viewed , just like any other file. The contents of the dhcptab file at this point in the configuration process are shown here:

 ultra10# cat /var/dhcp/SUNWfiles1_dhcptab # SUNWfiles1_dhcptab # # Do NOT edit this file by hand -- use dhtadm(1M) or dhcpmgr(1M) instead # Localem6223130260095893505:UTCoffst=0: ultra10m4693313761673478145:Include=Locale:Timeserv=192.168.28.28 \ :LeaseTim=86400:LeaseNeg:DNSdmain="xyz.com":DNSserv=192.168.28.28: 192.168.28.0m16031125823578701825:Subnet=255.255.255.0: \ Router=192.168.28.28:Broadcst=192.168.28.255: 

Note that the ultra10 macro has been defined so that it provides standard setup information for clients, such as the locale, the default lease time, DNS information and so on.

The network macro ( 192.168.28.0 ) contains a subnet mask. If this value is not specified on the command line, the /etc/inet/ netmasks file is automatically consulted.

The dhcp_network File

The next step in the manual configuration of the DHCP server is to add the range of IP addresses the server is going to be responsible for allocating to clients. The dhcp_network file is used to contain the range of addresses.

A separate file is created for each network that is specified with the -N option to the dhcpconfig command. The example used in this section specifies the network 192.168.28.0 . In the repository directory, there is a file called SUNWfiles1_192_168_28_0 . The filename is based on the datastore type and the IP address of the network it serves. When the file is created initially, it looks like this:

 ultra10# cat SUNWfiles1_192_168_28_0 # SUNWfiles1_192_168_28_0 # # Do NOT edit this file by hand -- use pntadm(1M) or dhcpmgr(1M) instead # 

Note that there are no IP addresses for the DHCP server to manage yet. You add these in the next section, by using pntadm .

The pntadm Command

The pntadm command is used to manage the DHCP network table, specifically to add, modify, or delete IP addresses that the DHCP server is going to manage; to add or remove networks that come under the control of the DHCP server; and to inspect the network tables themselves .

The most common use for this command is to add the range of IP addresses the DHCP server is responsible for allocating to clients. Each address has to be added manually to the table, which is one reason why this method of configuring a DHCP server is well suited to the use of scripts to loop through a defined block of numbers , eliminating the need to add each one manually.

The following command adds the IP address 192.168.28.31 to the 192.168.28.0 network table. It also identifies a hostname ( alpha3_31 ), which will automatically be added to the local /etc/inet/hosts file:

 ultra10# pntadm -A 192.168.28.31 -h alpha3_31 192.168.28.0 

This command uses the default configuration information, such as the datastore type and the repository directory. The following command is identical to it, but instead of accepting default values, it specifies them on the command line:

 ultra10# pntadm -r SUNWfiles -p /var/dhcp -A 192.168.28.31 -h alpha3_31 192.168.28.0 

The database now contains an IP address to manage that looks like this:

 ultra10# cat /var/dhcp/SUNWfiles1_192_168_28_0 # SUNWfiles1_192_168_28_0 # # Do NOT edit this file by hand -- use pntadm(1M) or dhcpmgr(1M) instead # 192.168.28.310000192.168.28.2807336363792986537986UNKNOWN 

The manual pages for the pntadm command and for the dhcp_network file describe the full range of options and the file format.

The dhcptab Table and dhtadm

The dhcptab table is used to store the configuration parameters, which will be passed to clients that use DHCP. The parameters are stored as macros in this table, where symbols can also be created to hold specific values. A symbol functions in a similar way to a variable.

The dhcptab table should not be edited manually; use either the DHCP manager ( dhcpmgr ) or the dhtadm command. This section describes the use of the dhtadm command.

 # dhtadm -P Name                    Type            Value ================================================== 192.168.28.0            Macro           :Subnet=255.255.255.0: \ Router=192.168.28.28:Broadcst=192.168.28.255: ultra10                 Macro           :Include=Locale:Timeserv= \ 192.168.28.28:LeaseTim=86400:LeaseNeg:DNSdmain="xyz.com":DNSserv= \ 192.168.28.28: Locale                  Macro           :UTCoffst=0: 

Notice that the the dhtadm -P command results in the same output as using the cat command, for example, to view the file SUNWfiles1_dhcptab . The dhcptab table is readable only because an ASCII file based datastore type is being used.

graphics/alert_icon.gif

Any changes that are made to the dhcptab table need to be read by the DHCP server. Remember that a SIGHUP ( -HUP ) needs to be sent to the in.dhcpd process so that it rereads the dhcptab table and implements any changes that have been made.


The most common dhtadm options are

  • -A Use this option to add and define a symbol or macro to the table.

  • -M Use this option to modify an existing symbol or macro in the table.

  • -D Use this option to delete an existing symbol or macro from the table.

  • -P Use this option to print (view) the contents of the dhcptab table.

Starting and Stopping the DHCP Server

The DHCP server is started at system boot time by the startup script /etc/rc3.d/S34dhcp . The in.dhcpd process starts only if the configuration file /etc/inet/dhcpsvc.conf exists and if the DAEMON_ENABLED variable in the configuration file is set to TRUE .

To stop a running DHCP server, enter the following command:

 ultra10# /etc/rc3.d/S34dhcp stop 

This cleanly shuts down the DHCP server manually.

To start the DHCP server manually, enter the following command:

 ultra10# /etc/rc3.d/S34dhcp start 

Uninstalling a DHCP Server

If DHCP is no longer required, or you wish to remove the DHCP server from your system, then you can use the dhcpconfig command to uninstall the server and optionally remove the host entries and the DHCP database tables as shown here:

 ultra10# dhcpconfig -U -x -h -f 

The options are described here:

  • -U This is the option to uninstall the DHCP server.

  • -f This sub-option states that no confirmation of the operation is required. If this sub-option is omitted, you get a confirmation message to reply to before the DHCP server is removed.

  • -x This sub-option removes the DHCP database tables.

  • -h This sub-option removes the host entries that were added for each managed IP address.

The following example shows how to uninstall a DHCP server, omitting the -f option, so that the confirmation message is displayed:

 ultra10# dhcpconfig -U -x -h Unconfigure will stop the DHCP service and remove the DHCP configuration file. Are you SURE you want to unconfigure the DHCP service? ([Y]/N):y DHCP server shutdown. Deleted the server macro from dhcptab. Deleted table for network 192.168.28.0. Deleted the dhcptab. Deleted the DHCP configuration file. 

The first thing the command does is to stop the server process. The DHCP database tables are then removed, along with the host entries, and finally the configuration file is removed.

graphics/note_icon.gif

Note that the host entries are removed from the local /etc/inet/hosts file because this option was specified when the DHCP server was initially configured.




Solaris 9 Network Administration Exam Cram 2 (Exam Cram CX-310-044)
Solaris 9 Network Administrator Exam Cram 2 (Exam CX-310-044)
ISBN: 0789728702
EAN: 2147483647
Year: 2003
Pages: 174
Authors: John Philcox

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net