admin管理员组

文章数量:1660165

udhcpc 参数使用说明

  • udhcpc
    • 英文文档链接. udhcp client (udhcpc)
    • command line options

udhcpc

当没有网络的时候,板子一直发送dhcp请求,导致程序不往下执行,解决的办法是把它切换到后台运行,可是如何切换到后台呢,有办法,它自带参数可以实现该功能。如下:

udhcpc -b -i eth0 -p /var/run/udhcpc.pid -R

解释一下,-b就是切换到后台指令,-i是指定使用哪个网络接口,双网卡的时候一定要使用它来指定eth0 or eth1。

【最近新添加 -R】

对于 -R参数,其实也很重要,在关闭udhcpc时,可以向dhcpserver发送release取消租约。

下面引用网友的一篇文章:

udhcpc 的配置记录

udhcpc scripts

Here’s some debian scripts I wrote for udhcpc 0.9.6. I wanted to make it easy to run local scripts for DHCP changes so I created /etc/udhcpc.d. All the /usr/share/udhcpc/default.* scripts have been merged into /etc/udhcpc.d/S50default. S99local is an example script that patches resolv.conf and calls a DNS update script.

/etc/init.d/udhcpc
/etc/udhcpc.script
/etc/udhcpc.d/S50default
/etc/udhcpc.d/S99local

Last modified: Mon Feb 4 10:23:49 PST 2002

单调的分割线

英文文档链接.
udhcp client (udhcpc)

The udhcp client negotiates a lease with the DHCP server and notifies
a set of scripts when a leases is obtained or lost.

command line options

The command line options for the udhcp client are:

-c, --clientid=CLIENTID Client identifier
-H, --hostname=HOSTNAME Client hostname
-h, Alias for -H
-f, --foreground Do not fork after getting lease
-b, --background Fork to background if lease cannot be
immediately negotiated.
-i, --interface=INTERFACE Interface to use (default: eth0)
-n, --now Exit with failure if lease cannot be
immediately negotiated.
-p, --pidfile=file Store process ID of daemon in file
-q, --quit Quit after obtaining lease
-r, --request=IP IP address to request (default: none)
-s, --script=file Run file at dhcp events (default:
/usr/share/udhcpc/default.script)
-v, --version Display version

本文标签: 使用说明参数udhcpc