blob: 842bafe916dceb2469b630b4abb6717019a7630a [file] [log] [blame]
Glenn L McGrath419eed72002-08-21 14:24:38 +00001#!/bin/sh
2# Sample udhcpc bound script
3
Russ Dill61fb4892002-10-14 21:41:28 +00004RESOLV_CONF="/etc/udhcpc/resolv.conf"
Glenn L McGrath419eed72002-08-21 14:24:38 +00005
6[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
7[ -n "$subnet" ] && NETMASK="netmask $subnet"
8
9/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
10
11if [ -n "$router" ]
12then
13 echo "deleting routers"
14 while /sbin/route del default gw 0.0.0.0 dev $interface
15 do :
16 done
17
Eric Andersen1aee3ff2004-10-13 07:18:05 +000018 metric=0
Glenn L McGrath419eed72002-08-21 14:24:38 +000019 for i in $router
20 do
Eric Andersen1aee3ff2004-10-13 07:18:05 +000021 /sbin/route add default gw $i dev $interface metric $((metric++))
Glenn L McGrath419eed72002-08-21 14:24:38 +000022 done
23fi
24
25echo -n > $RESOLV_CONF
26[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
27for i in $dns
28do
29 echo adding dns $i
30 echo nameserver $i >> $RESOLV_CONF
Russ Dill61fb4892002-10-14 21:41:28 +000031done