/etc/hosts order question


I have a SLES 15.1 vm and its /etc/hosts looks like localhost host1.com host1.com

When I ping host1.com it resolves to

My understanding is it should ping because it comes first. The ip of the server is (eth0) and the default route is from this network. How do we change this behavior? . On SLES 11 I do not see this issue.