[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to determine local IP



R. Brock Lynn [brock@cyberdude.com] wrote:
> John Hasler wrote:
> > 
> > Ramesh Natarajan writes:
> > > Hi, Once dialed in, how to determine the local (dynamically assigned) IP
> > > id? I know pppd invokes ip-up with the local IP. But outside that, is
> > > there a env variable, API or a file that holds returns this info?
> > 
> > Put a script in /etc/ppp/ip-up.d to write the IP to a file.
> 
> ifconfig does it for me.

I think John had it right.  Something like:

/etc/ppp/ip-up.d/getip
#!/bin/sh

echo $4 > /tmp/ip.num

and then in ~/.<shell>rc

alias ip='cat /tmp/ip.num'

Then, anytime you want the ip# you can either pull it from the file or use ip
to get it.  Perhaps if I knew what you wanted to do with the number I could
come up with a better way of having it at hand?

-- 
"What Arnon refuses to say, probably to stay in the good graces of
Microsoft, is that shaving offmost of NT may be the only way to make the
operating system stable enough to compete with Unix for running
high-availability applications."
				-- Robin Hohman, Network World, pg 24

Attachment: pgpiAnlYcE3SA.pgp
Description: PGP signature


Reply to: