Client Automation - IP Address inventoried as 127.0.1.1 on Linux Ubuntu
search cancel

Client Automation - IP Address inventoried as 127.0.1.1 on Linux Ubuntu

book

Article ID: 217497

calendar_today

Updated On:

Products

CA Client Automation - Asset Management CA Client Automation - IT Client Manager CA Client Automation

Issue/Introduction

On Linux Ubuntu, under Inventory/Network IP Address appears as 127.0.1.1

 

Environment

Client Automation - All Versions

Cause

AM Agent uses function getaddrinfo to do hostname resolution.
This function uses the file /etc/nsswitch.conf to check hostname resolution order.
 
On Linux Ubuntu the file /etc/nsswitch.conf contains this line :
 
hosts:          files mdns4_minimal [NOTFOUND=return] dns
 
So File /etc/hosts is used before dns for name resolution.
 
 
On Linux Ubuntu the file /etc/hosts contains :
 
127.0.0.1 localhost
127.0.1.1 <ComputerName>
 
It is why 127.0.1.1 is returned by function getaddrinfo when it is called for name resolution of <ComputerName>

Resolution

A solution is to change the host name resolution order in file /etc/nsswitch.conf
 
Change the line
hosts:          files mdns4_minimal [NOTFOUND=return] dns
by
hosts:          mdns4_minimal [NOTFOUND=return] dns files
 
 
This could be done in command line with :
 
cp /etc/nsswitch.conf /etc/nsswitch.conf.bck_$$ && sed -i 's/\(hosts:..*\) files\(..*\)/\1\2 files/g' /etc/nsswitch.conf
caf register all
 
 
This command creates a backup of file /etc/nsswitch.conf before.