Default gateway
From Wikipedia, the free encyclopedia
A default gateway is a node (a router) on a computer network that serves as an access point to another network.
In homes, the gateway is usually the ISP-provided device that connects the user to the Internet.
In enterprises, however, the gateway is the computer that routes the traffic from a workstation to the outside network. In such a situation, the gateway node often acts 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, it is an entry point and an exit point in a network
[edit] Usage
A default gateway is used by a host when an IP packet's destination address belongs to someplace outside the local subnet (thus requiring more than one hop of Ethernet communication). The default gateway address is usually an interface belonging to the LAN's border router.
[edit] Example
An office network is composed of five hosts and a router:
Hosts addresses:
- 192.168.4.3
- 192.168.4.4
- 192.168.4.5
- 192.168.4.6
- 192.168.4.7
Router (this side) address:
- 192.168.4.1
The network's subnet mask is:
- 255.255.255.0
Thus the network ranges from addresses 192.168.4.0 to 192.168.4.255.
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 level 2 (MAC) packet addressed to the destination host.
Packets addressed outside of this range, in the example a packet addressed to 192.168.12.3 would fall in such a category, are instead sent to the default gateway address, in this case to 192.168.4.1, which is resolved into a MAC address as usual. Note that the destination IP address will stay 192.168.12.3, it is just the next-hop physical address that is used, in this case it will be the router's interface physical address.