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 :
It is why 127.0.1.1 is returned by function getaddrinfo when it is called for name resolution of <ComputerName>