I have 4 running eth ports on 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With