分类: WINDOWS
2011-05-17 10:35:05
WiFi Card 使用 DHCP client 设置问题
1. Busybox里有个工具叫udhcpc,专门用来dhcp client设定问题,使用方法如下:
(注意:必须在路由器开通DHCP服务并配置好DNS信息。)
udhcpc -b -i eth1
======================================================================
#
# udhcpc -b -i eth1
udhcpc (v1.13.4) started
Sending discover...
Sending select for 192.168.56.100...
Lease of 192.168.56.100 obtained, lease time 7200
deleting routers
route: SIOCDELRT: No such process
adding dns 192.168.0.126
adding dns 192.168.0.111
#
================================================================================
2. 使用时要设定一下udhcpc的配置文件(我这里要修改ifconfig路径),文件内容如下:
/root/rootfs/mnt/sysfs/udhcpc/default.script
#!/bin/sh
# udhcpc script edited by Tim Riker
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
deconfig)
/bin/ifconfig $interface up
;;
renew|bound)
/bin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ] ; then
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
metric=0
for i in $router ; do
route add default gw $i dev $interface metric $((metric++))
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
;;
esac
exit 0
================================================================================