⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhcp-client.texi

📁 this is sample about DHCP-agent
💻 TEXI
📖 第 1 页 / 共 2 页
字号:
@c ***************** list ***********************@node dhcp-client@chapter dhcp-clientdhcp-client is a highly configurable and extendable DHCP client. Outof the box it has been built to start up and perform DHCP for a basicnetwork setup with minimal fuss.This chapter of the manual is divided into two parts. A quickstartguide written to get things up and going with minimal fuss andabsolutely no file editing, and a more in depth reference manual tomaking use of the other DHCP client features.@section QuickstartThese instructions are for a quick no-hassle basic DHCP clientsetup. You don't really need to do much except know the following:@itemize bullet@item That a DHCP server is waiting and responding to any queriesoriginating from your machine.@item That you are using an ethernet connection and know the name of thenetwork interface you are using. Under Linux this is usually ``eth0'',and under other operating systems like FreeBSD or Solaris theinterface may be called ``le0'' or ``xl0''. If you are using a systemwith multiple network interfaces you should probably read the rest ofthis manual thoroughly to make sure your system is configuredcorrectly by the client.@itemYou want to setup your IP address (netmask and broadcast included),default route, and domain name system and nothing else.@itemYou can send an ICMP echo request to the default gateway, otherwiseyou need to disable icmp latency discovery which is explained furtherdown in the manual.@itemYour PATH environment variable points to the dhcp-client binary.@end itemizeAs the root user run the following command:@command{dhcp-client -i} @var{<interface>}Where you substitute @var{<interface>} with the name of yourinterface. Alternatively if the interface is down you can omit the@option{-i} and dhcp-client will automatically use the first ethernetinterface which is not up.You should be greeted by copyright text and the output of the clientas it queries the DHCP server and configures your system. Once theclient is done, it will fork into the background and continue to renewyour lease as timers expire. In the event of the lease expiring theclient will down your interface and cleanup any of the systemconfiguration it had done before.Although you can run the client in the foreground, if you do not, theclient will send the rest of its messages to syslogd. Currently itlogs to the daemon service [ FIXME: in the future the syslog servicewill be configurable ].@section Client Configurationdhcp-client accepts a number of configuration directives. Some ofthese can be passed by the command line, and others through aconfiguration file.@subsection Command Line Options@itemize@item-h     Print out usage.@item-v     Print out version information@item-a     Always run in the foreground and do not go into the background.@item-c     Clear the cache. This is useful in case a stale cache is left behindby an earlier invocation.@item-k Kill a dhcp-client instance. Coupled with the -i option this will killa specific instance of dhcp-client. Otherwise the first dhcp-clientfound on an active ethernet interface is terminated.@item-p     Forces dhcp-client to use promiscious mode. This is only useful onsystems which are sufficiently broken that require promiscious modeto receive broadcast messages.@item-w     Wake a dhcp-client instance. Coupled with the -i option this will wakeup a client on a specified interface and cause it to either rebind, orrenew earlier depending on which timer is next. Use this to force theclient to reacquire a lease.@item-sPrint out status information on the most recent lease acquired bythe client.@item-i @dfn{interface}              Force dhcp-client to use the interface specified.  This is useful tomake sure dhcp-client uses a specific interface if the host ismulti-homed.@item-l @dfn{level}Generate messages at the level specified. The level should be aninteger between 0 - 4. The levels are no messages, error messages,info messages (default), warnings, diagnostic-messages, respectively.Each level includes all messages below it.  The default is infomessages which also include error messages.@item-m @dfn{mac address}             Fake a mac address during the DHCP operation. This will only affectthe DHCP operations and no others.  This is useful for debugging aDHCP server that is not behaving itself.@end itemize@subsection The Configuration Filedhcp-client will look for two files for a configurationinformation. Both these files should be located in the systemconfiguration directory. By default this is defined as@file{/usr/local/etc} You can change this definition at build time byspecifying a different prefix to the @command{configure} script.The first file that is checked for begins with the name of theinterface the client is configuring. For example, if the name of ourinterface is ``xl0'' then the configuration file to be checked will be@file{/usr/local/etc/dhcp-agent/dhcp-client/xl0.conf}If this file does not exist then the default configuration file is@file{/usr/local/etc/dhcp-agent/dhcp-client/default.conf}This allows dhcp-client to accept configuration per interface, and usea default file without forcing the user to name interfaces in theactual configuration file. It is believed that configuration files aremore portable this way and are not dependant on interface names.@subsection Layout of Configuration File.The configuration file is made up of directives. Each directive cantake up one line or fall on multiple lines . Each directive isterminated by a semicolon. Whitespace is ignored unless it is found ina quoted sting. Newlines are always ignored.@examplefoobar = yada,blah;@end exampleAnd:@examplefoobar = yada, blah;@end exampleAre the same.The parser also recognizes strings in two different formats. Quotedand unquoted.@example"foobar"@end exampleIs parsed exactly the same as@examplefoobar@end exampleHowever:@examplefoo bar@end exampleWill parse as two different strings, so you should use:@example"foo bar"@end exampleQuoting is useful for strings which contain whitespace. Newlines inquoted strings will result in an error unless preceeded by the '\'character. There should be no need to put newlines in quoted stringsand expect them to be evaluated without the backslash (much like aMakefile). If you want newlines to be silently ignored you need toconvince the author that they should be :-)The '\' character can be used to escape double quotes too.@subsection Configuration Directives@subheading DHCP Option HandlingThe following directives affect DHCP option handling by the client@deffn {Client Configuration Directive} requestThis directive instructs the client to request aset of dhcp options. The request directive accepts a list of stringswhich name the options to be requested:@examplerequest subnet-mask, ip-address-lease-time, renewal-time,        rebinding-time, interface-mtu, domain-name, domain-name-servers;@end example@end deffn@deffn {Client Configuration Directive} requireThis directive instructs the client to require a set of dhcp optionsto be passed before accepting the lease. This is useful to make sureyou receive a minimum of desired options. If these options are nevermet the client will eventually timeout. If this directive is not set,the first DHCP lease offer will be accepted.@examplerequire subnet-mask, ip-address-lease-time, renewal-time,        rebinding-time, interface-mtu;@end example@end deffn@deffn {Client Configuration Directive} configureThis directive instructs the client to onlyconfigure a set of dhcp options. This is useful if the server ispassing you options you would rather not configure but implicitlyclaim to configure by accepting the lease. This directive does notdefine how options are configured. In order to define howconfiguration is done see ``Writing Client Extensions,'' for more info.@exampleconfigure subnet-mask, ip-address-lease-time, renewal-time,          rebinding-time, interface-mtu, domain-name, domain-name-servers;@end example@end deffn@deffn {Client Configuration Directive} appendThis directive instructs the client to append avalue to a DHCP option prior to system configuration. If this optionis a list of values, the value specified is merely appended. If thisvalue is a string the value is appended to the string. If this optionis a single datum then you should be using the override optioninstead.@exampleappend domain-name-servers = 127.0.0.1, 192.168.0.1;@end example@end deffn@deffn {Client Configuration Directive} prependThis directive works the same as the appenddirective only the values are placed at the beginning of the list orstring. You should not use prepend on single datum options and shoulduse override instead.@exampleprepend domain-name-servers = 127.0.0.1, 192.168.0.1;@end example@end deffn@deffn {Client Configuration Directive} overrideThis directive instructs the client tooverwrite a DHCP option with a specified value prior to systemconfiguration. This is useful to for clients that wish to use analternate value for a DHCP option than the one passed by the DHCPserver.@exampleoverride domain-name = "example.com";@end example@end deffn@subheading Variable Settings@deffn {Client Configuration Directive} setThis directive instructs the client to set a variable toa defined value.@exampleset default-subnet-mask = 255.255.255.0;@end example@end deffn@deffn {Client Configuration Directive} enableThis directive instructs the client to set a booleanvariable to a defined value. The boolean variable only accepts ``yes'' or``no'' for values.@exampleenable do-measure-router-latency = no;@end example@end deffn@subheading Configurable Variablesdhcp-client accepts a number of variables to configure default values,values passed to the server, and control some of its behaviour.@defvr {Client Configuration Variable} hostnameThis variable can be set to a string which is passed as

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -