On 13-Dec-2010, at 16:14, Dan Shoop wrote:
> 
> On Dec 11, 2010, at 3:08 PM, Levan, Jerry wrote:
>> 
>> It turns out that it is not hard to get the Airport Extreme Base Station 
>> external address:
>> 
>> [mbp:]$ snmpwalk -Ov -OQ -c public router ipAdEntAddr
>> 76.177.12.46
>> 127.0.0.1
>> 127.0.0.2
>> 169.254.162.44
>> 192.168.1.1
> 
> This isn't your WAN IP address at all, it's a list of all VNICs that the 
> Airport currently has. 
> 
>> The smnpwalk command above grabs a part of the ipAddr table which lists info 
>> on all
>> ip addresses assigned to the machine.
> 
> As a "list" it is an unordered data structure and you can't simply say the 
> first one will always be the WAN IP address. 

But it is trivial to grep out the self-assigned, loopback, and LAN IP ranges 
which is going to leave you with the external IP.

snmpwalk -Ov -OQ -c public router ipAdEntAddr | grep -v "127.0.0.1" | grep -v 
"^192.168" | grep -v "^169.254"

(where you replace ^192.168 with whatever the LAN IP block you're using is.

>> The second two addresses are a bit of mystery to me but they are certainly 
>> not the external address
> 
> This statement demonstrates a significant lack of understanding of basic IP 
> fundamentals. 

It certainly doesn't bode well.

> $ perl -e '$ip=`curl -s http://www.whatismyip.com/automation/n09230945.asp`; 
> print "$ip\n";'
> 123.123.123.123
> 
> DOES provide the correct and proper answer. Your solution does not. 

This is similar to what I use when I don't use dyndns.

links -dump http://checkip.dyndns.org | awk '{print $4}' 

This has worked for years.

-- 
'Dojo! What is Rule One?' Even the cowering challenger mumbled along to
the chorus: 'Do not act incautiously when confronting little bald
wrinkly smiling men!' 

_______________________________________________
MacOSX-admin mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-admin

Reply via email to