in the file /etc/resolv.conf, we can assign IP address of DNS server with nameserver keyword. When the DNS query UDP packet is sent, kernel can know which interface this packet will go to. So, DNS setting for every interface has its meaning. I don't know how did the Windows system implement it, Where the DNS server information is stored? -----Original Message----- From: Glynn Clements [mailto:glynn.clements@virgin.net] Sent: Wednesday, November 20, 2002 3:09 PM To: Yuan Huailin-w19410 Cc: linux-net@vger.kernel.org Subject: RE: DNS for multi-interfaces host 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 <glynn.clements@virgin.net> - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html