Ubuntu – Hostname -I spamming more than one IP address

command linenetworking

Sometimes I run

hostname -I

on my machine and got only one local IP returned like, but lately, there is occasions where I type it and got in return both

If I go to my router page and to traffic settings, I don't see this second IP connected to it. How can I go further to investigate what is exactly this other IP, if its related to some other program or even to a security problem?

Best Answer

hostname -I is synonymous to hostname --all-ip-addresses which means it will show all IP address of all interfaces (except loopback).

In my computer, i have three configured interfaces (one is my physical (bridge) interface, one virtual interface for lxc and one virtual interface for docker), hence it shows:

% hostname -I 

From man hostname:

-I, --all-ip-addresses Display all network addresses of the host. This option enumerates all configured addresses on all network interfaces. The loopback interface and IPv6 link-local addresses are omitted. Contrary to option -i, this option does not depend on name resolution. Do not make any assumptions about the order of the output.