[Vm-dev] Finding ip address for eth0?

Bert Freudenberg bert at freudenbergs.de
Wed Aug 26 22:24:10 UTC 2009


On 27.08.2009, at 00:18, John M McIntosh wrote:

> Sure well
>
> NetNameResolver localHostName
> gives me
> 'Otter-2.local'
>
> then
>
> NetNameResolver addressesForName: 'Otter-2.local'
> gives me back a collection with 6 addresses, but you are saying for
> your machine you only get back 1 address?  Lucky you, but will your  
> production machine
> give back one address, or 23?
>
> I think here the problem is your machine is returning  
> 'localhost.localdomain'
> Oddly on os-x asking for NetNameResolver addressForName:  
> 'localhost.localdomain'
> gives you a primitive failure.
>
> Also as you saw, my localHostName is 'Otter-2.local' which is the  
> boujour name http://support.apple.com/kb/TA20999?viewlocale=en_US
>
> Maybe the question is does your computer have a DNS assigned name?


This machine has two interfaces (see below).

	NetNameResolver localHostName

gives

	'fedora10'

but

	NetNameResolver addressesForName: NetNameResolver localHostName

still only yields

	an OrderedCollection(127.0.0.1(fedora10),0(spr-itunes)-inet4-stream- 
tcp)

That does not sound right indeed.

- Bert -

[bert at fedora10 ~]$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:BF:6D:A7
           inet addr:172.16.22.154  Bcast:172.16.22.255  Mask: 
255.255.255.0
           inet6 addr: fe80::20c:29ff:febf:6da7/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:223095 errors:194711 dropped:0 overruns:0 frame:0
           TX packets:108938 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:179764576 (171.4 MiB)  TX bytes:76413825 (72.8 MiB)
           Interrupt:19 Base address:0x2024

lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:16436  Metric:1
           RX packets:38 errors:0 dropped:0 overruns:0 frame:0
           TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:6908 (6.7 KiB)  TX bytes:6908 (6.7 KiB)




More information about the Vm-dev mailing list