Re: IP Addressing Problems: on my laptop shapj@us.ibm.com
Tue, 12 Jan 1999 16:04:21 -0500

>Hang on - no networking API has a notion of hosts _or_ interfaces. They
>have a notion of IP numbers, surely?

Yes, but the IP number is 1-1 with some particular interface.

>However, it seems the only query to obtain all of a host's API addresses
is
>to first obtain your own host name with either
>
> InetAddress.getLocalHost()
>or
> InetAddress.getByName(null)
>
>and then use that name in
>
> InetAddress.getAllByName(hostname)
>
>This is all perfectly sensible *if* a given host only has one hostname.
Is
>this true? Can a host associate different hostnames with different
>interfaces? If it does, should getAllByName() return only the IP
addresses
>associated with this hostname, or all the addresses associated with the
>host that has this name?

From the *outside*, a host may have multiple names, and these names may map to distinct IP addresses. This is exactly the situation in which a server may wish to say "bind port 80, but only on IP x.y.z".

From the *inside*, there is only one host. When you enumerate all of the IP addresses of a given machine, you get all of them without regard to host name.

The host name returned by 'getLocalHost()' is referred to as the "canonical" host name. There is only one per machine.

> If port numbers are being remapped as well, how can the Vat and
> VLS cooperate to figure out a port number by which others can contact the
> Vat's listen port?

They cannot. In general, under these conditions, the port number used by an outside connection must be different from the port number used by an internal connection. In practice, remapping of port numbers is rare, and is used for protocols like FTP that build a back connection.

>It seems to me that if A is currently talking to B and wants to be able
>to talk to B again in the future, then it is up to B to tell A how to do
>that... (e.g. "use domain name X" or "connect to port Y on IP Z")

In the face of proxies and firewalls, this is simply not in general possible. Preventing this is, to some degree, the whole *point* of a firewall.

It's also why a rash of products are now figuring out how to tunnel through HTTP. Prediction: pretty soon http will be disabled by all sensible firewalls.

shap