Why server has two ip's

I am practicing in Ansible lab , why i am getting two ip’s when i use command hostname -i in every server (Ansible controller, server1, server2 )

  1. Ansible controller
[root@ansible-controller ~]# hostname -i
[root@ansible-controller ~]# date
Sun Mar 26 19:10:56 UTC 2023
  1. server1 (web1)
[root@web1 ~]# hostname -i
[root@web1 ~]# date
Sun Mar 26 19:11:34 UTC 2023
  1. server2 (web2)
[root@web2 ~]# hostname -i
[root@web2 ~]# date
Sun Mar 26 19:12:02 UTC 2023

Anyone please can explain this.

Hi @ahens000 ,

It’s because you have two interfaces attached to the machine and each refers to the same machine.

When you did cat /etc/hosts you can see there that each of these IPs is assigned to the same hostname
And you can verify the interface with the command : ip a

NB: The same machine can have multiple interface


1 Like