欢迎来到天天文库
浏览记录
ID:57672147
大小:53.50 KB
页数:9页
时间:2020-08-31
《DHCP客户端程序移植笔记(全).doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、DHCP程序运行与调试实现的目标:开机时自动获取IP地址,若没有可用的IP地址,选用autoip;或者选用静态配置的ip地址。DHCP客户端程序有多种,本系统选用的busybox下的dhcpc。[1]修改内核配置;在内核中添加以下选项:Networking--->[*]NetworkingsupportNetworkingoptions---><*>Packetsocket//添加.配置CONFIG_PACKET[*]IP:DHCPsupport//添加[*]Networkpacketfiltering(replacesipchains)--->//添加,后面子选项可不选,配置CON
2、FIG_NETFILTER?---Networkpacketfilteringframework(Netfilter)说明:若没选<*>Packetsocket,[*]Networkpacketfiltering(replacesipchains)--->选项,在执行udhcpc命令时出现如下错误:~#udhcpcudhcpc(v-pre)startedudhcpc[208]:udhcpc(v-pre)startedFATAL:couldn'tlistenonsocket,Addressfamilynotsupportedbyprotocoludhcpc[208]:FATAL:cou
3、ldn'tlistenonsocket,Addressfamilynotsupportedbyprotocol[2]修改busybox配置,Busybox中添加以下选项:NetworkingUtilities ---> udhcpServer/Client --->[]udhcpServer(udhcpd) //在此不作服务端,故不选。生成udhcpd命令[*]udhcpClient(udhcpc)//生成udhcpc命令[]Leasedisplayutility(dumpleases)[]Logudhcpmessagestosyslog(insteadofstdout)[]Com
4、pileudhcpwithnoisydebuggingmessages若busybox没编译相应选项,也可从网上下载相应文件,用arm-linux交叉编译得到udhcpd,udhcpc命令copy到usr/sbin下就可以了。我从网上下的udhcp_cvs20050303.orig.tar.gz文件解压后修改Makefile文件在19行添加CROSS_COMPILE=arm-linux-注释12行的COMBINED_BINARY=1,否则不生成udhcpc命令[3]运行程序:up-tech:/sbin#./udhcpcudhcpc(v1.15.3)startedSendingdisc
5、over...Sendingselectfor192.168.1.102...ReceivedDHCPNAKSendingdiscover...Sendingselectfor192.168.1.101...Leaseof192.168.1.101obtained,leasetime7200[4]将busybox目录下:examples/udhcp/simple.script拷贝到根目录文件夹/usr/share/udhcpc/default.script。覆盖掉原始文件。重新制作根目录。从busybox的examples/udhcp/下copysimple.script文件到开发板
6、/usr/share/udhcpc/下,并重命名为default.script,udhcp_cvs20050303.orig.tar.gz中也有这样的文件。修改ip没有成功!up-tech:/sbin#./udhcpc udhcpc(v1.15.3)started SettingIPaddress0.0.0.0oneth0 <1>/usr/share/udhcpc/default.script:line45:ifconfig:notfound Sendingdiscover... Sendingselectfor192.168.1.101... Leaseof192.168.1.10
7、1obtained,leasetime7200 SettingIPaddress192.168.1.101oneth0 <2>/usr/share/udhcpc/default.script:line45:ifconfig:notfound Deletingrouters <3>/usr/share/udhcpc/default.script:line45:route:notfound Addingrouter192.168.1.1 <4>/usr/sha
此文档下载收益归作者所有