开发者

Linux hostname resolution on a machine with multiple running interfaces

I have 4 running eth ports o开发者_StackOverflow社区n my Linux machine (eth0 through eth3). So if i give the command host <hostname>, which eth port's ipaddress will be returned? how does linux decide which eth port's ip address to be returned?

Thanks, LinuxPenseur


host does not look at your local IPs, it looks up the hostname based on the rules specified in /etc/nsswitch.conf

In nsswitch.conf you will typically have this entry:

hosts: files dns

This means that the resolver will first check /etc/hosts, if it cannot find anything there it'll check /etc/resolv.conf and ask the specified DNS servers for the IP, optionally appending the "search" and "domain" suffixes specified in resolv.conf

See http://www.faqs.org/docs/linux_network/x-087-2-resolv.library.html


What's your "primary" interface? That one is used.

http://ubuntuforums.org/archive/index.php/t-1120370.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜