default gateway

default gateway

 A default gateway is a device representing a “gateway” used when accessing outside the network to which it belongs. In general, the router will be the default gateway.

See the diagram below.

 The default gateway of PC_A and PC_B belonging to the “150.10.1.0/24” network is “150.10.1.1/24” which is assigned to the interface connected to “150.10.1.0/24” of the router.

 The default gateway of PC_C belonging to the “150.10.2.0/24” network is “150.10.2.1/24” which is assigned to the interface connected to “150.10.2.0/24” of the router.

 Network terminals such as computers have IP addresses such as default gateways in addition to IP addresses. Check your computer’s TCP/IP protocol properties.

A default gateway is set.

Now let’s see how this default gateway is used when PC_A communicates with PC_C.

PC_A (source) ・・・ 150.10.1.10/24
PC_C (destination) ・・・ 150.10.2.10/24

PC_A performs an AND operation with the destination PC_C’s IP address “150.10.2.10” and the subnet mask “255.255.255.0”.

   150.10.2.10 = 10010110.00001010.00000010.00001010
AND 255.255.255.0 = 11111111.11111111.11111111.00000000
———————————– —————————————-
            10010110.00001010.00000010.00000000 = 150.10.2.0

“150.10.2.0” obtained by the AND operation becomes the destination network.

 PC_A realizes that it must be sent to another network, since it does not belong to the same network (subnet) as itself. Therefore, PC_A communicates with PC_C by sending packets to the default gateway, which is the “gateway” to other networks.

Communication on the same network

Now I will explain how PC_A and PC_B communicate.

PC_A (source) ・・・ 150.10.1.10/24
PC_B (destination) ・・・ 150.10.1.11/24

 PC_A performs an AND operation with the destination PC_B’s IP address “150.10.1.11” and the subnet mask “255.255.255.0”.

   150.10.2.10 = 10010110.00001010.00000001.00001011
AND 255.255.255.0 = 11111111.11111111.11111111.00000000
———————————- —————————————-
            10010110.00001010.00000001.00000000 = 150.10.1.0

“150.10.1.0” obtained by the AND operation becomes the destination network.

PC_A discovers that it belongs to the same network as destination PC_B.

So PC_A looks in its own MAC address table to see if there is a MAC address for PC_B.

 If PC_B’s MAC address is not found in the MAC address table, PC_A will do the work of ARP. ARP will be explained later.