Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The basic composition of # 15 and # 16 network and several network protocols

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

What is the Internet?

Network:

Basic knowledge of network

The concept of network

The function, characteristics, composition and structure of the network

Two Network models (iOS/OSI,TCP/IP)

Network component knowledge

Basic switch

Router Foundation

Advances in network equipment:

Network architecture

Data communication

Resource sharing

Network component: operating system, database, application protocol, application program

Hardware components: computer, network communication equipment, cross-linked interconnection equipment

Network model layering

User layer

7 reduce complexity in the application layer

6 presentation layer standard version resolution

5 modular design of session layer

4 the transport layer ensures the interoperability of technologies

(3) accelerate the development of the network layer.

2 simplified teaching in data link layer

1 physical layer

Dielectric layer

Communication subnet:

(3) accelerate the development of the network layer.

2 simplified teaching in data link layer

1 physical layer

Resource subnet

7 reduce complexity in the application layer

6 presentation layer standard version resolution

5 modular design of session layer

FCS true parity sequence

Peer-to-peer communication is the basis of ensuring data communication.

Application layer of TCP/IP protocol stack (civilian version or practical version)

Define the layer transport layer

Layers 1 to 3 use different names for the Internet layer

Layer 5 to layer 5 are combined into an application layer network access layer

Appeared at the same time as OSI, but OSI is more theoretical and TCP/IP is more practical.

Application layer: Internet

| |-- > Protocol port |

Transport layer: Internet

| |-- > Agreement number |

Internet layer: Internet

| |-- > Protocol type |

Network interface layer (network access layer, physical layer, data link layer): Ethernet

Internet layer protocol characteristics:

Run at the OSI network layer _

Connectionless protocols | |

Process packets independently | ICMP IGMP |

Hierarchical compilation | IP |

Best-effort transmission | ARP RARP |

Numerous data recovery functions | _ |

Internet protocol-IP

ARP: address Resolution Protocol

Logical address-- > physical address

When the logical address is known, obtain the physical address of the corresponding logical address

How to resolve:

1. Every device that participates in network functions has an ARP library

2.ARP cache: broadcast through ARP protocol, the specified target host responds, and the corresponding result information is cached locally.

RARP: reverse address Resolution Protocol

Physical address-- > logical address

Know the local physical address and obtain a legal logical address

For diskless workstations

For connectionless:

1. There is no need to establish a communication connection before communication, there is no need to maintain the stability of the connection, and there is no need to dismantle the connection at the end of the communication

two。 Unordered data transmission

3. Numerous data recovery and data reliability assurance

Flat addressing and hierarchical addressing:

Flat organization: divide the resources to be managed into several cell according to fixed size from beginning to end, and each cell is addressed independently

Features: easy to address, address needs to be traversed, inefficient

Hierarchical organization: classify the resources to be managed and address them according to the corresponding categories

Features: complex addressing, but efficient addressing

Why use an IP address?

They uniquely identify each device in the IP network

Daily mainframe (computer. Network equipment. Peripheral) must have a unique address.

Host ID:

Identify a single host

Assigned to each device by the organization

The IP address consists of two parts:

Network part: used to describe the network scope of the specified host

Host part: used to describe the specific location of a specified host in a specific network scope

IP address: defined by the IPv4 protocol, IPv4 address

The whole address is made up of 32-bit binary

Network bit + host bit = 32

IP address classification:

Class A: the first binary bit must be 0 and the network bit must be 8 bits

Class B: the first two binary bits must be 10 and the network bits must be 16 bits

Class C: the first three binary bits must be 110 and the network bits must be 24 bits

Class D: the first four binary bits must be 1110 and the network bits must be 32 bits; commonly used for multicast communications

Class E: the first four binary bits must be 1111, reserved for scientific research

Dotted decimal representation of IP addresses:

1. The 32-bit IP address bits are divided into 4 groups with 8 bits.

two。 Use between each group. Symbols are separated

3. Convert each 8-bit group to a decimal representation

Various IP address ranges represented in dotted decimal:

Category A: 0.0.0.0 ~ 127.255.255.255

00000000.00000000.00000000.00000000

01111111.11111111.11111111.11111111

The first octet is all zero and is invalid IP because it represents the entire IP address stack

The first 8-bit group is all 1 except the first bit, which is called a loopback address.

Valid Class An address: 1.0.0.0 ~ 126.255.255.255

Category B: 128.0.0.0 ~ 191.255.255.255

10000000.00000000.00000000.00000000

10111111.11111111.11111111.11111111

Class C: 192.0.0.0 ~ 223.255.255.225

11000000.00000000.00000000.00000000

11011111.11111111.11111111.11111111

Category D: 224.0.0.0 ~ 239.255.255.255

11100000.00000000.00000000.00000000

11101111.11111111.11111111.11111111

Category E: 240.0.0.0 ~ 255.255.255.255

11110000.00000000.00000000.00000000

11111111.11111111.11111111.11111111

Reserved address for IP address:

Reserved address: you cannot select the IP address to be used for other host configurations

0.0.0.0 ~ 0.255.255.255: represents the entire network stack

127.0.0.0 to 127.255.255.255: represents a loopback network

Auto-assign address field

169.254.0.0 ~ 169.254.255.255: represents an automatically assigned address field, which can only be used by a local area network

Network address: an address with all zero host bits

1.0.0.0: represents the name of a range

Broadcast address: an address with all 1 host bits

1.255.255.255: represents all IP addresses in the entire network segment as the destination address

Directed broadcast address: class E address

255.255.255.255: the destination address represents all IP addresses in the entire IP address stack

Total number of IPv4 addresses: 2 ^ 32 = 4.2 billion 94 million

Removed IP address:

Class D and E: 500 million +

Address of network segments 0 and 127: 35 million

169.254 network segment address: 65536

Network address: 126 "16384 + 2.09 million

Broadcast address: 126 "16384 + 2.09 million

The IP address that can be assigned to the host is about 3.6 billion.

To solve the problem of IP address exhaustion:

Increase the number of reuse of IP addresses

Private IP address: can be reused and cannot be routed by the Internet

AVR 10.0.0.0 ~ 10.255.255.255

BRV 172.16.0.0 ~ 172.31.255.255

192.168.0.0 ~ 192.168.255.255

Common IP address: can be used on the Internet, but must be unique

NAT:network address translation

SNAT: source address translation, replacing the private IP address in the packet with a common IP address

DNAT: destination address translation, replacing the public IP address in the packet with a private IP address

Study a larger address stack

IPv6:128bit, 2 ^ 128,10 ^ 80

The colon is divided into hexadecimal:

IPv4 and IPv6 share:

1. Address exchange

The 2.IPv6 address contains the IPv4 address: the rightmost 32 bits of the IPv6 address are IPv4 addresses

IP header format

Version:4bits protocol version information; ipv4:0100 ipv6:0110

IHL:4bits,Internet protocol header length IP header length, 15 lines

20byte ~ 60byte, which must be an integral multiple of 4

Type of service:

4bits: type of service

0000,0001,0010,0100,1000

Maximum bandwidth, minimum delay, maximum throughput, maximum reliability

1bit: reserved bit

3bits: priority

000001010011100101110111

Packet length: 16bit, 65536byte, including header; 64KB

Identity: 16bits, identifies the source of the data, and identifies the source data from which the specified data is shredded

Logo: 3bits

No. 1: retention

No. 2: whether it is sliced or not, no slicing is 0, being sliced is 1.

Bit 3: whether there are more fragments, indicating whether the data is the last part

000010011

Slice offset: the sequence number after the packet is sliced by the 13bitsDifferent IP protocol

Time to Live (time to live,TTL): 8bits, counter, each packet will get an initialized TTL value. After each passing through the routing device, it will be subtracted from 1 zero to indicate that the packet is unavailable data, and the next time the routing device acquires it, it will be directly discarded. It can effectively prevent the infinite loop transmission of the packet.

The usual initial value of TTL can be: 255pm 128pc64

Protocol number: 8bits, the communication interface between the Internet layer and the transport layer. After receiving the data correctly according to the content indicated by the protocol number, it is handed up to which protocol of the transport layer for further unblocking.

TLP:6

UCP:17

OSPF:89

EIGRP:88

First checksum: 16bits, carry out the reliability check of the first part

Source address: 32bits, sender address

Destination address: 32bits, recipient address

Internet layer:

How computers use IP addresses

Source IPv4 address: the IP address configured on the host that sent the data

How to configure the source IPv4

Manual configuration: add the IPv4 address that we consider to be valid directly to the configuration file of the network card

Features:

Precise address assignment

The administrator has a lot of repetitive work.

It is easy to make a manual error so that the host is unable to access the network.

Automatic configuration: computers without IP addresses communicate with other computers that can provide IP addresses through specific protocols and obtain IPv4 addresses

Agreement:

Bootp:

Start the protocol:

The need to obtain an IP address from a network-wide broadcast using the rarp protocol; the bootp server selects an IPv4 address from its address pool and belongs permanently to this host

DHCP:

Dynamic host configuration protocol, dynamic host configuration protocol

Address lease planning

Each address has its corresponding lease term.

Rules for renewal of lease:

By default, when 50% of the lease term is over, the client will contact the server to renew the lease; if the renewal is unsuccessful, the client will try three times in a row and then continue to use the current IP address

When the lease term has passed 87.5%, the client will give up the IP address; rebroadcast whether there are other servers that can continue to use the previous IP address

Wait until the lease expires and the client IP address is completely released; the client will try to obtain another IP address from another server to connect to the network

The leasing process of DHCP client-- four-line session:

1. The client sends a DHCP discover message to determine if there is a DHCP server in the network that can provide the local IP address

two。 When the server receives the DHCP discover message, it checks its own address pool. If it still has an available IP address, it selects an IP address from it and sends the DHCP offer message to the client broadcast.

3. The client takes the IP address in the first DHCP offer message received as the optional IP address, broadcasts the DHCP request message to the network, notifies the server, and selects this IP address as the IP address for this communication.

4. After receiving the DHCP request message, the server providing the IP address temporarily binds the IP address to the physical address of the corresponding host, and starts the lease timing; sends a DHCP ack message to the client

The server that did not provide the IP address received the DHCP request, put the IP address just provided back into the address pool, and sent a DHCP nak message to the client

How to give the destination IP address:

Specify manually:

Manually write the IP address of the destination host directly in the address bar

Automatic resolution:

DNS protocol: domain name system, domain name system protocol

On the DNS server, the mapping relationship between the specific domain name and IP address is saved, and the task of address resolution can be completed.

Address resolution:

Forward address resolution:

The process of obtaining its corresponding IP address through a domain name

Reverse address resolution:

The process of deconstructing its domain name through an IP address

Www.baidu.com: fully qualified domain name (FQDN)

Peanut shell-DNS cache server

Netcom DNS server

202.99.166.4

202.99.160.68

Telecom DNS server

222.222.222.222

222.222.202.202

Hierarchical structure of TCP/IP protocol stack:

Application layer: Internet

| |-- > Protocol port |

Transport layer: Internet

| |-- > Agreement number |

Internet layer: Internet

| |-- > Protocol type |

Network interface layer (network access layer, physical layer, data link layer): Ethernet

Transport layer:

Layer 4 of OSI: end-to-end connectivity

Layer 3 of TCP/IP:

TCP:transfer control protocol, transmission control protocol

UDP:user datagram protocol, user Datagram protocol

TCP and UDP are complementary; UDP can do what TCP can't do, and UDP can't do TCP.

TCP: session multiplexing, segmentation, flow control (when needed), connection-oriented (when needed), reliability (when needed)

Reliability effort

Connection type connection oriented connectionless

Protocol TCP UDP

Sort yes or no

Use email, voice, communication

File sharing, download

Characteristics of UDP:

1. Runs at the transport layer of the OSI model and the TCP/IP model

two。 Provide network layer access for applications without having to pay extra overhead for reliability mechanisms

3. Is a connectionless protocol

4. Provide limited error checking

5. Provide best-effort transmission

6. There is no data recovery function.

UDP header

16-bit source port 16-bit destination port

16-bit DUP length 16-bit UDP checksum

data

The header format of the UDP protocol:

Port: also used to be a logical port, or protocol port; it is a communication interface between the application layer and the transport layer

The port is digitally identified by the 16bits binary configuration; its range is 0-65535

Where:

0: identifies all port numbers and cannot be used alone

1-1023: reserved port number

1024-64511: dynamically assign ports

64512-65535: registered port

Ssh:TCP/22

Http:TCP/80

Https:TCP/443

SMTP:TCP/25

POP3:TCP/110

IMAP:TCP/143

Telnet:T/CP22

Ftp:TCP/21

DCHP:UDP/67 (server) UDP/68 (client)

DNS:UDP/53 TCP/53

Text address for all port types:

In Windows system: C:\ Windows\ system32\ drivers\ etc\ services

In Linux system: / etc/services

In this list of files, the default communication interface mapping between application layer protocols and transport layer protocols is saved.

Source port: 16bits, the port number chosen by the sender when encapsulating data; generally speaking, the source port number of the data sent by the client is a randomly selected space port

Destination port: 16bits, the port number that the receiver of this data communication must use when transferring data from the transport layer to the application layer; generally speaking, the destination port number of the data is fixed

Note:

1. Generally speaking, during a round-trip communication, the port numbers of the two groups of data will be exchanged.

two。 When using the port, pay more attention to the accuracy of the target port; if the receiver cannot use the correct application to process the data because the target port is not clear, the data will be directly discarded by the transport layer protocol

Data length: 16bits, the length of the entire UDP Datagram, including the header

Data checksum: 16bits, the checksum of the entire UDP Datagram, ensuring data integrity to a certain extent

Transport layer protocol

TCP protocol:

Characteristics of TCP:

Transport layer of 1.TCP/IP protocol stack

two。 The network layer accessed by the application

3. Connection-oriented protocol

4. Full duplex mode operation

5. Error check

6. Packet serialization

7. Accept confirmation

8. Data recovery function

The first part of TCP protocol:

Source port number: 16bits

Destination port number: 16bits

Serial number: 32bits, serial number range: 1 ~ 2 ^ 32-2

The sequence number of the first segment is randomly selected

Sequence number of the second segment: sequence number of the previous segment + size of the data portion of the previous segment + 1

...

Confirmation number: 32bits, the range of confirmation number: 2 ~ 2 ^ 32-1

The receiver acknowledges the data that has been received and requires the sender to continue to transmit the identity of the subsequent segment; generally speaking, the confirmation number is the sequence number of the next segment to be sent by the sender

Header length: 4 bits, 24 bytes to 60 bytes.

Keep the flag bit: 3bits, not used for the time being

Authenticated encryption flag bit: 3 bits is used in IPv6, but not in IPv4.

TCP property flag bit:

URG: emergency pointer flag bit; if the flag position 1, the forwarding priority of the data will be raised so that such data is forwarded first; if the UGR flag bit of multiple data is set to 1 at the same time, the larger the emergency pointer of the next 16 bits, the higher the priority

ACK: the acknowledgement flag bit associated with the connection pipe; used to respond to the party initiating the connection establishment request or dismantling request

PSH: advance bit, if the flag position 1, the receiver can not add the data to the cache queue, directly to the application process for processing

RST: reset the connection flag bit; rebuild the TCP connection flag bit when the TCP connection runs out or fails

SYN: synchronization flag bit. In the process of establishing a TCP connection, the user actively sends a signal that the party requesting the establishment of the connection initiates the connection.

FIN: end connection flag bit. If the flag position 1, the other party will know that the TCP connection will be dismantled. Just confirm it.

Window size: 16bits, mainly to achieve traffic negotiation and control; can prevent network congestion

Slide the window:

Congestion window:

Emergency window:

The size of the window means the number of segments we can transmit at a time

Data segment checksum: 16bits, checksum information that ensures data integrity

Emergency pointer: 16bits, used to distinguish the priority of UGR flag bits when they are all set to 1

Option: timestamp of segment segmentation

Connection-oriented features of the TCP protocol:

1. Connection establishment: three-way handshake

1) the sender generates a TCP header data (no data part). In the header, the source and destination ports are given by the application protocol; the sequence number is randomly selected, the confirmation number is 0, and the flag SYN is set to 1.

2) after receiving the SYN request data sent by the sender, the receiver judges whether it can complete the data communication required by the other party; if so, it returns a specially generated TCP header data; the source and destination ports are exactly the same as the previous data; the sequence number is random, the confirmation number is the sequence number of the other party's next data, and the two flag bits of SYN and ACK are set to 1 at the same time.

3) after receiving the response data from the other party, the sender checks whether the ACK flag bit is set to 1; if it is 1, it will be confirmed if the SYN flag bit is set to 1; then the second TCP header data is generated (no data part); the serial number is the sequence number of the previous data + 1, and the confirmation number is the sequence number of the receiver's next data; ACK flag position 1

two。 Remove the connection; wave four times.

1) when all data transmission is finished, one party actively sends a FIN header data of TCP flag position 1 to the other party.

2) after receiving the data of such FIN setting 1, the other party responds to the confirmation data of an ACK setting 1

3) the other party initiatively sends out a TCP header data with FIN setting 1, requesting to remove the connection.

4) the active Terminator confirms and sends the ACK flag bit

Flow control characteristics of TCL protocol:

Passive flow control: congestion window

Due to the network congestion caused by the imbalance of network resources between the sender and the sender, the data buffer of the receiver overflows and a large amount of data is lost. The receiver sends an acknowledgement segment with a window size of 0 to the sender to suspend the sender's data transmission.

Active flow control: sliding window

Every time the two parties communicate with each other, they will negotiate the window size, taking the minimum window as the standard, and the sender sends data according to this window size.

Confirmation features of the TCL protocol:

1. Subsequent data will not be sent until the sender has received an acknowledgement from the receiver.

two。 If the sender does not receive the confirmation message from the receiver within a certain timeout period, the sender will retransmit the previously occurred data.

By confirming the characteristics, the reliable transmission of data can be guaranteed.

Build a simple network

First layer equipment

The first layer provides physical media and coding.

Example:

Ethernet

Serial

Repeater

Hub (HUB)

The physical interface of the network card

Layer 2 equipment

Layer 2 devices provide interfaces to physical media

Example:

Network card

Network bridge

Basic switch

Layer 2 addressing

MAC address (Media access Control, media access control, physical address form in Ethernet;)

Assigned end Devic

Layer 3 equipment and its public function

The network layer provides connectivity and path selection between two host systems.

For hosts, this is the path between the data link layer and the upper layer of the NOS.

For a router, it is the actual path through the network

The third tier establishment

Each NOS has its own layer 3 address format

OSI uses NSAP

TCP/IP uses IP

IPX/SPX uses IPX

Description of data communication process-- dual-computer interconnection

1. If the user does not specify a destination IP address in the application, the application automatically issues a query request to the DNS server to obtain the IP address of the corresponding target host

two。 Which protocol of the transport layer does the current application need to use? TCP is selected for further packaging.

3. The transport layer does not immediately send data for the application layer. Instead, the TCP protocol generates the segment header and establishes the TCP connection through a three-way handshake.

The 4.IP protocol will complete the data encapsulation according to the correct address and corresponding format, but the network access layer needs to transfer the data through the Mac address, so it is necessary to query whether there is a record of the Mac address corresponding to the IP address in the ARP cache.

5. If the record is not found, the TCP three-way handshake request will be temporarily stored in memory; the ARP protocol generates the ARP request packet and sends it out by broadcast; after the destination host receives it, it will first cache the Mac address of the source host, then encapsulate the host's IP address and Mac as data and return to the source host as unicast

6. The source host caches the Mac address of the destination host, and then encapsulates and sends the request for the TCP three-way handshake

7. When the TCP connection is established correctly, you can send data to the destination host as an application.

8. For each batch of TCP messages, the destination host must confirm

9. When all the data messages have been sent, remove the TCP connection with four waves

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report