"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, tag@lists.linuxgazette.net
Starshine Technical Services, http://www.starshine.org/


(?) Using A Dynamically Assigned Address from PPP Startup Script

From D. Kim Croft on Tue, 17 Nov 1998

I am trying to set up a script that, when I connect to the internet will write a little html file with a link to my ipaddress to upload to my web account on my isp. However my ip address is dynammically assigned so I never know exactly what it is. In windows I can netstat -rn to find it but,in linux when I netstat -rn i only get my ?router?. Anyways If you know of any way that I can find my ipaddress when I connect. it would be greatly apprecciated.

(!) Let's assume that you are using the Linux pppd package to establish this connection. In that case the most obvious method would be to call your script from the '/etc/ppp/ip-up' script. Reading the 'pppd' man page we find a couple of references to this file, which is automagically called when the PPP session is established. ('/etc/ppp/ip-down' is called when the session is terminated).
It's called with five parameters including:
interface device speed your-IP their-IP
.. and there's an option to provide an additional, admin specified parameter which can be set from your options file.
So you can write your script to just take the parameters you need (just the local IP address in this case) can call it with an entry in your ip-up script with a command like:
		/usr/local/bin/update-my-web-page  $4
... where 'update-my-web-page' is a shell, perl, awk, Python, TCL, or other script or program that opens a connection to your website's host and writes your page to it. (I'll assume that you have 'rcp/rsh', ksh (Kerberos 'rsh') 'ssh/scp' or C-kermit or 'expect/ftp' connect and tranfer script that can automate the file propagation process.

(?) thankyou


Copyright © 1998, James T. Dennis
Published in The Linux Gazette Issue 35 December 1998


[ Answer Guy Index ] office largedisk links yamaha magickeys
passwd ftproot pvtmail netware crypto
relay project bootmethod sysadmin ipscript
loopfs mrtg slimscan rpm modutil libc dell remoteroot


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]