Am trying to add a script which will get executed on DHCP ip change for a particular interface. for that I have copied the below script at "/etc/dhcp/dhclient.d/dhcp-hook.sh". I need to get router IP whenever dhcp renew/bound happens in order to add route via that ip. Can someone suggest how do I get router ip info in "dhcp4-change" event, $DHCP4_routers_IP_ADDRESS in the below case. The script looks like below, table uplink1 is already populated. Just need to know how to get the router ip.
1 #! /bin/sh 2 3 interface=$1 status=$2 4 5 if [ "$status" != "dhcp4-change" -o 6 $interface != $UPLINK1 ]; then 7 return 8 fi 9 if [ $interface = $UPLINK1 ]; then 10 if [ -n $DHCP4_routers_IP_ADDRESS ]; then 11 ip route add default via $DHCP4_routers_IP_ADDRESS table uplink1 12 fi 13 fi