IP address role
Ethernet is the standard used in LANs today.
For Ethernet, connect using a “bus type” as shown in the diagram below. *The star type is also logically a bus type.
How do you send data from computer A to computer E?
Now remember when you send a letter to someone else.
When you send a letter, write the destination address!
If you don't know the address, the postman will be at a loss as to where to deliver it.
Corresponding address information is also required for computer communications.
In computer communication, the IP address corresponds to the destination address when writing a letter.
A unique IP address is assigned to each device that joins the network. Here, we are talking about LAN as an example, but this IP address is also used as destination address information in WAN (Internet).
Address information must be globally unique. So duplication doesn't make sense. This is because if there are multiple addresses with the same address, it is not possible to identify the destination.
Even with IP addresses, there is a rule that the same address should not exist more than once.
In addition, IP addresses have a hierarchical address system.
For example, address information has a hierarchical address system.
The address of "Tokyo Disneyland" is
1-1 Maihama, Urayasu City, Chiba Prefecture
This is the address.
You can see that "Tokyo Disneyland" is located in Urayasu City, Chiba Prefecture.
"Tokyo Disneyland" is famous, so I think everyone knows that it is in Chiba, but let's think about a case where you don't know where it is. With this hierarchical address structure, you don't have to search for "Maihama" from all over Japan. Focusing only on Chiba Prefecture, you can search for "Maihama".
If the address system is flat and the address information is only "Maihama", it will be extremely difficult to find "Tokyo Disneyland".
In other words, if the address system is flat, it is very difficult to deliver to the destination.
Therefore, there is a network address for specifying which region the destination is, even with IP addresses.
Here, we explained that the IP address has a role as address information of the destination, but it also has a role in routing control for efficient data transfer. An IP address consists of a network part and a host part. Network addresses play a big part in routing.
route control (routing)
A protocol called IP is a protocol that provides address information on a network.
An IP address consists of a network part and a host part. By providing a network address, it also plays a role in route control to efficiently transfer data within a vast and complex network.
For example, consider the case of sending an e-mail.
A device called a router exists on the route from the source to the destination.
What kind of device is a router?
Remember the intersection where the roads meet.
What is there at the intersection?
There are guide signs.
In a network, routers exist at the intersection of routes.
The router has the route information corresponding to the guidance signs.
The router looks at the network address of the destination of the received mail, judges which route to send it to, and sends it out to the optimum route.
This mechanism is called routing.
From sender to destination
How does a packet travel from source to destination?
Here, we will use the diagram below to explain the route taken by the packet.
Consider sending data from computer A to computer B.
The source computer A does not care about the route to the destination computer B's network.
What computer A thinks is whether it belongs to the same network as computer B. Whether or not you belong to the same network is determined from the subnet mask value set for you. The subnet mask will be explained later in the content.
Computer A determines that it does not belong to the same network as destination computer B, and sends the packet to the nearest router (default gateway).
The relay router considers the shortest route to the network where computer B exists and forwards it.
Other than the routers of the networks in which computer B participates, we are unaware of computer B. To the last, I think only of shortcuts and devote myself to forwarding.
Eventually, the routers in computer B's participating network deliver the packet to computer B. In this way, packets are prevented from flowing to unnecessary networks, and packets are sent to their destination through the optimal route.