Published: July 22, 2026
Read: 8 min
In: Technology & Development

Written by

Reviewed by

Last updated: July 16, 2023

Expert verified

SVG Image

TL;DR

To find the default gateway IP in Linux, you can try these methods:

  1. ip Command: Use the ip command in the terminal to quickly retrieve the default gateway IP in Linux.
  2. route Command: Utilize the route command in the terminal to find the default gateway IP by examining the routing table.
  3. nmcli Command: Leverage the nmcli command in the terminal to retrieve the default gateway IP for a specific network interface in Linux.
  4. GUI Method: Access the graphical interface to locate the default gateway IP in Linux easily.

To find the default gateway IP in Linux, you can follow these best practices: check the network configuration files, verify network adapter settings, consult distribution-specific documentation, utilize command-line tools effectively, and engage with the Linux community for assistance. Following these best practices will help you find the default gateway IP more accurately and efficiently.

Read the guide below to learn different methods to find the default gateway IP in Linux and the best practices to follow during the process.

The default gateway IP serves as the critical link connecting your Linux system to external networks, enabling seamless communication and data transfer. Whether you are troubleshooting network issues, configuring specific network settings, or seeking to optimize your network performance, discovering the default gateway IP will empower you with the knowledge and tools needed to navigate the vast landscape of Linux networking with confidence. In this comprehensive guide, I will walk you through various methods to find the default gateway IP in Linux and the best practices to follow when finding the default gateway IP.

How to Find the Default Gateway IP in Linux

To find the default gateway IP in Linux, utilize the versatile ip command or the powerful route command in the terminal. Alternatively, you can rely on the nmcli command to retrieve the default gateway IP for a specific network interface. If you prefer a graphical approach, the GUI provides a user-friendly interface to locate the default gateway IP.

1. ip Command

The ip command is a versatile tool for managing networking configurations in Linux. By utilizing the ip command, you can quickly obtain the default gateway IP without additional tools or configurations. This method works on most Linux distributions and is especially favored by command-line enthusiasts. Follow these steps to find the default gateway IP:

  1. Open a Terminal on your Linux system.
opening terminal 12
  1. Type the following command and press Enter:

<strong>ip route | grep default</strong>
  1. The output will display the default gateway IP address.
viewing default gateway using ip command

2. route Command

The route command is another powerful utility for managing routing tables in Linux. The route command provides a straightforward approach to retrieve the default gateway IP in Linux. It offers additional options and flags to handle more complex routing scenarios. To find the default gateway IP using this method, follow these steps:

  1. Access the Terminal window and enter the following command, and press Enter:

<strong>route -n</strong>
  1. Look for the line with the 0.0.0.0 destination or the default keyword. The default gateway IP will be listed in the Gateway column.
viewing gateway using route command

3.nmcli Command

When it comes to finding the default gateway IP for a specific network interface in Linux, the nmcli command proves to be an invaluable tool. Whether you are troubleshooting connectivity issues or configuring network settings for a specific interface, this method provides a concise and straightforward approach to obtaining the necessary information. Follow these steps:

  1. Launch the command prompt on your Linux system and run the following command: