udhcpc용 default.script
임베디드 2011. 12. 6. 11:14
#!/bin/sh
# Sample udhcpc renew script
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ]
then
echo "deleting routers"
while /sbin/route del default gw 0.0.0.0 dev $interface
do :
done
metric=0
for i in $router
do
/sbin/route add default gw $i dev $interface metric $((metric++))
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
for i in $dns
do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
# Sample udhcpc renew script
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ]
then
echo "deleting routers"
while /sbin/route del default gw 0.0.0.0 dev $interface
do :
done
metric=0
for i in $router
do
/sbin/route add default gw $i dev $interface metric $((metric++))
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
for i in $dns
do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
작성 후 실행 권한을 주어야한다.
실행 명령
# udhcpc -i eth0 -s /usr/share/udhcpc/default.script
백그라운드로 3회 재시도 후 종료
# uchcpc -i eth0 -s /usr/share/udhcpc/default.script -nq -t 3
'임베디드' 카테고리의 다른 글
[s3c6410] SDL_ttf Cross Compile (0) | 2011.12.07 |
---|---|
yaffs2 이미지 만들기 (0) | 2011.12.06 |
[h7210] H-Jtag 설정하기 (0) | 2011.11.08 |
[임베디드] ramdisk 이미지 만들기 (0) | 2011.10.17 |
usec( Microsecond ), ms(millisecond) (0) | 2011.10.12 |