Katsumi's Blog

"getent hosts" on IPv4/IPv6. Linux vs. Solaris

"getent hosts (server name)" is typically run when one wants to check whether /etc/nsswitch.conf is correctly set up.

I recently found differences between Linux and Solaris when it tries to find IPv4/IPv6 addresses.
I think these are the commands. The result may differ depending on whether the originating and target server has IPv4/IPv6 configured.

Linux IPv6 when target has IPv6 address assigned. If the target doesn't have IPv6, this shows IPv4.

$ getent hosts ipv6-test.com
2001:41d0:1:d87c::7e57:1 ipv6-test.com

Linux IPv4

$ getent ahosts ipv6-test.com STREAM ipv6-test.com
2001:41d0:1:d87c::7e57:1 STREAM

Solaris IPv6 when the originating server has IPv6 configured

$ getent ipnodes ipv6-test.com ipv6-test.com
2001:41d0:1:d87c::7e57:1 ipv6-test.com

Solaris IPv4

$ getent hosts ipv6-test.com ipv6-test.com

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.