3
0

sample.bound 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. # Sample udhcpc renew script
  3. RESOLV_CONF="/etc/udhcpc/resolv.conf"
  4. [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
  5. [ -n "$subnet" ] && NETMASK="netmask $subnet"
  6. ifconfig $interface $ip $BROADCAST $NETMASK
  7. if [ -n "$router" ]
  8. then
  9. echo "deleting routers"
  10. while route del default gw 0.0.0.0 dev $interface
  11. do :
  12. done
  13. metric=0
  14. for i in $router
  15. do
  16. if [ "$subnet" = "255.255.255.255" ]; then
  17. # special case for /32 subnets:
  18. # /32 instructs kernel to always use routing for all outgoing packets
  19. # (they can never be sent to local subnet - there is no local subnet for /32).
  20. # Used in datacenters, avoids the need for private ip-addresses between two hops.
  21. ip route add $i dev $interface
  22. fi
  23. route add default gw $i dev $interface metric $((metric++))
  24. done
  25. fi
  26. # Only replace resolv.conf if we have at least one DNS server
  27. if [ -n "$dns" ]
  28. then
  29. echo -n > $RESOLV_CONF
  30. [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
  31. for i in $dns
  32. do
  33. echo adding dns $i
  34. echo nameserver $i >> $RESOLV_CONF
  35. done
  36. fi