What does "gateway" in routing table refer to?

What exactly does gateway in a route refer to? I know what a default gateway is- it's the route of last resort. But used in context of a host route (with destination specified), what is a gateway and why is it important?


Solution 1:

Quoting this excellent handbook,

A “route” is a defined pair of addresses: a “destination” and a “gateway”. The pair indicates that if you are trying to get to this destination, communicate through this gateway.

So, a gateway is any router (or routing host) through which packets pass (are sent) when trying to reach a given set of destinations.

Solution 2:

The gateway is the next hop in both default routing and host routing.

Since almost every interface has an address, it knows about its locally connected network and so the host needs no routing info as all stations on the same network are addressable.

Typically, only a default gateway is needed next, once the packet reaches the default gateway routing becomes someone else's problem.

But imagine a network with multiple exit points. Some may be faster than others. Some may be more expensive. Some may have administrative restrictions on traffic.

So, to route to a specific remote network or a specific remote host, the only thing the originating station needs to know is "where do I send the packet so it becomes someone else's problem". If there is more than one multihomed system ("router") then a decision must be made, for each destination host or network, which exact host on the local network will handle the packet after it leaves the originating interface.

Once again, a one-hop route is all that is needed. As you can see, the originating endpoint is not really in control of routing, except for the first hop. That's part of the magic of IP and the reason it has displaced all other networking technologies.