Introduction

What is a default gateway? Now as a demonstration on a Windows computer, let’s check the network configuration. So if you open up a command prompt and then you type in ipconfig, and in the output you’ll see the IP address, subnet mask, and the default gateway that’s been assigned to this computer.

What is a Default Gateway?

So you might be asking yourself, well what is a default gateway? And simply put, a default gateway is a device that forwards data from one network to another. And the majority of the time, this is going to be a router. So for example here we have a local area network. So here is the router, switch, and the computers.

On the other side of the router we have the internet, which is another network. So in order for these computers to access another network, such as a web page out on the internet, the data has to exit its own local network by going through the default gateway, which is the router.

And then the router will forward the data to the internet. Now this also works both ways. So if a device on the internet wanted to communicate with a computer on this network, it has to go through this network’s default gateway and then to the computer. So in a nutshell, that’s what a default gateway is.

It lets devices from one network communicate with devices on another network. And as I said before, this is typically going to be a router. A router is the gateway or doorway to every network. And the term default means that the designated device is the first option that’s looked upon when data needs to exit the network.

Communication Within a Network

Now if these computers here wanted to communicate with each other, they can just talk directly to each other through the switch. And this is because all these computers are on the same network. Their data doesn’t have to exit the network and go through the default gateway. So this brings us to our next question.

Identifying Network Differences

And that is, if these computers wanted to communicate with another computer, how do they know whether that computer is on their own network or if it’s on a different network. Because as I stated before, if this computer wants to communicate with a computer on the same network, it can just talk directly to it.

But if it wants to communicate with a computer on a different network, it has to go through the default gateway. So again how does it know? And this is where the IP address and subnet mask come in. An IP address consists of two parts. The first part is the network address and the second part is the host address.

The Role of IP Address and Subnet Mask

So the way to tell which portion belongs to either the network or the host is where the subnet mask comes in. A subnet mask is a number that resembles an IP address. And it reveals how many bits in the IP address are used for the network by masking the network portion of the IP address. So here we have the IP address and subnet mask in binary form.

So the way to tell which portion of this IP address is the network portion is when the subnet mask binary digit is a 1 it will indicate the position of the IP address that defines the network. So we’ll cross out all the digits in the IP address that line up with the 1s in the subnet mask.

And when you do this, it will reveal that the first three octets or sets are the network portion and the remaining is the host portion. So any computer or device on a network where the first three numbers of the IP address are 192.168.0 means that those computers are on the same network. Which means that the computers can talk directly to each other without exiting through the default gateway.

And then the host portion is what’s uniquely assigned to devices, such as computers. So here we have a private network that has been divided into two sub networks or subnets. The subnet on the left is on the 192.168.0 network and the subnet on the right is on the 192.168.1 network. And each subnet has their own default gateway.

Communication Between Subnets

Now let’s say that computer A wanted to communicate with computer B on this subnet. So computer A is going to check computer B’s IP address to see if it’s on the same network or not. And as you can tell, the two computers are on the same network because the network portion of the IP addresses, which are the first three octets, are the same.

So computer A now knows that computer B is on the same network. So now in order for communication to take place, computer A needs computer B’s MAC address. And it finds this by sending out an ARP broadcast out on the network asking computer B for its MAC address. Then once it has the MAC address, communication can finally take place. So in another scenario let’s say that computer A on this subnet here wanted to communicate with computer D on this subnet.

So again computer A is going to check computer D’s IP address to see if it’s on the same network or not. And as you can tell this time, the two computers are on different networks because the network portion of the IP addresses, which are the first three octets, are different. And the difference is the third number. Computer A is using a 0 and computer D is using a 1. So computer A now knows that computer D is on a different network.

So it can’t directly communicate with it, it has to use the default gateway. So computer A will send out an ARP broadcast and this time it’ll ask for the MAC address of the default gateway and not the computer, because computer D is on a different network and it won’t receive the broadcast because ARP broadcasts cannot go past a router.

Then once it has the MAC address, it’ll send the data to the default gateway and then it’ll be forwarded to the destination.

Categorized in:

Uncategorized,

Last Update: September 1, 2024