I am using WVDial to establish a PPP connection with my ISP. I am looking
to do two things.
I would like to know if WVDial or PPPd allows me to run a script after the
connection is established and the dynamic (yuck!) IP address is negotiated.
What I need to do is run a file that sets my ipchains AFTER the connection
is established, as ipchains will fail if it cannot resolve the domain names
listed in the ipchains rules.
Any ideas?
On a second note, I am looking for some way (either immediately after the
connection is established or after an 'x' [unknown time]) to capture my
dynamic IP address into a system variable for later parsing.
Anybody able to assist?
Helpful emails only -- g...@mediaone.net ... Flames can be directed to
/dev/null
Thanks,
Gregg
In the directory /etc/ppp there are several scripts, which will be startet
during connection. The script "ip-up" will set up your correct environment
for your ISP. And at the end, the existance of the script ip-up.local will
be checked. If it exists, it will be started. Within this script you can put
in, what you want. There are also 5 arguments which will be explained in
ip-up. There is a simple reason, why using the way through ip-up.local:
Within SuSE-Updates, the basescript (ip-up) will be overritten.
My suggestion is:
Copy ip-up to ip-up.local (or use my script as example),
"ln -s ip-up.local ip-down.local".
Modify ip-up.local to your needs (with ip-up.local and ip-down.local!
This works very well. I'm starting and stopping my firewall, and fetching my
news.
This is my ip-up.local:
--------
!/usr/bin/bash
BASENAME=`basename $0`
INTERFACE=$1
DEVICE=$2
SPEED=$3
LOCALIP=$4
REMOTEIP=$5
if [ -z "$REMOTEIP" ]; then
echo "Usage: $0 <INTERFACE> <DEVICE> <SPEED> <LOCALIP> <REMOTEIP>"
exit 1
fi
case "$BASENAME" in
ip-up.local)
echo "Setting up firewall ..."
/etc/firewall start | logger -t firewall
echo "Fetch news articles ..."
/usr/sbin/fetchnews
echo "Fetch news articles done!"
;;
ip-down.local)
echo "Shutting down firewall ..."
/etc/firewall stop | logger -t firewall
;;
*)
;;
esac
--------
Within this script, you can also write the content of $LOCALIP to a file.
Hope it helps.
Andreas
--
GnuPG ID : 74772303
Fingerprint: 7183 A83C C582 040A 40CA F985 2C4C 19B8 7477 2303