busybox 自带的 udhcpd 和 udhcpc 提供不完整的 DHCP 服务器和客户端,它们只是实现了 DHCP 协议的一部分,并且它们的功能有限。
介绍
udhcpdDHCP 服务器udhcpcDHCP 客户端
udhcpd
udhcpd -f /etc/udhcpd.confudhcpc
udhcpc -b -i $interface --script=/usr/share/udhcpc/default.script # -q说明:
- 通过 script 指定的脚本,配置 IP、route、DNS 等
help
script 支持的环境变量
$HOME - The set $HOME env or "/"
$PATH - the set $PATH env or "/bin:/usr/bin:/sbin:/usr/sbin"
$1 - What action the script should perform
interface - The interface this was obtained on
ip - The obtained IP
siaddr - The bootp next server option
sname - The bootp server name option
boot_file - The bootp boot file option
subnet - The assigend subnet mask
timezone - Offset in seconds from UTC
router - A list of routers # $router 获取路由 ips 信息
timesvr - A list of time servers
namesvr - A list of IEN 116 name servers
dns - A list of DNS server
logsvr - A list of MIT-LCS UDP log servers
cookiesvr - A list of RFC 865 cookie servers
lprsvr - A list of LPR servers
hostname - The assigned hostname
bootsize - The length in 512 octect blocks of the bootfile
domain - The domain name of the network
swapsvr - The IP address of the client's swap server
rootpath - The path name of the client's root disk
ipttl - The TTL to use for this network
mtu - The MTU to use for this network
broadcast - The broadcast address for this network
ntpsrv - A list of NTP servers
wins - A list of WINS servers
lease - The lease time, in seconds
dhcptype - DHCP message type (safely ignored)
serverid - The IP of the server
message - Reason for a DHCPNAK
tftp - The TFTP server name
bootfile - The bootfile name重新获取 IP
udhcpc also responds to SIGUSR1 and SIGUSR2. SIGUSR1 will force a renew state,
and SIGUSR2 will force a release of the current lease, and cause udhcpc to
go into an inactive state (until it is killed, or receives a SIGUSR1). You do
not need to sleep between sending signals, as signals received are processed
sequencially in the order they are received.# Release
kill -s USR2 udhcpc
# Renew
kill -s USR1 udhcpc最近更新
最新评论