2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
introduce
In the process of learning computer networks, I have sorted out some key points that may be tested in the exam. Some specific points may not be covered. I will continue to update it later, and I hope it will be helpful to everyone!
Connection-oriented, providing reliable transmission services
Connectionless, no quality of service commitment, packet transmission may result in data loss
Different routes need to exchange information, generate a forwarding table based on the routing selection algorithm, and give it to the data layer
According to the forwarding table generated by the control layer, the received packet is forwarded from the corresponding interface found
IP, also known as the Kahn-Cerf protocol, is one of the two most important protocols in the TCP/IP system.
Currently divided into two types: IPv4 and IPv6
Three protocols used in conjunction: Address Resolution Protocol ARP Internet Control Message Protocol ICMP Internet Group Management Protocol IGMP
Intermediate devices for network interconnection
Physical layer: repeater
Data link layer: bridge/bridge, switch
Network layer: routers
Above the network layer: GatewayFor historical reasons: TCP/IP sometimes considers network layer routers to be gateways
Since the actual Internet has the same Internet Protocol IP, it can be abstracted as a virtual Internet.
On this network, datagrams can be delivered directly, otherwise they need to be delivered indirectly through routing forwarding, etc.
32 bits, 4 bytes, these 4 bytes are separated by ., that is, dotted decimal notation
The first n digits are the network number, and the last 32-n digits are the host number.
Unicast address Class A n=8 Class B n=16 Class C n=24
Multicast Address Class D
Category A 1-bit network number, 7-bit assignable network number 2 7 − 2 = 126 2^7-2=126 27−2=126, the maximum number of hosts in the network 2 24 − 2 2^{24}-2 224−2
Category B 2-bit network number, 14-bit assignable network number 2 14 2^{14} 214, the maximum number of hosts in the network 2 16 − 2 2^{16}-2 216−2
Category C 3-digit network number, 21-digit assignable network number 2 21 2^{21} 221, the maximum number of hosts in the network 2 8 − 2 2^{8}-2 28−2
Class D multicast addresses
Class E is reserved for future use
Note: Network number in Class A - 2: In the network number field, all 0s represent the current network, and all 1s represent loopback testing.
The network number in other classes does not use -2: the network number field starts with 1 and cannot be all 0. 01111111 indicates a loopback test, which is also impossible here.
Maximum number of hosts - 2: This is because in the host number field, the host numbers of all 0s and all 1s are subtracted. All 1s represent all hosts in the network.
Change the network number to a network prefix, but the number of digits in the network number can be any value between 0 and 32.
Use slash notation, such as: 128.14.35.7/20, which means the first 20 bits are the network number. The corresponding subnet mask is: 11111111 11111111 11110000 00000000
The IP address and subnet mask are ANDed and obtained.website address(such as 128.14.32.0/20), now the network address must specify the network prefix, otherwise it is impossible to specify a specific network address
Before the advent of CIDR, it was usually not necessary to specify a prefix, because the ABC classes all had fixed prefixes of 8/16/24, and IP addresses could be distinguished based on the network number field without specifying a prefix.
128.14.32.7 network address
128.14.32.7/20 specifies the IP address of the network prefix
128.14.32.0/20 An address block or network prefix containing multiple IP addresses
CIDR has three special address blocks:
Prefix n=32, it is said that the prefix has no host number, this is the IP address, used for host routing
Prefix n=31, host number is 0/1, this address block/network prefix is used for point-to-point links
Prefix n=0, 0.0.0.0/0, for the default route
The MAC address is the hardware address used by the data link layer
The IP address is the address used by the network layer and the layers above it. It is a logical address
ARP: Get the corresponding MAC address based on the IP address resolution
Reverse Address Resolution Protocol RARP, MAC → rightarrow →IP, included in the current DHCP
DHCP protocol: can dynamically assign IP addresses to hosts. For example, when a mobile phone enters a new local area network, a DHCP server is required to dynamically assign an IP address to it.
There is a cache to store the IP MAC mapping relationship
IPv4 header 20 bytes / 160 bits plus data, the total number of bytes can vary between 20 and 65,535 bytes
The following is the specific composition of 160 bits
The header length unit is 4B/4 bytes, which is actually 1 line of 4 bytes and 32 bits.
Maximum 15 lines, minimum 5 lines, that is, maximum 60 bytes, minimum fixed part 20 bytes
The unit of total length is 1B/1 byte, 0-65535 bytes
The unit of slice offset is8 bytes / 8B (Not 8 bit bro!)If the slice offset = 000…1, the beginning of the small slice after the slice is at the 8B position of the original large slice.
The flag has 3 bits, but only two bits are meaningful. MF=1 indicates that there will be more fragments to come, and DF=1 indicates that fragmentation is not possible.
There is a hop-by-hop forwarding concept in the packet, and each forwarding is based on the destination address in the packet header.
If it is a host on this network, it will be delivered directly, otherwise it will be delivered indirectly to the router
The previous process of querying the forwarding table is the process of prefix matching. Here, we should give priority to finding the one with the longest prefix.
Instead of looking for all prefixes, start a binary search downwards by pressing 0/1
1. ICMP is designed to solve two major problems
Feedback on various errors in packet transmission and arrival
Query host or router information
2. ICMP is a network layer protocol, but it is not directly passed to the lower data link layer. Instead, it is encapsulated as an IP datagram and passed to the lower layer.
3. In an IP datagram, if the protocol field is 1, it is an ICMP message
Source Suppression There is no mechanism to tell the source that congestion has been relieved. The source can only slow down the packet sending speed until it no longer receives datagrams.
End point unreachable Host/router unable to deliver datagram
time out The survival time (actually the number of hops) decreases to 0, the datagram is discarded, and an ICMP timeout message is sent to the source.
If the fragment does not arrive completely within the timer, a timeout message is sent and all the fragments that have been received are discarded.
Parameter Problem This message is sent when there is an error in the datagram header or some options are missing in the header. Both the host and the router may send this message.
Changing Routes Routing redirection, telling the host to send it to me is not the best option, let's change it
CIDR NAT cannot fundamentally solve the problem of IPv4 exhaustion, so a larger IPv6 was born.
Routing Information Protocol RIP (Routing Information Protocol) [Application Layer]
Distance-vector based routing algorithm, smaller AS (autonomous system), suitable for small networks;
RIP message is an application layer protocol and is encapsulated into a UDP datagram.
RIP protocol features:
RIP uses hop counts to measure paths (each router maintains a record of the distance from itself to every other router);
The cost of RIP is defined between the source router and the destination subnet;
The network diameter limited by RIP is no more than 15 hops;
Exchange all information with the neighbor and only exchange information with the adjacent router, 30 actively once (broadcast).
Good news travels fast, bad news travels slow (maybe because of mutual deadlock, it takes 16 times * 30 seconds to find out that the two routers are uselessly sending data to each other)
Open Shortest Path First (OSPF) [Network Layer]
Link-state based routing algorithm (Dijkstra algorithm), large-scale AS, suitable for large networks
Directly encapsulated in IP datagram transmission. (Like the transport layer, but the network layer is controversial)
Advantages of OSPF protocol:
Safety;
Support multiple paths with the same cost;
Support differentiated cost measurement;
Support unicast routing and multicast routing;
Hierarchical routing.
BGP (Border Gateway Protocol)Application Layer】
It is a protocol that runs between ASes to find a good route: all information is exchanged for the first time, and only the changed parts are exchanged afterwards. BGP encapsulatesTCPMessage segment
Unicast broadcast (broadcast all) Multicast (broadcast as needed)
VPN, the full name of which is Virtual Private Network, is a type of network that connects to a server through a public network (such as the Internet).Establish an encrypted secure connection in an unsecured networkVPN establishes a virtual, encrypted channel to isolate the communication between the user's terminal device and the server, ensuring the confidentiality, integrity and availability of data transmission.
NAT is used in private networks where multiple hosts access the Internet through one public IP address, which reduces the consumption of IP addresses but increases the complexity of network communications.
Multiprotocol Label Switching (MPLS) is a technology for transmitting data in a packet switching network. It uses labels to forward data packets instead of relying on the destination IP address like traditional IP routing.
Compared with traditional IP routing methods, when forwarding data, it only analyzes the IP packet header at the edge of the network instead of analyzing the IP packet header at each hop, saving processing time.
SDN is a new network innovation architecture.Network VirtualizationOne way to achieve this.Core TechnologyOpenFlowByInternet equipmentThe control plane is separated from the data plane, thus achievingNetwork trafficFlexible control makes the network more intelligent.Core NetworkIt provides a good platform for innovation in technology and applications.