Search

What is default gateway

When a computer in your Local Area Network (LAN) wants to communicate with a computer on a remote network, the data packets need to traverse through the router. Default gateway IP address is the IP address of the interface of the router that is facing the Local Area Network (LAN). The default gateway IP address must configured on the TCP/IP settings of all the devices on that LAN to succesfully communicate with remote networks. All the data packets destined to any other network must be forwarded to default gateway.

Please refer below image to see an example.

default-gateway.jpg

From above image, we can see that the default gateway IP address of "Network 1" is 172.16.0.1 255.255.0.0, which belongs to 172.16.0.0 255.255.0.0 network. The default gateway IP address of "Network 2" is 172.17.0.1 255.255.0.0, which belongs to 172.17.0.0 255.255.0.0 network. So, the most important fact to note here is that a computer’s IP address and its configured default gateway IP address must be in the same network.

How default gateway works

Consider "Computer-1" from Network 1 (172.16.0.0 255.255.0.0 network) wants to communicate with "Computer-2" located in Network 2 (172.17.0.0 255.255.0.0 network) using TCP/IP protocol suite. "Computer-1" performs a comparison process using its own IPv4 address and subnet mask, with the destination IPv4 address.

Refer two images below. First images contains the source IPv4 address, subnet mask and the destination IPv4 address in decimals. Second image contains the source IPv4 address, subnet mask and the destination IPv4 address in binaries.

default-gateway-comparison-decimal.jpg

default-gateway-comparison-binary.jpg

You can see from above images that the network part of the source IPv4 address and the destination IPv4 address are not the same. The meaning is that the source network and the destination network are different. In this case, the destination IPv4 address is located in a remote network and the data packet must be forwarded to default gateway to reach the destination network.

If the destination IPv4 address is located in a remote network, the computer needs to handover the data packet to the default gateway. Every computer is configured with the IP address of default gateway in its TCP/IP settings (see below). Now the computer resolves the MAC address of the default gateway (using Address Resolution Prorocol (ARP)), encapsulates the IPv4 packet in an Ethernet Frame with destination MAC address as the MAC address of the default gateway and forward the packet to the network switch. Network switch will then deliver the packet to the default gateway. Once the data packet is handed over to the router, then it the responsibility of the router to forward the packet to the correct destination network.

How to find default gateway IP address in TCP/IP settings

To view the default gateway IPv4 address configured on your Windows Operating System based computer’s TCP/IP settings, follow these steps.

Run command prompt by right-clicking Start > Run > type cmd and then clicking "OK".

run-box-cmd-default-gateway.png

Type the command "ipconfig" in the prompt and Enter. Do remember to remove double quotes.

ipconfig-default-gateway.jpg

Related Tutorials
Introduction to TCP/IP, Features of TCP/IP, TCP/IP History, What is RFC (Request for Comments)
Seven Layers of OSI Model and functions of seven layers of OSI model
Five layered TCP/IP model
Network Layer (Layer 3)
TCP/IP Data Encapsulation and Decapsulation
Datalink Layer (Layer 2)
Ethernet Frame Format
What is MAC address or Layer 2 address or physical address
IPv4 Protocol, IPv4 header and fields of IPv4 header
IPv4 addresses, IPv4 Address Classes, IPv4 Address Classifications
What is Subnet Mask
What is network address
Limited broadcast address
Directed broadcast address
What is limited broadcast in IPv4 and how limited broadcast works
What is directed broadcast in IPv4 and how directed broadcast works
What is default gateway
What are private IP addresses - RFC 1918 private addresses
Subnetting - Part 1
Subnetting - Part 2
Subnetting - Part 3
Subnetting - Part 4
Subnetting - Part 5
Subnetting - Part 6
Variable Length Subnet Masking, VLSM, IP V4 Subnetting, subnetting tutorials, IP study guides, IP documentation, IP tutorials
Supernetting, IP Supernetting, IP Supernetting tutorial, How to Supernet, Supernetting Guide, Supernetting Concepts
How to find out the Network Address and Broadcast Address of a subnetted IPv4 address
Address Resolution Protocol Tutorial, How ARP work, ARP Message Format
What is Gratuitous ARP