« Back to Networking: Frequently Asked Questions

How to see the default gateway on Linux

How to see the default gateway on Linux?

Use the ip command together with 'route' to see routing information, including the default gateway.

ip route

The ip command can help with discovering the default gateway on a Linux system.

List the routing table

Using the route subcommand, we can retrieve or configure routing information on the system. By just specifying this subcommand, the routing table will be displayed.

# ip route
default via 192.168.1.1 dev ens18 proto static 
192.168.1.0/24 dev ens18 proto kernel scope link src 192.168.1.150

The default gateway on this system is 192.168.1.1.

Learn more about ip

This article uses the ip command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: ip

ip cheat sheet

Other questions related to Networking

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon