Default Gateway (Networking)

Source: Wikipedia: Default Gateway

Default gateway

From Wikipedia, the free encyclopedia
Jump to: navigation, search
It has been suggested that this article or section be merged with Default route. (Discuss)

In computer networking, a gateway is a node (a router) on a TCP/IP network that serves as an access point to another network. A default gateway is the node on the computer network that the network software uses when an IP address does not match any other routes in the routing table.

In home computing configurations, an ISP often provides a physical device which both connects local hardware to the Internet and serves as a gateway. Such devices include DSL modems and cable modems.

In organizational systems a gateway is a node that routes the traffic from a workstation to another network segment. The default gateway commonly connects the internal networks and the outside network (Internet). In such a situation, the gateway node could also act as a proxy server and a firewall. The gateway is also associated with both a router, which uses headers and forwarding tables to determine where packets are sent, and a switch, which provides the actual path for the packet in and out of the gateway.

In other words, a default gateway provides an entry point and an exit point in a network.

* 1 Usage
* 2 Example 1
* 3 Example 2
* 4 See also
* 5 References
* 6 External links

[edit] Usage

A host uses a default gateway when an IP packet's destination address belongs to someplace outside the local subnet. The default gateway address is usually an interface belonging to the LAN's border router.
[edit] Example 1

An office network consists of five hosts and a router:

Hosts addresses:


Router (this side) address:


The network has a subnet mask of:

* (/24 in CIDR notation)

Thus the usable network ranges from addresses to (TCP/IP defines the addresses and for special functions.)

The office's hosts will send packets addressed to IPs within this range directly, by resolving the destination IP address into a MAC address through an ARP sequence (if not already known through the host's ARP cache) and then enveloping the IP packet into a layer 2 (MAC) packet addressed to the destination host.

Packets addressed outside of this range (for this example, a packet addressed to cannot travel directly to the destination. Instead they must be sent to the default gateway for further routing to their ultimate destination. In this example, the default gateway uses the IP address, which is resolved into a MAC address with ARP in the usual way. Note that the destination IP address remains, but the next-hop physical address is that of the gateway, rather than of the ultimate destination.
[edit] Example 2

A network with three routers and three hosts, connected to the Internet through router 1.

Hosts and addresses:

* PC1, default gateway
* PC2, default gateway
* PC3, default gateway

Router 1:

* Interface 1 (public IP)
* Interface 2

Router 2:

* Interface 1
* Interface 2

Router 3:

* Interface 1
* Interface 2

Network mask in all networks: (/24 in CIDR notation).

If the routers do not use a Routing Information Protocol to discover which network each router is connected to, then the routing table of each router must be set up.

Router 1
Network ID Network mask Gateway Interface (examples; may vary) Cost (decreases the TTL) (default route) Assigned by ISP (e.g. eth0 (Ethernet 1st adapter) 10 eth1 (Ethernet 2nd adapter) 10 eth1 (Ethernet 2nd adapter) 10 eth1 (Ethernet 2nd adapter) 10

Router 2
Network ID Network mask Gateway Interface (examples; may vary) Cost (decreases the TTL) (default route) eth0 (Ethernet 1st adapter) 10 eth1 (Ethernet 2nd adapter) 10

Router 3
Network ID Network mask Gateway Interface (examples; may vary) Cost (decreases the TTL) (default route) eth0 (Ethernet 1st adapter) 10 eth1 (Ethernet 2nd adapter) 10

Router 2 manages its attached networks and default gateway; router 3 does the same; router 1 manages all routes within the internal networks.

Accessing internal resources If PC2 ( needs to access PC3 (, since PC2 has no route to it will send packets for PC3 to its default gateway (router 2). Router 2 also has no route to PC3, and it will forward the packets to its default gateway (router 1). Router 1 has a route for this network ( so router 1 will forward the packets to router 3, which will deliver the packets to PC3; reply packets will follow the same route to PC2.

Accessing external resources If any of the computers try to access a webpage on the Internet, like, the destination will first be resolved to an IP address by using DNS-resolving. The IP-address could be In this example, none of the internal routers know the route to that host, so they will forward the packet through router 1's gateway or default route. Every router on the packet's way to the destination will check whether the packet's destination IP-address matches any known network routes. If a router finds a match, it will forward the packet through that route; if not, it will send the packet to its own default gateway. Each router encountered on the way will store the packet ID and where it came from so that it can pass the request back to previous sender. The packet contains source and destination, not all router hops. At last the packet will arrive back to router 1, which will check for matching packet ID and route it accordingly through router 2 or router 3 or directly to PC1 (which was connected in the same network segment as router 1).

The packet doesn't return If router 1 does not have any route to, and PC3 tries to access a resource outside its own network, then all routing will work until the reply is fed back to router 1. Since the route is unknown to router 1, it will go to router 1's default gateway, and never reach router 3. In the logs of the resource they will trace the request, but the requestor will never get any information. The packet will die because the TTL-value decrease to less than 1 when it is travelling through the routers or the router will see that it has a private IP and discard it. This could be discovered by using Pathping (windows), since you only can ping until that router which has no route or wrong route. (Note that some routers will not reply to pinging.)
[edit] See also

* route (command): generic command for displaying/configuring TCP/IP routing tables (including gateways) on both Unix and Windows systems

[edit] References
This article does not cite any references or sources.
Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (August 2008)
[edit] External links

* Webopedia Definition
* The Linux Documentation Project

Retrieved from ""
Categories: Routing
Hidden categories: Articles to be merged from December 2008 | All articles to be merged | Articles lacking sources from August 2008 | All articles lacking sources
Personal tools

* New features
* Log in / create account


* Article
* Discussion



* Read
* Edit
* View history



* Main page
* Contents
* Featured content
* Current events
* Random article


* About Wikipedia
* Community portal
* Recent changes
* Contact Wikipedia
* Donate to Wikipedia
* Help


* What links here
* Related changes
* Upload file
* Special pages
* Permanent link
* Cite this page


* Create a book
* Download as PDF
* Printable version


* Español
* Italiano
* Русский
* Simple English
* Suomi
* Svenska

* This page was last modified on 8 June 2010 at 01:09.
* Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. See Terms of Use for details.
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
* Contact us

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License