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

Re: knowing my IP address behind NAT firewall



On Tuesday 31 May 2005 22:22, dexter2 wrote:
> Each time i connect to internet, i have diferent IP, that my ISP assign
> to me. If i want to know my IP, that i use on internet, I have to
> connect to DSL modem via HTTP and read it there.
> Is there a unix command, that will get my internet IP? How does this
> command get this IP?
> It must be posible, becouse Valknut is able to get my actual internet
> IP.

I don't want to encourage anyone to ask questions that can be found in other 
ways, *but*... :)

Since you asked, and I had wondered about this myself previously, I just 
worked it out (or, rather, stumbled across it).  The following works for me:

ping -c 1 hop www.google.com | grep 'bytes from' | cut -d ' ' -f 5 | cut -d 
'(' -f 2 | cut -d ')' -f 1

Since the ping manpage doesn't actually seem to explain what the hop keyword 
does, I'd love to know... :)

-- 
Lee.

Please do not CC replies directly to me.  I'll read them on the list.



Reply to: