转载自CSDN博客:https://blog.csdn.net/openswc/article/details/51678946
udhcpd配置及使用
基于mips芯片qca953x平台;
今天测试板子wifi无线连接的时候,手机端怎么也连接不上,连上wifi后手机端立即就闪断了,后面发现原因是无线路由开发板没有开启dhcp服务器,手机端获取不到ip地址,下面来讲下busybox的dhcp服务器udhcpd的使用及配置。
1.使用原始的udhcpd配置文件/etc/udhcpd.conf启动dhcp服务器udhcpd,结果出现以下错误
~ # udhcpd /etc/udhcpd.conf &
info, udhcpd (v0.9.9-pre) started
error, max_leases value (254) not sane, setting to 234 instead
error, Unable to open /var/lib/misc/udhcpd.leases for reading
error, SIOCGIFADDR failed, is the interface up and configured?: No such device
原始的/etc/udhcpd.conf文件内容,部分省略,省略部分采用原来的默认配置:
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 192.168.1.20 #default: 192.168.0.20
end 192.168.1.254 #default: 192.168.0.254
# The interface that udhcpd will use
interface ixp0 #default: eth0
# The maximim number of leases (includes addressesd reserved
# by OFFER's, DECLINE's, and ARP conficts
#max_leases 254 #default: 254
修改后的/etc/udhcpd.conf文件内容,部分省略,省略部分采用原来的默认配置:
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 192.168.1.20 #default: 192.168.0.20
end 192.168.1.254 #default: 192.168.0.254
# The interface that udhcpd will use
interface br0 #default: eth0 --- 解决error, SIOCGIFADDR failed, is the interface up and configured?: No such device
# The maximim number of leases (includes addressesd reserved
# by OFFER's, DECLINE's, and ARP conficts
max_leases 234 #default: 254 --- 解决error, max_leases value (254) not sane, setting to 234 instead
解决error, Unable to open /var/lib/misc/udhcpd.leases for reading,在板子上执行以下命令:
# mkdir -p /var/lib/misc/
# touch /var/lib/misc/udhcpd.leases
2.再次启动udhcpd进程
# udhcpd /etc/udhcpd.conf &
然后手机重连板子的wifi,手机获取到ip地址后,wifi无线连接成功。
---------------------
作者:openswc0
来源:CSDN
原文:https://blog.csdn.net/openswc/article/details/51678946
版权声明:本文为博主原创文章,转载请附上博文链接!