----- Original Message -----
From: "Thomas Tomiczek" <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 09:49
Subject: Re: Finding out the IP-Address of a PC


>Ok, lets turn this around.

>You have computer running an internal NIC, no DNS configured, and an
>external one - from your provider. You log into the internet.

Ignore all the things like InternetGetConnectedState(), unless they are
probing a dialup connection, they are often wrong...they assume no traffic
means no net, but on a home lan there often is no traffic.

>Will you get both IP addresses using GetHostByName?

probably. yes. one will be a made up addr in the 169. range usually, the
valid one not.

I discard the 169.* addrs; view that as probably invalid. Unless you are on
a home network where made up addresses actually work, but I assume home
networks have DHCP from somewhere. I also chuck anything all zeros; and
favour 10.* and 192.168.* below any other address we have had.

> Is actually your.DnsHostName valid?

Often never.

 a) maybe no DNS at all
 b) system may construct something from the hostname "stelvio" and the
domain "attbi.com", come up with a name "stelvio.attbi.com" that doesnt
resolve. It has a resolvable name when the machine is at work, but but not
at home.

You CANNOT trust dns


>What about when you are NOT connected to the internet and run this on
>one of this automated networks?

What do you mean by automated network? One behind a firewall? One completely
isolated? Or a VPN.

If the thing is on a net, you can probe for remote sites being available.
But on some network types, even those that look like a LAN, that can trigger
a pay-per-use connection being made, which makes users unhappy. ISDN in the
UK, some of the wireless stuff falls into this category.




VPNS complicate the mix more. Taking a look at an example config we have

Windows IP Configuration

        Host Name . . . . . . . . . . . . : Stelvio
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

>10/100T, no media, enum does not produce any useful info at all.

Ethernet adapter Local Area Connection 2:

        Media State . . . . . . . . . . . : Media disconnected
        Description . . . . . . . . . . . : 3Com Megahertz 10/100 LAN
CardBus P
 Card
        Physical Address. . . . . . . . . : 00-00-86-3A-4B-94


>not a real card, an ipsec device driver. This one will enum when you list
hostnames, you have to discard it when all zero, cos it means it is not
there

Ethernet adapter {9CF134F9-E3EA-4CE6-9673-60DF7ED4872E}:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : Nortel IPSECSHM Adapter - Packet
Sc
eduler Miniport
        Physical Address. . . . . . . . . : 44-45-53-54-42-00
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 0.0.0.0
        Subnet Mask . . . . . . . . . . . : 0.0.0.0
        Default Gateway . . . . . . . . . :


>aah, we have a network here

Ethernet adapter lucent card:

        Connection-specific DNS Suffix  . : steveshome
        Description . . . . . . . . . . . : ORiNOCO PC Card (5 volt)
        Physical Address. . . . . . . . . : 00-02-2D-00-56-51
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 192.168.2.21
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.2.1
        DHCP Server . . . . . . . . . . . : 192.168.2.1
        DNS Servers . . . . . . . . . . . : 192.168.2.1
        Lease Obtained. . . . . . . . . . : Saturday, April 20, 2002
20:11:08
        Lease Expires . . . . . . . . . . : Saturday, May 04, 2002 20:11:08

its in the 192.168 dont route properly domain, but it isnt a 169.* number so
is probably ok, just behind a NAT (or two, in this case) But rdns wont work;
there are no DNS servers in the subnets, and nothing outside will find it.
Or, if it does it will translate to 12.somethingorother, which is the single
visible point to the outside world; eiger.dnsalias.com, but the latop knows
nothing.


FFI, see http://www.iseran.com/Steve/papers.html;
Towards an Adaptive and Context Aware Laptop and The Secret Life of
Notebooks,

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to