1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.1F.i">
<TITLE>The Answer Guy 35: Using A Dynamically Assigned Address from PPP Startup Script</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#3366FF" VLINK="#A000A0">
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<H4>"The Linux Gazette...<I>making Linux just a little more fun!</I>"</H4>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<center>
<H1><A NAME="answer">
<img src="../../gx/dennis/qbubble.gif" alt="(?)" border="0" align="middle">
<font color="#B03060">The Answer Guy</font>
<img src="../../gx/dennis/bbubble.gif" alt="(!)" border="0" align="middle">
</A></H1>
<BR>
<H4>By James T. Dennis,
<a href="mailto:answerguy@ssc.com">answerguy@ssc.com</a><BR>
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H4>
</center>
<p><hr><p>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif" height="50" width="60"
alt="(?) " border="0">Using A Dynamically Assigned Address from PPP Startup Script</H3>
<p><strong>From D. Kim Croft on Tue, 17 Nov 1998
</strong></p>
<!-- begin 19 -->
<P><STRONG>
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.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" alt="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
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
'<TT>/etc/ppp/ip-up</TT>' script. Reading the '<tt>pppd</tt>' man page
we find a couple of references to this file, which is
automagically called when the PPP session is established.
('<TT>/etc/ppp/ip-down</TT>' is called when the session is
terminated).
</BLOCKQUOTE>
<BLOCKQUOTE>
It's called with five parameters including:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE>
interface device speed your-IP their-IP
</BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
.. and there's an option to provide an additional,
admin specified parameter which can be set from your
options file.
</BLOCKQUOTE>
<BLOCKQUOTE>
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:
</BLOCKQUOTE>
<blockquote><pre> /usr/local/bin/update-my-web-page $4
</pre></blockquote><BLOCKQUOTE>
... 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 '<tt>rcp/rsh</tt>',
ksh (Kerberos '<tt>rsh</tt>') '<tt>ssh</TT>/<tt>scp</tt>'
or C-kermit or '<tt>expect</tt>/ftp'
connect and tranfer script that can automate the file
propagation process.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
thankyou
</STRONG></P>
<!-- end 19 -->
<!--startcut ======================================================= -->
<P> <hr> <P>
<H5 align="center"><a href="http://www.linuxgazette.com/ssc.copying.html"
>Copyright ©</a> 1998, James T. Dennis
<BR>Published in <I>The Linux Gazette</I> Issue 35 December 1998</H5>
<P> <hr> <P>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<TABLE WIDTH="96%"><TR VALIGN="center" ALIGN="center">
<TD ROWSPAN="3" COLSPAN="3" WIDTH="26%"><A HREF="../lg_answer35.html"
><IMG SRC="../../gx/dennis/answernew.gif"
ALT="[ Answer Guy Index ]"></A></td>
<TD WIDTH="14%"><A HREF="office.html">office</A></TD>
<TD WIDTH="14%"><A HREF="largedisk.html">largedisk</A></TD>
<TD WIDTH="14%"><A HREF="links.html">links</A></TD>
<TD WIDTH="14%"><A HREF="yamaha.html">yamaha</A></TD>
<TD WIDTH="14%"><A HREF="magickeys.html">magickeys</A></TD>
</TR><TR VALIGN="center" ALIGN="center">
<TD><A HREF="passwd.html">passwd</A></TD>
<TD><A HREF="ftproot.html">ftproot</A></TD>
<TD><A HREF="pvtmail.html">pvtmail</A></TD>
<TD><A HREF="netware.html">netware</A></TD>
<TD><A HREF="crypto.html">crypto</A></TD>
</TR><TR VALIGN="center" ALIGN="center">
<TD><A HREF="relay.html">relay</A></TD>
<TD><A HREF="project.html">project</A></TD>
<TD><A HREF="bootmethod.html">bootmethod</A></TD>
<TD><A HREF="sysadmin.html">sysadmin</A></TD>
<TD><A HREF="ipscript.html">ipscript</A></TD>
</TR><TR VALIGN="center" ALIGN="center">
<TD><A HREF="loopfs.html">loopfs</A></TD>
<TD><A HREF="mrtg.html">mrtg</A></TD>
<TD><A HREF="slimscan.html">slimscan</A></TD>
<TD><A HREF="rpm.html">rpm</A></TD>
<TD><A HREF="egg.html">modutil</A></TD>
<TD><A HREF="libc.html">libc</A></TD>
<TD><A HREF="dell.html">dell</A></TD>
<TD><A HREF="remoteroot.html">remoteroot</A></TD>
</TR></TABLE>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<A HREF="../lg_toc35.html"
><IMG SRC="../../gx/indexnew.gif" ALT="[ Table Of Contents ]"></A>
<A HREF="../../index.html"
><IMG SRC="../../gx/homenew.gif" ALT="[ Front Page ]"></A>
<A HREF="../lg_bytes35.html"
><IMG SRC="../../gx/back2.gif" ALT="[ Previous Section ]"></A>
<A HREF="../anderson.html"
><IMG SRC="../../gx/fwd.gif" ALT="[ Next Section ]"></A>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
</BODY></HTML>
<!--endcut ========================================================= -->
|