How To Get Linux Network IP Address In Different Ways ?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-get-linux-network-ip-address-in-different-ways/
PINTEREST
PINTEREST
INSTAGRAM

We can determine Linux system IP address in different ways. IP address is used to communicate over network and can be get and set in different ways. In this tutorial we will use Ubuntu distribution but given examples and commands will work for all of the different Linux distribution like Fedora, CentOS, Debian, Kali, Mint, RHEL etc.

Hostname Command IP Address

hostname command is mainly used to show or set the system’s host name. But it also provides the IP address of the current system. We will use -I option for this. This will list all interface IP addresses.

Hostname Command IP Address
Hostname Command IP Address

Ifconfig Command IP Address

ifconfig command is very popular and old command used to manage network related configuration in Linux operating system. We can use ifconfig command easily to get IP address.

Ifconfig Command IP Address
Ifconfig Command IP Address

This command provides IP addresses line by line. We have also used awk and cut command in order to filter IP address.

If we want to list all interfaces we can use only ifconfig command like below.

Ifconfig Command IP Address
Ifconfig Command IP Address

Show Specific Interface IP Address with ifconfig Command

We may need to list only specified network interface IP address. So we can specify the name of the interface to the ifconfig  command. In this example we will list IP address of network interface named ens33 .

Show Specific Interface IP Address with ifconfig Command
Show Specific Interface IP Address with ifconfig Command

Ip Command IP Address

ip command is newer network management command provided by most of the Linux distributions. We can use addr option with show subcommand to list IP addresses.

LEARN MORE  How To Install VMware Tools To The Linux Debian, Ubuntu, Kali, Mint, Fedora, CentOS, RHEL Distributions

Ip Command IP Address
Ip Command IP Address

As we can see the netmask information also provided.

We can also list all related information without filtering the ip addr command output.

Ip Command IP Address
Ip Command IP Address

Show Specific Interface IP Address with ip Command

As examined previously with  ifconfig  command we can also look specific interface IP address with ip address show command like below. We will just specify the network interface name which is ens33 and dev  option in this example.

Show Specific Interface IP Address with ip Command
Show Specific Interface IP Address with ip Command

Public, WAN or Internet Address

As most of the networks uses private IP address range we may need our real or public IP address which is used in the internet. There are different web services those provides our IP address in a HTTP request. Here is some of them.

Public, WAN or Internet Address
Public, WAN or Internet Address

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-get-linux-network-ip-address-in-different-ways/
PINTEREST
PINTEREST
INSTAGRAM