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
单调的分割线
http://udhcp.busybox.net/README.udhcpc
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
If the requested IP address cannot be obtained, the client accepts the
address that the server offers.
udhcp client scripts
-------------------
When an event occurs, udhcpc calls the action script. The script by
default is /usr/share/udhcpc/default.script but this can be changed via
the command line arguments. The three possible arguments to the script
are:
deconfig: This argument is used when udhcpc starts, and
when a leases is lost. The script should put the interface in an
up, but deconfigured state, ie: ifconfig $interface 0.0.0.0.
bound: This argument is used when udhcpc moves from an
unbound, to a bound state. All of the paramaters are set in
enviromental variables, The script should configure the interface,
and set any other relavent parameters (default gateway, dns server,
etc).
renew: This argument is used when a DHCP lease is renewed. All of
the paramaters are set in enviromental variables. This argument is
used when the interface is already configured, so the IP address,
will not change, however, the other DHCP paramaters, such as the
default gateway, subnet mask, and dns server may change.
nak: This argument is used with udhcpc receives a NAK message.
The script with the deconfig argument will be called directly
afterwards, so no changes to the network interface are neccessary.
This hook is provided for purely informational purposes (the
message option may contain a reason for the NAK).
The paramaters for enviromental variables are as follows:
$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
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
additional options are easily added in options.c.
note on udhcpc's random seed
---------------------------
udhcpc will seed its random number generator (used for generating xid's)
by reading /dev/urandom. If you have a lot of embedded systems on the same
network, with no entropy, you can either seed /dev/urandom by a method of
your own, or doing the following on startup:
ifconfig eth0 > /dev/urandom
in order to seed /dev/urandom with some data (mac address) unique to your
system. If reading /dev/urandom fails, udhcpc will fall back to its old
behavior of seeding with time(0).
signals accepted by udhcpc
-------------------------
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.
compile time options
-------------------
options.c contains a set of dhcp options for the client:
name[10]: The name of the option as it will appear in scripts
flags: The type of option, as well as if it will be requested
by the client (OPTION_REQ)
code: The DHCP code for this option
udhcpc 参数使用说明的更多相关文章
- Linux/Unix 常用参数使用说明
参数使用说明 ~ 表示当前用户目录 绝对路径 .表示当前目录 绝对路径 | 命令格式:命令A|命令B,即命令1的正确输出作为命令B的操作对象(下图应用别人的图片) 举例 ps aux | grep & ...
- phpmailer 参数使用说明
$AltBody--属性 出自:PHPMailer::$AltBody 文件:class.phpmailer.php 说明:该属性的设置是在邮件正文不支持HTML的备用显示 AddAddress--方 ...
- GoldenGate HANDLECOLLISIONS参数使用说明
HANDLECOLLISIONS在官方文档上的说明: 使用HANDLECOLLISIONS和NOHANDLECOLLISIONS参数来控制在目标上应用SQL时,Replicat是否尝试解决重复记录和缺 ...
- ffmpeg参数使用说明2
附录一(ffmpeg参数说明): [参数] [说明] [示例] -i "路径" 指定需要转换的文件路径 -i "C:\nba.wmv" -y 覆盖输出文件,即如 ...
- ffmpeg参数使用说明1
1. ffmpeg.exe -i F:闪客之家闪客之歌.mp3 -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 f:11.flv 2. ffmpeg ...
- ckplayer 参数设置详解
参数 使用说明 f s=0时地为普通的视频地址s=1时是一个网址,网址里存放视频地址s=2时是一个网址,网址里输出xml格式的视频地址s=3时是一个swf文件地址,swf和播放器进行交互读取地址 ...
- BusyBox ifup udhcpc后台运行
/********************************************************************** * BusyBox ifup udhcpc后台运行 * ...
- Skip-External-Locking – MySQL性能参数详解
MySQL的配置文件my.cnf中默认存在一行skip-external-locking的参数,即“跳过外部锁定”.根据MySQL开发网站的官方解释,External-locking用于多进程条件下为 ...
- Monkey测试的参数
一.Monkey测试简介 Monkey测试是Android平台自动化测试的一种手段,通过Monkey程序模拟用户触摸屏幕.滑动Trackball.按键等操作来对设备上的程序进行压 力测试,检测程序多久 ...
随机推荐
- windows server 2008 集成raid卡驱动
给服务器安装2008系统,一般都需要通过引导盘和操作系统盘来进行安装,安装过程比较繁琐时间也比较长,于是就想做一个集成了服务器驱动的2008系统盘,这样就可以直接用光盘安装,简单方便,第一步需要解决的 ...
- 如何在Linux下创建与解压zip, tar, tar.gz和tar.bz2文件
这么多年来,数据压缩对我们来说是非常有用的.无论是在邮件中发送的图片用的zip文件还是在服务器压缩数据文件,我们都可以让下载更容易或者有效的节约磁盘空间.某些压缩格式有时允许我们以60%的比率(甚至更 ...
- Sublime Text 3 配置浏览器预览路径 localhost
原文链接:http://jingyan.baidu.com/article/15622f2419ce79fdfcbea5ea.html 按步骤设置成功!感谢大侠! 以下是原文: Sublime Tex ...
- building hadoop2.4.1 on centos7[在centos7上面构建hadoop2.4.1]
本文介绍在centos7上面通过hadoop2.4.1源码构建hadoop distribution 版本,即hadoop的运行版本. 为何要自己building,而不用Apache的distribu ...
- C++ 实现设计模式之观察者模式
1. 什么是观察者模式? 观察者模式(有时又被称为发布-订阅Subscribe>模式.模型-视图View>模式.源-收听者Listener>模式或从属者模式)是软件设计模式的一种.在 ...
- C语言基础知识-循环结构
用while打印出1~100之间7的倍数 int i = 1; while循环是当条件表达式的结果为真时,执行大括号里面的循环体,重复执行直到条件表达式的结果为假时结束循环. w ...
- 洛谷 P1064 金明的预算方案
题目描述 金明今天很开心,家里购置的新房就要领钥匙了,新房里有一间金明自己专用的很宽敞的房间.更让他高兴的是,妈妈昨天对他说:“你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过N元钱就行”.今 ...
- JDBC和DBUtils区别(查询时jdbc只能返回ResultSet需要po转vo,dbutils返回的BeanListHandler与BeanHandler对应集合与对象)
17:34 2013/6/7 JDBC //添加客户 public void addNewCustomer(Customer c) throws DAOException { Connection c ...
- pscp实现Windows 和Linux 文件互相传输
pscp 能够实现Windows 和Linux 间相互传输文件.下文将详细描述如何使用: 一.pscp 简要描述: PSCP (PuTTY Secure Copy client)是PuTTY 提供的文 ...
- UVA 10765 Doves and bombs
给定一个无向的连通图,要求每个点去掉后连通分量的数目,然后输出连通分量最多的m个点. 分析: 先求出双连通分量,然后统计所有双连通分量中割顶出现的次数,最后求出的就是割顶去掉后剩下的双连通的数目,对于 ...