At 19:37 -0500 8/23/2001, Timothy A. Canon wrote:
>Thanks for the tip.  From the command line this works for me:
>
>/usr/sbin/ipconfig getifaddr en1


I don't agree here - this showed me an old ip address.

I used en0 instead to show my dynamic address assigned by dhcp...

Please advise.


                        Bohdan



>
>Now I just need to put it in a perl script.  A quick look on CPAN turned up 
>Sys::HostIP which was basically doing the same thing.
>
>Thanks,
>
>Tim
>
>On Thursday, August 23, 2001, at 04:50 PM, Craig S. Cottingham wrote:
>
>>On Thursday, August 23, 2001, at 04:36 , Justin Simoni wrote:
>>
>>>What I do (I use @home) which uses DHCP.  That fills in the IP addy for me, and 
>then I switch the network configuration  to 'Manual'  - I use the IP addy that I got 
>from the DHCP server and just lock it in!
>>>
>>>That way, you'll always have the same IP address and if you need to, you can just 
>hardcode that addy in any scripts you have!
>>>
>>>sneaky sneaky.
>>
>>Until your DHCP lease runs out and your IP address becomes invalid (or worse, is 
>handed out to another user), at which point it becomes "foolish foolish".
>>
>>A quick-and-dirty solution, compiled in Mail:
>>
>>      my $iface = 'en0';       # change to ppp0? if dialup?
>>      my $ip = undef;
>>      (`/sbin/ifconfig $iface` =~ /inet\s+(\d{1,3}(\.\d{1,3}){3})/) and ($ip = $1);
>>
>>--
>>Craig S. Cottingham
>>[EMAIL PROTECTED]
>>PGP key available from: 
><http://pgp.ai.mit.edu:11371/pks/lookup?op=get&search=0xA2FFBE41>
>>ID=0xA2FFBE41, fingerprint=6AA8 2E28 2404 8A95 B8FC 7EFC 136F 0CEF A2FF BE41

Reply via email to