分类: LINUX
2014-02-20 19:57:29
原文地址:移植dhcp到arm 作者:pxues
下载Download the latest version (includes client): (43k) 31 Oct, 2002
在KERNEL中需要将 Packet socket和IP: DHCP support编译进内核或编译成模块.
DHCP服务器端:(编译器2.95.3)
1. 修改Makefile: 添加: CROSS_COMPILE=arm-linux-
2. #make , 把生成的dhcpd文件下载到板子上.
make LDFLAGS="-static"
使用/usr/local/arm/2.95.3/bin/arm-linux-strip处理一下,
3. #cp samples/udhcpd.conf /etc/ #copy udhcp/samples下的文件到目标板子的 /etc目录
4. # vi /etc/udhcpd.conf: 修改如下:
3 # The start and end of the IP lease block
4
5 start 192.168.1.20 #default: 192.168.0.20 为 winXP的ip地址范围
6 end 192.168.1.25 #default: 192.168.0.254
9 # The interface that udhcpd will use
10
11 interface wlan0 #default: eth 0#目标板子上的无线网卡wlan0
85 #Examles
86 opt dns 222.201.130.30 222.201.130.33 #dns服务器
87 option subnet 255.255.255.0
88 opt router 192.168.1.10 #wlan的 ip地址,做为网关地址
89 #opt wins 192.168.10.10 #注释掉
90 option dns 192.168.1.10 # appened to above DNS servers for a total of 3
91 option domain local
92 option lease 864000 # 10 days of seconds
5 # ./dhcpd //运行dhcpd服务器
6 .设置内网winXP主机的无线上网方式为自动获取ip地址
下面是dhcp客户端的,
在编译Busybox时把 Networking Utilities下udhcp Server/Client中的 udhcp Client (udhcpc)选上。
关键点要把examples/udhcp/simple.script 脚本文件做为default.script拷贝到/usr/share/udhcpc/default.script
运行udhcpc
~ # udhcpc
udhcpc (v1.5.1) started
Sending discover...
Sending select for 59.64.134.99...
Sending select for 59.64.134.99...
Sending select for 59.64.134.99...
Lease of 59.64.134.99 obtained, lease time 10800
deleting routers
route: SIOC[ADD|DEL]RT: No such process
adding dns 211.68.71.4
adding dns 211.68.71.5
adding dns 202.106.196.115
adding dns 202.106.0.20