Guest User

udhcpc-wan2.script by JMVS

a guest
May 2nd, 2012
668
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. # udhcpc script edited by Tim Riker <Tim@Rikers.org>
  3. # udhcpc script edited by JMVS
  4. [ -z "$1" ] && logger "$0 ERROR: should be called from udhcpc." && exit 1
  5.  
  6. ifconfig $interface up
  7.  
  8. RESOLV_CONF="/etc/resolv.conf"
  9. [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
  10. [ -n "$subnet" ] && NETMASK="netmask $subnet"
  11.  
  12. case "$1" in
  13.     deconfig)
  14.         /sbin/ifconfig $interface 0.0.0.0
  15.     ;;
  16.  
  17.     renew|bound)
  18.         logger "$0: $ip $BROADCAST $NETMASK"
  19.         echo -n > $RESOLV_CONF
  20.         [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
  21.         for i in $dns ; do
  22.             nvram set wan2_ifname=$interface
  23.             nvram set wan2_gateway=$router
  24.             nvram set wan2_ipaddr=$ip
  25.             nvram set wan2_netmask=$subnet
  26.             nvram set wan2_broadcast=$broadcast
  27.             nvram commit
  28.             ifconfig $(nvram get wan2_ifname) $(nvram get wan2_ipaddr) netmask $(nvram get wan2_netmask) up
  29.         done
  30.     ;;
  31. esac
  32. exit 0
RAW Paste Data