Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=6016706
By: lnxgnome
1) Enable SNMP read on the router in Configuration / Advanced / Device Management.
The "read community" is your password. Optionally, set the IP to that of the
machine running ddclient.
2) The machine running ddclient needs to have `snmpwalk` and `awk`. snmpwalk
can be found as part of the net-snmp package.
3) Add this to your ddclient.conf:
use=cmd, cmd="/usr/local/bin/get_external_ip_from_router
internal_hostname_or_IP_of_router"
4) Create the script file /usr/local/bin/get_external_ip_from_router and make
it executable. It should look like this:
#!/bin/bash
if [ "$1" == "" ]; then
exit 99
else
GW=$1
EXTIF=`snmpwalk -Ov -Oq -c public -v 1 $GW ipRouteIfIndex.0.0.0.0`
ENTRY=`snmpwalk -Os -Oq -c public -v 1 $GW ipAdEntIfIndex | awk '$2=='$EXTIF'
{ print $1 }'`
IP=${ENTRY/ipAdEntIfIndex./}
echo $IP
fi
5) test the script by running it from the commandline:
/usr/local/bin/get_external_ip_from_router internal_hostname_or_IP_of_router
example:
# /usr/local/bin/get_external_ip_from_router 192.168.1.1
221.221.123.101
If the script does not work, do you have a default/0.0.0.0 route to ipwan?
(it keys off of that)
6) stop/start ddclient
--LnxGnome
______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=399427
|