What is a Network Gateway?
Learn what a network gateway is, how the default gateway routes off-subnet traffic, and its role in NAT — with interview Q&A.
Expected Interview Answer
A network gateway is the node — usually a router — that sits at the boundary of a local network and provides the exit point to a different network, most commonly the path from a LAN out to the internet; every device configures a 'default gateway' IP address for traffic destined outside its own subnet.
When a device wants to reach a host on its own subnet, it sends the packet directly using ARP-resolved local delivery. When the destination is outside the subnet, the device instead sends the packet to its configured default gateway, which is the router interface on its own network responsible for forwarding traffic onward. The gateway then applies its routing table, and often NAT, to translate and forward the packet toward the wider internet or another network. A gateway in the broader sense can also mean any device that translates between two different protocols or network types (an API gateway, a VoIP gateway), but in the context of IP networking it almost always refers to this default-router boundary node. Misconfiguring the default gateway is one of the most common reasons a device can reach local devices but not the internet.
- Provides the exit point from a local subnet to other networks
- Every device is configured with a default gateway IP
- Often performs NAT and routing table lookups for outbound traffic
- Explains why local-only connectivity issues often trace to gateway misconfiguration
AI Mentor Explanation
A network gateway is like the single exit gate of a stadium that every spectator must pass through to leave the grounds and reach the outside city, even though they can walk freely between stands inside. A steward at that gate checks where you are headed and directs you onto the correct road, exactly like a router applying NAT and routing rules. If that gate is blocked or misdirected, spectators can still move around inside the stadium but cannot get to the city beyond it. This mirrors how a misconfigured default gateway leaves local traffic working but breaks internet access.
Step-by-Step Explanation
Step 1
Local check
A device checks whether the destination IP is within its own subnet.
Step 2
Off-subnet forwarding
If not local, the packet is sent to the configured default gateway address.
Step 3
Gateway routing
The gateway router consults its routing table and applies NAT if needed.
Step 4
Onward delivery
The packet continues hop by hop toward the destination network or the internet.
What Interviewer Expects
- Correct definition: the exit-point router for off-subnet traffic
- Understands the default gateway is configured per device
- Knows the gateway typically performs NAT for internet-bound traffic
- Can diagnose local-works-but-internet-fails as a gateway issue
Common Mistakes
- Confusing a gateway with a generic hub or switch
- Thinking every packet, even local ones, goes through the gateway
- Not knowing “gateway” can also mean a protocol-translation device outside IP routing
- Forgetting the gateway address must be within the device's own subnet
Best Answer (HR Friendly)
“A network gateway is the doorway out of your local network — usually your router — that your traffic passes through whenever you want to reach something outside your own network, like a website on the internet. Your device knows to send anything not on its local network straight to this gateway, which then figures out how to get it the rest of the way there.”
Code Example
# Show the configured default gateway
ip route show default
# default via 192.168.1.1 dev eth0
# Confirm the gateway itself is reachable
ping -c 4 192.168.1.1
# Trace whether traffic actually leaves via the gateway
traceroute -n 8.8.8.8Follow-up Questions
- What happens to a packet if the default gateway is unreachable?
- How does a device decide a destination is off-subnet using the subnet mask?
- How does the gateway relate to NAT for outbound internet traffic?
- What is the difference between a network gateway and an API gateway?
MCQ Practice
1. What is the primary role of a default gateway?
The default gateway is the router a device sends off-subnet traffic to for forwarding onward.
2. A device can reach local machines but not the internet. What is a likely cause?
Local (same-subnet) traffic does not need the gateway, so this symptom often points to a gateway problem.
3. What does a gateway typically perform for outbound internet traffic?
Gateways commonly translate private LAN addresses to a public IP via NAT for internet-bound packets.
Flash Cards
What is a network gateway? — The router node that forwards traffic from a local network to other networks, e.g. the internet.
When is the gateway used? — Only when the destination IP is outside the device's own subnet.
What does a gateway often do to outbound traffic? — Applies NAT to translate private addresses to a public IP.
Local works, internet fails — likely cause? — A misconfigured or unreachable default gateway.