Твой хороший знакомый (maximum_value) wrote in unix_solution,
Твой хороший знакомый
maximum_value
unix_solution

DHCP Hook for static-routes

Script for applying static-routes from DHCP server.

Script must be placed in '/etc/dhcp3/dhclient-exit-hooks.d/'
(for example: /etc/dhcp3/dhclient-exit-hooks.d/configure_static_routes)

Was tested in Ubuntu 8.04.1

#!/bin/sh

function process_routes() {
  while [ $# -gt 1 ]
  do
    dest=$1
    gateway=$2
    shift; shift
    route add $dest gw $gateway
  done
}

if [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]
then
  echo "static_routes = $new_static_routes"
  process_routes $new_static_routes
fi

Tags: dhcp, linux, ubuntu
Subscribe

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments