RE: DNS for multi-interfaces host

From: Glynn Clements (
Date: Wed Nov 20 2002 - 02:08:41 EST

Yuan Huailin-w19410 wrote:

> > > In windows OS, we can set DNS for TCP/IP of every
> > > connection(interface).
> >
> > > For example, I have 2 ethernet interfaces which connect to 2
> > > different private network, I can set DNS for each of them.
> >
> > By "DNS", do you mean "DNS server"? If so, the above doesn't make any
> > sense. What determines which interface (and hence, which server) is
> > chosen when you perform a DNS query?
> Yes, I mean DNS server.
> This bring another question, When network application want to connect
> a host, how does it choice the interface?

Once it has resolved the hostname to an IP address, it uses connect()
to connect to that IP address. The kernel will choose the appropriate
interface by looking up the destination IP address in the routing
table. However, the decision can't be made until the hostname has been
resolved to an IP address.

Similarly, whilst you could choose the DNS server to which a query is
sent based upon a number of factors, clearly you can't base the choice
upon the IP address which that query will ultimately return because
you don't know the result until after you have sent the query.

Glynn Clements <>
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to
More majordomo info at

This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:00 EST