Communication between computers
The communication between computers is as follows: After knowing the IP address of the other party, the computer sends ARP broadcast messages to obtain the Mac address (nic address) of the other party and sends data to the NIC.
When received by the nic:
- If the nic discovers the target of the data
The Mac address
If it is itself, it will pass the data to the upper layer for processing - If the nic discovers the target of the data
The Mac address
Not their own, will be discarded data, will not be handed over to the next layer to process
How computers link to each other:
- Cable directly connected
- Coaxial cable
- A hub
- The bridge
- switches
- The router
Cable directly connected
The direct network cable connection is very simple. After the two computers are directly connected through the network cable, as long as the IP addresses are on the same network segment, they can communicate
Process:
The computer is 0 (1)
All we know is the targetThe IP address
is192.168.1.11
- send
ARP
Broadcast, which contains the sourceThe IP address
And the sourceThe Mac address
, the targetThe IP address
, now the targetThe Mac address
forFFFF.FFFF.FFFF
The computer is 0 (2)
We have target on the radioThe IP address
Is their own, so reply to the broadcast message, which put their ownThe Mac address
addThe computer is 0 (1)
receivedThe computer is 0 (2)
theThe Mac address
- The two computers can begin to communicate
Coaxial cable
As is shown inCoaxial cable
Is a relatively old way, it has the following characteristics and shortcomings:
Coaxial cable
Belong toHalf duplex communication
That is, only one message can be sent at a time, and if the first computer in the picture sends a message, the message will be sent forward until it is reachedThe end resistance
Or any other computer- Prone to conflict
- Every time a message is sent, it is sent to every computer, so the message is not secure
- if
Coaxial cable
The failure of one segment leads to the failure of the entire communication
A hub
A hub
Is theCoaxial cable
After an improved way, its characteristics are as follows:
- also
Half duplex communication
- Easy to conflict
A hub
It’s also a very mindless way to send messages to all connected devices
The bridge
You can see it in the picture aboveThe bridge
It links twoA hub
, its characteristics are as follows:
- In contrast to
A hub
No brain,The bridge
Each interface side is recordedThe Mac address
, knowing that theThe Mac address
After that, the message is sent with identification, no longer likeA hub
That will be sent to all devices - Because each interface side will be recorded
The Mac address
To isolate conflict domains
switches
A switch can be thought of as a combination of a hub and a bridge:
- Equivalent to multi-interface
The bridge
- implementation
Full duplex
communication - than
A hub
A more secure - in
Local area network (LAN)
In theswitches
Can be used as the final plan
The router
The router
The process of receiving and sending information is different from the others aboveA computer
andComputer B
In the same network segment, the default gateway must also be set as192.168.1.1
And the sameComputer C
andComputer D
In the same network segment, the default gateway must also be set as192.168.2.1
And configureThe router
The gateway address of the connection port, described in more detail nextA computer
andComputer C
The communication process of
Process:
A computer
sendARP
Broadcast acquisition andThe router
Connected to port 0The Mac address
A computer
Send a message to the router through port 0Destination IP
is192.168.2.11
- Router port 1 sends
ARP
Radio accessComputer C
theThe Mac address
A computer
andComputer C
Communicate through the router gateway
Cable direct connection, coaxial cable, hub, bridge, switch:
- The connected devices must be the same
Network segment
- The connected devices are in the same state
Broadcast domains
Router:
- Data can be forwarded between different network segments
- isolation
Broadcast domains