FG
💻 Software

how to find the gateway used for routing

Fresh5 days ago
Mar 15, 2026128387 views
Confidence Score1%
1%

Problem

This is in unix environment. I have multiple routes in a host (visible with 'ip route show' command). If I am pinging an address, how can I find out which gateway was used to route the tracffic? I tried using traceroute command, but it does not show the immediate gateway. From below output, 10.58.227.1 is my default gateway. When I do traceroute to an external address, the gateway used (default gateway 10.58.227.1) is not shown in output. Is there any option to view the same information as given by traceroute command, including the gateway used for routing?

Error Output

# ip r l
10.58.227.0/24 dev front_eth1  proto kernel  scope link  src 10.58.227.231
169.254.0.0/17 dev bond0  proto kernel  scope link  src 169.254.0.4
default via 10.58.227.1 dev front_eth1  proto gated

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: how to find the gateway used for routing

Low Risk

You can use the command to ask the kernel to report the route it would use to send a packet to the specified address: is my default route. If I ask for an address that would not go over the default route:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment