Skip to main content

udhcpc

  • 默认配置 /etc/udhcpc/udhcpc.conf
    • RESOLV_CONF=no - 不修改 resolve.conf
  • 默认脚本 /usr/share/udhcpc/default.script
    • 获取到配置后,调用脚本进行配置
    • udhcpc.conf 内变量影响配置逻辑
  • signals
    • SIGUSR1 - 刷新状态,会从新获取 IP
    • SIGUSR2 - 释放当前租约,进入不活跃状态,发送 SIGUSR1 信号可激活
  • 参考
# 手动申请地址
udhcpc -i eth1 -q

default.script

脚本变量

envdesc
$HOME$HOME 变量或 "/"
$PATH$PATH 变量或 "/bin:/usr/bin:/sbin:/usr/sbin"
$1action
interfaceinterface
ipip
siaddrbootp next server option
snamebootp server name option
boot_filebootp boot file option
subnetsubnet mask
timezoneOffset in seconds from UTC
routerA list of routers
timesvrA list of time servers
namesvrA list of IEN 116 name servers
dnsA list of DNS server
logsvrA list of MIT LCS UDP log servers
cookiesvrA list of RFC 865 cookie servers
lprsvrA list of LPR servers
hostnameThe assigned hostname
bootsizeThe length in 512 octect blocks of the bootfile
domainThe domain name of the network
swapsvrThe IP address of the client's swap server
rootpathThe path name of the client's root disk
ipttlThe TTL to use for this network
mtuThe MTU to use for this network
broadcastThe broadcast address for this network
ntpsrvA list of NTP servers
winsA list of WINS servers
leaseThe lease time, in seconds
dhcptypeDHCP message type (safely ignored)
serveridThe IP of the server
messageReason for a DHCPNAK
tftpThe TFTP server name
bootfileThe bootfile name