Linux Commands

How to Find the Default Route/Gateway Address of Linux

The default route (also known as gateway) is the IP address of the router that is responsible for routing the traffic to external networks. When an IP packet is destined for IP addresses that are not available in your local network or networks that are directly connected to your local network, the IP packet goes through the default route IP address. So, having the correct default route is essential for your Linux desktop/server operating system.

In this article, we will show you the different methods of finding the default route or gateway IP address on different Linux desktop/server operating systems.

This article works on the following Linux distributions:

  • Debian
  • Ubuntu
  • Linux Mint
  • Fedora
  • RHEL
  • Rocky Linux
  • CentOS
  • OpenSUSE
  • Kali Linux
  • Arch Linux
  • Manjaro, etc.

Topic of Contents:

  1. Finding the Default Route or Gateway Using the Ip Command
  2. Finding the Default Route or Gateway Using the Route Command
  3. Finding the Default Route or Gateway Using the Routel Command
  4. Conclusion

Finding the Default Route or Gateway Using the Ip Command

On most of the popular Linux distributions (i.e. Ubuntu/Debian/Linux Mint, Fedora, CentOS/RHEL/Rocky Linux), you can run the “ip” command as follows to find the default route or gateway IP address:

$ ip route

The default route or gateway IP address of your Linux distribution should be printed. In our case, the default route or gateway IP address is 192.168.189.2.

A screenshot of a computer Description automatically generated

Finding the Default Route or Gateway Using the Route Command

On most of the popular Linux distributions (i.e. Ubuntu/Debian/Linux Mint, Fedora, CentOS/RHEL/Rocky Linux), you can run the “route” command as follows to find the default route or gateway IP address:

$ ip route

The default route or gateway IP address of your Linux distribution should be printed. In our case, the default route or gateway IP address is 192.168.0.1. The default route/gateway has the destination address 0.0.0.0 as you can see in the following screenshot:

A screenshot of a computer Description automatically generated

Finding the Default Route or Gateway Using the Routel Command

To find the default route or gateway IP address of your Ubuntu/Debian desktop/server operating system, run the “routel” command as follows:

$ routel

The default route or gateway IP address of your Ubuntu/Debian desktop/server operating system should be printed. In our case, the default route or gateway IP address is 192.168.189.2.

Conclusion

In this article, we showed you how to use the “ip” and “route” commands to find the default route or gateway IP address of most of the popular Linux distributions (i.e. Ubuntu/Debian/Linux Mint, Fedora, CentOS/RHEL/Rocky Linux). We also showed you how to use the “routel” command to find the default route/gateway IP address of the Ubuntu/Debian desktop/server operating system.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.