原文地址:http://blog.sina.com.cn/s/blog_5d0e8d0d0101553x.html
一、下载源码:
在 ,选中
dhcp-3.1-ESV-R3.tar.gz。
二、配置、编译
(1)解压 tar -zxvf dhcp-3.1-ESV-R3.tar.gz,然后进入dhcp-3.1-ESV-R3/目录下,
运行配置./configure
之后生成work.linux-2.2文件夹,进入work.linux-2.2/目录
输入make "CC=arm-linux-gnu-gcc -static"
(在此静态编译,以免发生命令找不到。当然可以动态编译,只要和你的文件系统用的库一致)
将在dhcp-3.1-ESV-R3/work.linux-2.2/client目录下编译生成dhclient。
三、移植到开发板
(1)拷贝生成的dhclient到FS2410开发板上,为方便使用,可以放在/usr/bin/或/sbin目录下;
执行命令:cp dhclient
/rootfs/filesystem/sbin
拷贝另外两个配置文件到开发板,分别是/dhcp-3.1-ESV-R3/client/dhclient.conf
/dhcp-3.1-ESV-R3/client/scripts/linux
到开发板的/sbin/目录下。并改名后一个文件为dhclient-script
执行命令:cp dhclient.conf
/rootfs/filesystem/sbin
cp linux
/rootfs/filesystem/sbin/dhclient-script
(2)并修改dhclient-script该文件的第一行#!/bin/bash 为#!/bin/sh,
(3)保存后修改权限 rootfs/filesystem$sudo chmod +x /sbin/dhclient*
四、测试
为eth0 或者wlan0配置dhcp服务,输入dhclient eth0 或者dhclient wlan0 即可,得到如下类似信息:
eth0:
Listening on LPF/eth0/08:90:90:90:90:90
Sending on LPF/eth0/08:90:90:90:90:90
Sending on Socket/fallback
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.1.1
eth0: link down
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
receive_packet failed on eth0: Network is down
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.1.1
DHCPACK from 192.168.1.1
bound to 192.168.1.108 -- renewal in 40380 seconds.
wlan0:
Internet Systems Consortium DHCP Client V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit
Listening on LPF/wlan0/00:60:b3:01:92:dc
Sending on LPF/wlan0/00:60:b3:01:92:dc
Sending on Socket/fallback
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.106 -- renewal in 41564 seconds.
阅读(1009) | 评论(0) | 转发(0) |