How To Check Default Gateway Or Router IP Address In Linux?
 

How To Check Default Gateway Or Router IP Address In Linux?

 

A large network like the internet can have multiple smaller interconnected networks. A gateway is a network node or point which serves as the access point to another network. All your traffic first goes to the router and then to the rest of the internet.

There are various ways to find gateway or router IP address in Linux a few of them are discussed here in this article.

How to find default gateway or router IP using IP command

The ip command is a very useful tool to configure network interfaces. We will use this command here to display the default gateway or router IP address.

Open your terminal and run the following command –

ip r

or you can use –

ip route

As you can see in the output of this command the IP address 192.168.122.1 is the default gateway or router IP address which is given in the first line.

Find default gateway using the route command

The route command is used to display and manipulate the IP routing table. You can use the option -n with the route command to display the default gateway. Before using this command you may need to install the net-tools package in some Linux distributions.

Use the following command to install it –

sudo apt install net-tools

After installing net-tools, run the following command –

route -n

See the output of this command the UG in the flag column corresponding to the IP address 192.168.122.1 means up(U) and gateway(G). The IP address 192.168.122.1 is the default gateway or the router IP address.

Find default gateway using netstat command

The netstat command is used to monitor the network connections also it is used to displays the routing tables, interface statics, etc. This tool is available for various operating systems including Windows.

Now use the -rn options with netstat command to display the default gateway or router IP  –

netstat -rn

The UG given in the first line of flags column means up and gateway and the IP 192.168.122.1 is the default gateway or router IP address.

Conclusion

By using any one of the given commands you can easily find the default gateway or router IP. Now if you have any queries on this you can write to us in the comments below.

Previous [lubuntu] Touchpad tap not wokring
Next Ubunut 20.04 Auto Install Encrypt Drive
 

About author

You might also like

Linux Topics 0 Comments

Using Sed, A Stream Editor In Linux/Unix

This post was last updated on August 3rd, 2020 at 02:42 pmSed stands for stream editor It was based on the scripting feature of ed(a line based interactive text editor

Linux Topics 0 Comments

Different Types Of Processes In Linux Or Unix?

This post was last updated on August 1st, 2020 at 12:09 pmIn a Unix-like operating system, a process is a program in execution. Kernel identifies a process with a unique

Linux Topics 0 Comments

How To Split A Large File Into Multiple Smaller Files In Linux/Unix?

This post was last updated on August 1st, 2020 at 12:32 pmSuppose you have an archive file of size more than 5GB, and if you want to burn it on

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply