Computer Networks

Gateway

A node that translates between networks or protocols — often just 'the router'.

Level: beginner

What is it?

A gateway is a node or service that provides a path to another network or translates between protocols or address spaces. In everyday IP host configuration, “default gateway” usually means the router used for destinations outside directly connected routes.

Why does it matter?

The term is overloaded. Knowing whether a gateway is a next-hop router, an application proxy, or a protocol translator makes troubleshooting and security boundaries clearer.

Mental model

A default gateway is the local exit door for packets bound elsewhere. An application gateway may do more: terminate one protocol, inspect a request, and create a separate connection on the other side.

How it works

  • A default gateway is selected by the IP routing table for nonlocal destinations when no more specific route wins.
  • An application gateway/proxy may terminate and recreate connections, enabling authentication or content inspection.
  • A gateway may perform NAT, but NAT is a separate address/port translation function.
  • Hosts need a route and link-layer reachability to the gateway before packets can leave the local network.
  • Gateway health affects downstream connectivity even if the local LAN itself is working.

Steps

  • A host checks whether the destination matches a connected prefix.
  • If not, it selects an applicable route whose next hop is a gateway.
  • It resolves the gateway's local MAC address (for IPv4 Ethernet) and sends the frame there.
  • The gateway forwards or translates traffic according to routes and configured policies.

Real-world usage

  • Debugging why a host reaches local peers but not remote networks.
  • Distinguishing proxy gateways, default routers, and protocol translators.

Common mistakes

  • Assuming a default gateway performs DNS resolution.
  • Treating every device called a gateway as the same OSI layer or function.
  • Assuming a valid gateway address guarantees an upstream route or internet access.

Interview questions

What is a default gateway?

The next hop a host uses for destinations not matched by a more specific route, normally the local router.

How is an application gateway different from a router?

A router forwards packets based on network-layer routes; an application gateway can terminate and interpret application protocols and create another connection.

Prerequisites

Related concepts

Continue learning

Browse the full computer science library