Sunday, February 23, 2014

What is a Default Gateway?

If you're new to networking, you've probably heard the term default gateway and wondered what it meant. You see it in the IP address configuration on hosts and routers, but what does it do?

The default gateway, also known as simply the gatewaythe default route, and on Cisco routers as the gateway of last resort, is the path packets use when there is no explicit route to a destination. Without a default gateway, each host would have to have a routing table containing explicit paths to every host on the Internet, an absurd and unworkable solution. When we configure a default gateway, we're saying to the host, "If you don't know what else to do with a packet, send it to the default gateway and let the gateway figure out what to do with the packet."

In order for a host's default gateway to work, there are certain criteria that must be met:
  • It must be an interface on a network already known to the host (If it's not known to the host, how will the host know how to get the packets to the gateway?)
  • It must be an interface on a device connected to the rest of the world, usually the public Internet.
Consider this diagram in which the three computers connected to the Cisco ASA use the ASA's inside interface as their gateway. The ASA then uses the ISP's router as its gateway.
In the above scenario, suppose the top laptop wants to visit a website, say www.soundtraining.net. It probably doesn't have an explicit route in its local routing table for www.soundtraining.net's IP address, so it hands the request off to its default gateway, the ASA. The ASA also doesn't have an explicit route in its routing table for www.soundtraining.net's IP address so it hands the packet off to its default gateway, which is the ISP's router. The process may be repeated through several routers before the packet finally arrives at its destination. You can see the entire process by using the command traceroute www.soundtraining.net in a terminal window.

One word of caution, on hosts with multiple interfaces, you can sometimes end up with multiple default gateways which can produce unpredictable results. Generally, you want only one default gateway configured per device, regardless of the number of interfaces on the device.

For More Resources for I.T. Pros

You'll find books on Cisco and Linux technologies at my bookstore at soundtraining.net/bookstore. Also, check out my video channel at soundtraining.net/videos.

Please Leave a Comment

If you find this networking tutorial helpful or if you notice something that needs to be corrected, please leave a comment.