Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 May 1999 00:17:26 GMT
From:      alantrulock@erols.com (Alan Trulock)
To:        jim@blues.ghis.net
Cc:        "Michael G." <mikegoe@ibm.net>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Dynamic IP address
Message-ID:  <373b185a.71928112@smtp.erols.com>
In-Reply-To: <19990513093108.E57394@blues.ghis.net>
References:  <99051219000900.00342@Nikki.ibm.net> <19990513093108.E57394@blues.ghis.net>

next in thread | previous in thread | raw e-mail | index | archive | help
How about

echo `ifconfig tun0 | tail -1 | awk '{print $2}'`

or write it to a file

echo `ifconfig tun0 | tail -1 | awk '{print $2}'` > /etc/myip

or do this and use it in a script

setenv MYIP `ifconfig tun0 | tail -1 | awk '{print $2}'`


--Alan


On Thu, 13 May 1999 09:31:08 +1000, you wrote:

>On Wed, 12 May 1999 at 18:58:00 -0400, Michael G. wrote:
>> I checked the archives ..but couldn't find this answer...
>>=20
>> How can I check what my current IP address when I log into my
>> ISP...as it is dynamically allocated at connection?   arp didn't
>> seem to get me anywhere because I don't know what my machine is
>> called???...from the outside...
>
>Try 'netstat -rn'.  It'll give you something like this..
>
>[jim@blues:~]$ netstat -rn
>Routing tables
>
>Internet:
>Destination        Gateway            Flags     Refs     Use     Netif
>Expire
>default            203.37.7.2         UGSc       11        0     tun0
>127.0.0.1          127.0.0.1          UH          0    41002      lo0
>203.37.7.2         203.37.48.130      UH         12        0     tun0
>                   ^^^^^^^^^^^^^ that should be your ip
>
>Also, 'ifconfig tun0' will provide it as well..
>
>[jim@blues:~]$ ifconfig tun0
>tun0: flags=3D8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
>        inet 203.37.48.130 --> 203.37.7.2 netmask 0xffffff00=20
>        ^^^^^^^^^^^^^^^^^^ that's your ip
>
>Hope this helps,



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?373b185a.71928112>