15 C
Texas
Muhammad Nabeel
Network and System Administrator

How to Find IP and Gateway in Linux

What is IP Address?

An Internet Protocol address (IP address) is a unique identifier assigned to each device connected to a computer network that uses the Internet Protocol for communication. The IP address space is managed globally by the Internet Assigned Numbers Authority (IANA).

Their are two versions of IP address, IP Version 4 (IPv4) it uses just 32 bits and IP Version 6 (IPv6) uses 128 bits.

What is Gateway?

- Advertisement -

A gateway is the network node using the internet protocol suite that serves as the forwarding host to other networks. It allows one computer to send information to a computer in another network or the internet.

In this article you will learn that how to see server IP address and its default gateway.

How to find IP Address in Linux?

Find Private IP address:

Use one of following commands to check your machine Private IP address.

ip a

OR

ifconfig

So, In result you will get your private IP address. examples are in above images. But what if you want want to see your Public IP address

Find Public IP Address:

So, If you want want to see your Public IP address use following command.

curl ifconfig.me

How to Find Gateway in Linux?

Above you have read about Gateway address, now we will discuss that how we can see our server’s gateway.
to do so, simple run one of following commands and you will get result on your screen.

ip route

OR

ip route | grep default

OR

route -n

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article