📄 c-netconfig2.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> Network Configuration Protocols </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="c-netconfig.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-netconfig.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-netconfig1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-netconfig3.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="88073">5.2 DHCP, Dynamic Host Configuration Protocol </a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88075"> </a>DHCP, an extension of BOOTP, is designed to supply clients with all of the Internet configuration parameters defined in the Host Requirements documents (RFCs 1122 and 1123) without manual intervention. Like BOOTP, DHCP allows the permanent allocation of configuration parameters to specific clients. However, DHCP also supports the assignment of a network address for a finite lease period. This feature allows serial reassignment of network addresses. The DHCP implementation provided with VxWorks conforms to the Internet standard RFC 1541. </p></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="88076">VxWorks DHCP Components</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="88077"> </a>VxWorks includes a DHCP client, server, and relay agent. The DHCP client can retrieve one or more sets of configuration parameters from either a DHCP or BOOTP server. The DHCP client also maintains any leases it has retrieved. Likewise, the DHCP server can process both BOOTP and DHCP messages. Both the client and server implementations support all options described in RFC 1533. The DHCP relay agent provides forwarding of DHCP and BOOTP messages across subnet boundaries. <sup><a href="#foot"><b class="FootnoteMarker">1</b></a></sup></p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="88081">Interface Settings Retrieved Using DHCP</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="88083"> </a>If the server is configured to provide them, a lease can include configuration parameters in addition to an assigned IP address . To minimize network traffic, the DHCP client sets configuration values to the defaults specified in the Host Requirements documents (RFCs 1122 and 1123) if the corresponding parameters are not specified by the server. </p><dd><p class="Body"><a name="93403"> </a>Unlike the configuration parameters supplied by BOOTP, the DHCP-assigned configuration parameters can expire. Although the DHCP server can duplicate BOOTP behavior and issue a permanent IP address to the client, the lease granted is usually temporary. To continue using the assigned parameters, the client must periodically contact the issuing server to renew the lease.</p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/warning.gif"></td><td><hr><div class="CalloutCell"><a name="91969"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">WARNING: </font></b></a>The Tornado tools do not currently have any way to discover or respond to a change in the target's IP address. Such a change breaks the network connection. In response, you must manually reconnect the Tornado tools to the target's new IP address. During development, this is rarely a serious problem, and you can avoid it by having the DHCP server issue an infinite lease on the target's IP address.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="88096">5.2.1 Configuring VxWorks to Include the DHCP Components</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88098"> </a>To control which DHCP feature VxWorks includes, you must reconfigure VxWorks. The relevant configuration macro is found in the list below: </p></dl><dl class="margin"><dd><div class="Item"><a name="88100"> </a>DHCP server</div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88101"> </a>Includes the DHCP server code in the VxWorks image. (Configuration flag: <b class="symbol_UC">INCLUDE_DHCPS</b>)</div><br></dl></dl><dd><div class="Item"><a name="88103"> </a>DCHPv4 runtime client</div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88104"> </a>Includes the DHCP client code in the VxWorks image. You need this code if you want the target to boot using DHCP. (Configuration flag: <b class="symbol_UC">INCLUDE_DHCPC</b>)</div><br></dl></dl><dd><div class="Item"><a name="88106"> </a>DHCP relay agent</div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88107"> </a>Includes the DHCP relay agent in the VxWorks image. Include the DHCP relay agent if the VxWorks target relays information from a DHCP server on a different subnet. (Configuration flag: <b class="symbol_UC">INCLUDE_DHCPR</b>)</div><br></dl></dl></dl><dl class="margin"><dd><p class="Body"><a name="88108"> </a>After defining any of the above constants, rebuild VxWorks. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="88109">5.2.2 Configuring the DHCP Client</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88111"> </a>The following configuration macros are defined by default for the DHCP client: </p></dl><dl class="margin"><dd><div class="Item"><a name="88113"> </a>DHCP Client Target Port </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88114"> </a>Port monitored by DHCP servers. Default: 67. (Configuration constant: <b class="symbol_UC">DHCPC_SPORT</b>)</div><br></dl></dl><dd><div class="Item"><a name="88116"> </a>DHCP Client Host Port<b class="symbol_UC"> </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88117"> </a>Port monitored by DHCP clients. Default: 68. (Configuration constant: <b class="symbol_UC">DHCPC_CPORT</b>)</div><br></dl></dl><dd><div class="Item"><a name="88119"> </a>DHCP Client Maximum Leases<b class="symbol_UC"> </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88120"> </a>Maximum number of simultaneous leases. Default: 4. (Configuration constant: <b class="symbol_UC">DHCPC_MAX_LEASES</b>)</div><br></dl></dl><dd><div class="Item"><a name="88122"> </a>DHCP Client Timeout Value<b class="symbol_UC"> </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88123"> </a>Seconds to wait for multiple offers. Default: 5. (Configuration constant: <b class="symbol_UC">DHCPC_OFFER_TIMEOUT</b>)</div><br></dl></dl><dd><div class="Item"><a name="88125"> </a>DHCP Client Default Lease<b class="symbol_UC"> </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88126"> </a>Desired lease length in seconds. Default: 3600. (Configuration constant: <b class="symbol_UC">DCHPC_DEFAULT_LEASE</b>)</div><br></dl></dl><dd><div class="Item"><a name="88128"> </a>DHCP Client Minimum Lease<b class="symbol_UC"> </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88129"> </a>Minimum allowable lease length (seconds). Default: 30. (Configuration constant: <b class="symbol_UC">DHCPC_MIN_LEASE</b>)</div><br></dl></dl></dl><dl class="margin"><dd><p class="Body"><a name="88130"> </a>You can configure VxWorks to set these parameters to any desired value. However, the DHCP client rejects all offers whose duration is less than the minimum lease. Therefore, setting the DHCP Client Minimum Lease value too high could prevent the retrieval of any configuration parameters. In addition, if the DHCP client is used at boot time, the values for DHCP Client Target Port and DHCP Client Host Port<b class="symbol_UC"> </b>used in the boot program and run-time image must match. </p><dd><p class="Body"><a name="88132"> </a>Finally, the DHCP Client Maximum Leases limit on multiple concurrent leases includes a lease established at boot time. For example, if this limit has a value of four, and if a boot-time DHCP client retrieves a lease, the run-time DHCP client is limited to three additional sets of configuration parameters (until the boot-time lease expires). </p><dd><p class="Body"><a name="88133"> </a>For more information on using a DHCP client to retrieve network configuration parameters at boot-time, see <a href="c-booting.html#84222"><i class="title">13. Booting over the Network</i></a>. </p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/note.gif"></td><td><hr><div class="CalloutCell"><a name="91998"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE: </font></b></a>In addition to setting values for the defines mentioned above, most real-world uses of DHCP require that you provide an event hook routine to handle lease events. For more information, see the <b class="routine"><i class="routine">dhcpcEventHookAdd</i></b><b>( )</b> reference entry.<b class="symbol_UC"></b></div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="88146">5.2.3 Configuring DHCP Servers</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88147"> </a>Configuring the DHCP server requires that you create a pool of configuration parameter sets. Each parameter set must include an IP address. When a DHCP client makes a request of the server, the server can then assign a parameter set to the client (either permanently or on a leased basis). To store and maintain this pool of configuration parameter sets, some DHCP servers use one or more files. This approach is analogous to the use of the <b class="file">bootptab</b> file associated with SunOS BOOTP servers. The unsupported DHCP server distributed with VxWorks takes this approach. </p><dd><p class="Body"><a name="88148"> </a>However, some VxWorks targets do not include a file system. The supported target-resident DHCP server does not use a file-based mechanism for parameter storage. Instead, the target-resident server maintains configuration parameters in memory-resident structures. To control the contents of these memory-resident structures, you must modify the source code that defines these structures. </p><dd><p class="Body"><a name="88149"> </a>The following sections describe how to configure the supported DHCP server. Also included are pointers to reference information on configuring the unsupported DHCP server. If you decide to use a third-party DHCP server, consult the configuration information in the vendor-supplied documentation. </p></dl>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -