成功移植DHCP客户端到mini2440

1,下载源码: ,选中 dhcp-3.1.3.tar.gz;

2,解压 tar -zxvf dhcp-3.1.3.tar.gz,然后进入./dhcp-3.1.3/,运行配置./configure,之后生成work.linux-2.2文件夹,进入work.linux-2.2/client/,输入make "CC=arm-linux-gcc -static",将编译生成dhclient。

3,拷贝生成的dhclient到mini2440开发板上,为方便使用,可以放在/usr/bin/下;拷贝另外两个配置文件到开发板,分别是

/dhcp-3.1.3/client/dhclient.conf和/dhcp-3.1.3/client/scripts/linux 到开发板的/sbin/目录下。并改名后一个文件为dhclient-script,并修改该文件的第一行#! /bin/bash 为#! /bin/sh,保存后,修改权限 chmod +x /sbin/dhclient-script。

4,为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 https://www.isc.org/software/dhcp/

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.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwfppw.html