My Github address
Notes on data Structures and Algorithms
Notes for geek Time iOS Developer Class
IOS large factory interview high frequency algorithm summary
Summary of iOS interview materials
Network interconnection model
- In order to better promote the research and development of the Internet, the international standardization organization ISO established in 1985
Network interconnection model
- OSI Reference Model (Open System Interconnect Reference Model) with
7 layer structure
- In actual development and learning, 4 layers are mainly used
TCP/IP protocol
And 5 layersLearning Research Edition
.
Request process
- Requesting on the Network
The client
toThe server
Each layer is responsible for sending dataJoining together
Part of the data. - in
The client
receiveThe server
Each layer is responsible for the data returneddemolition
Part of the data.
The basis of communication between computers
- Need to know each other
The IP address
- Ultimately based on
MAC Address (NIC address)
, and send data toThe network card
,The network card
receive- The data include
The source IP
,Destination IP address
,The source MAC address
,Destination MAC Address
- If the nic discovers the target of the data
The MAC address
If it is itself, it will pass the data to the next level of processing - If the nic discovers the target of the data
The MAC address
Not themselves, will be the datadiscarded
Is not passed to the previous layer for processing
- The data include
The way computers are connected
Cable directly connected
- Need to use cross wires (not straight wires)
ping
The command uses theThe ICMP protocol
If you need to know the other personThe IP address
And ultimately according toThe MAC address
Send data toThe network card
,The network card
To receive.- Don’t know each other
The MAC address
When usingARP protocol
,radio
. radio
Only in the same placeNetwork segment
The purpose is to obtainThe MAC address
, to all connected devicesradio
, ask for correspondenceThe IP address
Under theThe MAC address
.ARP protocol
In the broadcast of the targetThe MAC address
forFFFF.FFFF.FFFF
. That is, the MAC address in hexadecimal format1
.- Is full of
1
The MAC address of theNetwork segment
Can be received by all connected devices.
ARP protocol
There is a cache. The next one isping
When, there is no need to acquireThe IP address
Instead, ICMP is implemented directly.
Coaxial Cable Coaxial cable
- Multiple devices connection mode
- Half duplex communication
- At the same time, one-way communication
- Easy to conflict
- Conflicts occur when data is imported in both directions of the cable.
- unsafe
- Instead of going one way to the corresponding computer, data is sent to all devices.
- There was a break, and the whole thing collapsed
- The termination resistance is lost
Hub
- Advantages:
- If two lines conflict, the other lines can communicate
- Disadvantages:
- If 1,000 devices are connected,
ARP protocol
It sends 1000 pieces of data. Even knowing each otherThe MAC address
, the data still needs to be sent to 1000 devices simultaneously. - Half duplex communication
- Easy to conflict
- unsafe
- If 1,000 devices are connected,
Bridge (Hub)
- To be able to learn which side of each structure
The MAC address
So as to isolate the conflict domain.- through
The MAC address table
- When the data crosses the bridge
The MAC address table
Identify the targetThe MAC address
When you’re not on the other side, you don’t continue to send data to the other side. - If the left and right sides of the data can be separated by a bridge, then the left and right sides can communicate simultaneously.
- through
Switch
- Equivalent to a bridge with more interfaces
- Learning ability: Can remember the MAC address of each interface
- Full duplex communication, bidirectional communication
- Safer than hubs
- Regional network final scheme
What if all the devices in the world were connected by switches?
- It receives broadcasts from devices around the world
- The IP address is insufficient
Router
- Data can be forwarded between different network segments
- isolation
Broadcast domains
- different
Network segment
There’s no way to broadcast between
- different
How do different network segments communicate
- Determine the host data before sending it
Destination IP address
And whether the host is in the sameNetwork segment
- In the same
Network segment
, sendARP
Through theswitches
,A hub
Pass data. - Not in the same
Network segment
- Host sends first
ARP
To the routerThe gateway
, determine the gatewayThe MAC address
. - The host sends data to
The gateway
.The gateway
And then decide which exit to takeThe gateway
. - in
Export gateway
sendARP
To confirm the recipientThe MAC address
. - The last
Export gateway
Send the data to the receiver.
- Host sends first
- In the same
conclusion
- Cable direct connection, coaxial cable, hub, bridge, switch
- The connected device must be in
The same network segment
- The connected device is located
Same broadcast domain
- The connected device must be in
- The router
- Can be found in
Different network segment
Forwarding data between - isolation
Broadcast domains
- different
Network segment
There’s no way to broadcast between
- different
- Can be found in
- The host determines the target host before sending data
The IP address
And whether it’s in the same placeNetwork segment
- In the same network segment:
ARP
- Not in the same network segment: Yes
The router
Forwarding data
- In the same network segment: