I'm curious and I want to know all different methods for getting the IP address from a Linux box, I know ifconfig works well, but wondering if there are any other methods to use to obtain the ip address?
Tell me more
×
Server Fault is a question and answer site for
professional system and network administrators. It's 100% free, no registration required.
|
|
|||||
|
|
One way would be:
|
|||
|
|
|
To find the external IP of a box (behind a NAT firewall for instance) try this one-liner:
So useful and so quick! |
|||
|
|
|
The ip tool is quite handy and can give you a bunch of methods for IP address determination and much more. Quick exmaples:
|
|||
|
|
|
I've used
But honestly I shouldn't because this relies on the /etc/hosts file of the machine and not the actual IP address. |
||||
|
|
|
You can use ping if you know the network interface. (eth0, eth1, wlan0, etc.)
from 10.1.1.4
|
|||
|
|
|
The following command will list all IP addresses
The output from ifconfig does not always show secondary addresses on interfaces which do not have a named alias, such as those added by "ip addr add" |
|||
|
|
