System Administration Guide, Volume 3

Working With DHCP Macros

DHCP macros are containers of DHCP options. The Solaris DHCP service uses macros to gather together options that should be passed to clients. DHCP Manager and dhcpconfig create a number of macros automatically when you configure the server. See "About Macros" for background information about macros, and Chapter 10, Configuring DHCP Service for information about macros created by default.

You might find that when changes occur on your network, you need to make changes to the configuration information passed to clients. To do this, you need to work with macros by adding, modifying, duplicating, or deleting them.

Working with macros requires knowledge of DHCP standard options, which are described in the dhcptab(4) man page.

The following task map lists tasks for viewing, modifying, adding, and deleting DHCP macros.

Table 11-7 DHCP Macros Task Map

Tasks 

Description 

For Instructions, Go To... 

View DHCP macros.  

Display a list of all the macros defined on the DHCP server. 

"How to View Macros Defined on a DHCP Server (DHCP Manager)"

Add DHCP macros. 

Create new macros to support DHCP clients. 

"How to Add a DHCP Macro (DHCP Manager)"

Modify values passed in macros to DHCP clients. 

Change macros by modifying existing options, adding options to macros, removing options from macros. 

"How to Change Values for Options in a DHCP Macro (DHCP Manager)"

"How to Add Options to a DHCP Macro (DHCP Manager)"

"How to Delete Options from a DHCP Macro (DHCP Manager)"

Delete DHCP macros. 

Remove DHCP macros that are no longer used. 

"How to Delete a DHCP Macro (DHCP Manager)"

The following figure shows the Macros tab in the DHCP Manager window.

Figure 11-14 DHCP Manager's Macros Tab

Graphic

How to View Macros Defined on a DHCP Server (DHCP Manager)

You can use DHCP Manager or dhtadm -P to display all the macros defined on a DHCP server.

  1. Select the Macros tab.

    The Macros area on the left side of the window displays, in alphabetical order, all macros defined on the server. Macros preceded by a folder icon include references to other macros, while macros preceded by a document icon do not reference other macros.

  2. To open a macro folder, click the open/close widget to the left of the folder icon.

    The macros included in the selected macro are listed.

  3. To view the contents of a macro, click the macro name and look at the area on the right side of the window.

    Options and their assigned values are displayed.

Modifying DHCP Macros

You might need to modify macros when some aspect of your network changes and one or more clients need to know about the change. For example, you might add a router or a NIS server, create a new subnet, or decide to change the lease policy.

When you modify a macro, you must know the name of the DHCP option that corresponds to the parameter you want to change, add, or delete. The standard DHCP options are listed in the DHCP Manager help and in the dhcptab(4) man page.

You can use the dhtadm -M -m command or DHCP Manager to modify macros. See the dhtadm(1M) man page for more information about dhtadm.

The following figure shows DHCP Manager's Macro Properties dialog box.

Figure 11-15 Macro Properties Dialog Box

Graphic

How to Change Values for Options in a DHCP Macro (DHCP Manager)

  1. Select the Macros tab.

  2. Select the macro you want to change.

  3. Choose Properties from the Edit menu.

    The Macro Properties dialog box opens.

  4. In the table of Options, select the option you want to change.

    The option's name and value are displayed in the Option Name and Option Value fields.

  5. In the Option Value field, select the old value and type the new value for the option.

  6. Click Modify.

    The new value is displayed in the options table.

  7. Select Notify DHCP Server of Change.

    This selection tells the DHCP server to reread the dhcptab to put the change into effect immediately after you click OK.

  8. Click OK.

How to Add Options to a DHCP Macro (DHCP Manager)

  1. Select the Macros tab.

  2. Select the macro you want to change.

  3. Choose Properties from the Edit menu.

    The Macro Properties dialog box opens.

  4. In the Option Name field, specify the name of an option using one of the following methods:

    1. Click the Select button next to the Option Name field and select the option you want to add to the macro.

      The Select Option dialog box displays an alphabetized list of names of Standard category options and descriptions. If you want to add an option that is not in the Standard category, use the Category list to select the category you want.

      See "About Macros" for more information about macro categories.

    2. Type Include if you want to include a reference to an existing macro in the new macro.

  5. Type the value for the option in the Option Value field.

    If you typed Include as the option name, you must specify the name of an existing macro in the Option Value field.

  6. Click Add.

    The option is added to the bottom of the list of options displayed for this macro. If you want to change the option's position in the list, select the option and click the arrow keys next to the list to move the option up or down.

  7. Select Notify DHCP Server of Change.

    This selection tells the DHCP server to reread the dhcptab to put the change into effect immediately after you click OK.

  8. Click OK.

How to Delete Options from a DHCP Macro (DHCP Manager)

  1. Select the Macros tab.

  2. Select the macro you want to change.

  3. Choose Properties from the Edit menu.

    The Macro Properties dialog box opens.

  4. Select the option you want to remove from the macro.

  5. Click Delete.

    The option is removed from the list of options for this macro.

  6. Select Notify DHCP Server of Change.

    This selection tells the DHCP server to reread the dhcptab to put the change into effect immediately after you click OK.

  7. Click OK.

Adding DHCP Macros

You may want to add new macros to your DHCP service to support clients with specific needs. You can use the dhtadm -A -m command or DHCP Manager's Create Macro dialog box to add macros. See the dhtadm(1M) man page for more information about dhtadm.

The following figure shows DHCP Manager's Create Macro dialog box.

Figure 11-16 Create Macro Dialog Box

Graphic

How to Add a DHCP Macro (DHCP Manager)

  1. Select the Macros tab.

  2. Choose Create from the Edit menu.

    The Create Macro dialog box opens.

  3. Type a unique name for the macro.

    If you use a name that matches a vendor class identifier, network address, or client ID, the macro will be processed automatically for appropriate clients. If you use a different name, the macro can only be processed if it is assigned to a specific IP address or included in another macro that is processed. See "Macro Processing by the DHCP Server" for more detailed information.

  4. Click the Select button next to the Option Name field.

    The Select Option dialog box opens, displaying an alphabetized list of names of Standard category options and their descriptions.

  5. If you want to an option that is not in the Standard category, use the Category list to select the category you want.

    See "About Options" for more information about option categories.

  6. Select the option you want to add to the macro and click OK.

    The Macro Properties dialog box displays the selected option in the Option Name field.

  7. Type the value for the option in the Option Value field.

  8. Click Add.

    The option is added to the bottom of the list of options displayed for this macro. If you want to change the option's position in the list, select the option and click the arrow keys next to the list to move the option up or down.

  9. Repeat Step 6 through Step 8 for each option you want to add to the macro.

    If you want to rearrange the order of the options, select option names and click the arrow keys to move the names up and down in the list of options.

  10. Select Notify DHCP Server of Change when you are finished adding options.

    This selection tells the DHCP server to reread the dhcptab to put the change into effect immediately after you click OK.

  11. Click OK.

Deleting DHCP Macros

You might want to delete a macro from the DHCP service. For example, if you delete a network from the DHCP service, you can also delete the associated server macro because it will no longer be used.

You can use the dhtadm -D -m command or DHCP Manager to delete macros.

How to Delete a DHCP Macro (DHCP Manager)

  1. Select the Macros tab.

  2. Select the macro you want to delete.

    The Delete Macro dialog box opens, prompting you to confirm that you want to delete the specified macro.

  3. Select Notify DHCP Server of Change.

  4. Click OK.