An IP address is a unique address that identifies a device on the internet or a local private network. Every computer in the network requires its own unique IP address to get identified. There are two different IP addresses: private and public.
A computer can be assigned private IPs or public IP or both.
Private IP is assigned to devices such as laptops, printers, phones for internal communication. If this machine needs to communicate outside the world then needs to use a router.
There are few commands available in Linux to find the IP address. The popular command is ip.
$ ip addr
- ip addr — Show information for all addresses
- ip addr show dev em1 — Display information only for device em1
There are few more commands which can display the private IP address of your system.
$ ifconfig
To use this command to find the IP address, just type “ifconfig -a” in the shell prompt.
This command will list all the network interfaces along with their details which include interface status, IP address, MTU size, etc.
If we are only interested in certain interfaces, eth0, etc. then: ifconfig eth0
reference:
Top comments (0)