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

What is the network connection and hierarchical model? What is the configuration method of ip?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What is the network connection and hierarchical model? What is the configuration method of ip? These problems may be encountered in our daily work. Through these questions, I hope you can gain more. Here are the details of uncovering these problems.

1. Briefly describe the OSI seven-layer model and the TCP/IP five-layer model.

The seven-tier OSI models are:

Application layer

Provide network services for application processes; provide user authentication

Presentation layer

Data representation

Ensure that the receiving system can read the data

Formatted data

Build data

Negotiate the data transfer syntax for the application layer

Provide encryption

Session layer

Host communication; establish, manage, and terminate sessions between applications

Transport layer

Ensure the reliability of data transmission

Establish, maintain and terminate virtual circuits

Through error detection and recovery

Information flow control to ensure reliability

Network layer

Routed packet

Choose the best path to transfer data

Support for logical addressing and routing

Data link layer

Define how to format data for transmission and how to control access to the network

Support for error detection

Physical layer

Electrical, mechanical, process and functional specifications are defined for starting, maintaining, and shutting down physical links

The five layers of TCP/IP are:

Application layer

Corresponding to the application layer, presentation layer and session layer of the OSI model

Transport layer

Internet layer

Data link layer

Physical layer

2. Summarize and describe TCP three-way handshake and four waves

Three-way handshake:

First handshake: when establishing a connection, the client sends a syn packet (syn=j) to the server and enters the SYN_SENT state, waiting for the server to confirm; SYN: synchronous sequence number (Synchronize Sequence Numbers).

Second handshake: when the server receives the syn packet, it must confirm the customer's SYN (ack=j+1). At the same time, it also sends a SYN packet (syn=k), that is, the SYN+ACK packet, and the server enters the SYN_RECV state.

Third handshake: the client receives the SYN+ACK packet from the server and sends an acknowledgement packet ACK (ack=k+1) to the server. After the packet is sent, the client and the server enter the state of ESTABLISHED (successful TCP connection) and complete the three-way handshake.

Wave four times:

1) the client process sends a connection release message and stops sending data. Release the header of the data message, FIN=1, whose sequence number is seq=u (equal to the sequence number of the last byte of the previously transmitted data plus 1), and the client enters the FIN-WAIT-1 (termination waiting for 1) state. TCP stipulates that FIN message segments consume a serial number even if they do not carry data.

2) the server receives the connection release message, sends out a confirmation message, ACK=1,ack=u+1, and takes its own serial number seq=v. At this time, the server enters the CLOSE-WAIT (shutdown waiting) state. When the TCP server notifies the high-level application process, the direction of the client to the server is released, and it is in a semi-closed state, that is, the client has no data to send, but if the server sends data, the client still has to accept it. This state will continue for a while, that is, the duration of the entire CLOSE-WAIT state.

3) after the client receives the confirmation request from the server, the client enters the FIN-WAIT-2 (termination waiting 2) state and waits for the server to send the connection release message (before that, it needs to receive the last data sent by the server).

4) after the server sends the final data, it sends a connection release message, FIN=1,ack=u+1, to the client. Since the server is in a semi-closed state, the server probably sends some more data. Assuming that the serial number is seq=w, the server enters the LAST-ACK (final acknowledgement) state and waits for confirmation from the client.

5) after receiving the connection release message from the server, the client must issue an acknowledgement, ACK=1,ack=w+1, and its serial number is seq=u+1. At this point, the client enters the TIME-WAIT (time waiting) state. Note that the TCP connection has not been released at this time. The time of 2 ∗∗ MSL (maximum message segment life) has elapsed, and the client will not enter the CLOSED state until the corresponding TCB is revoked.

6) as soon as the server receives the confirmation from the client, it immediately enters the CLOSED state. Similarly, after revoking the TCB, the TCP connection is terminated. As you can see, the server ends the TCP connection earlier than the client.

3. Describe the difference between TCP and UDP

TCP:

Provide reliable transmission

Connection-oriented protocol

Data recovery, retransmission

Flow control, sliding window

Congestion control

Error check

UDP:

Provide unreliable network access

Non-connection oriented protocol

Limited error checking

High transmission performance

Myriad data recovery features

4. Summarize the ip classification and the number of IP that can be allocated for each category.

According to the network number and host number, IP addresses are divided into three categories A, B, C and special addresses D and E. All zeros and all ones are reserved.

Class A: (1.0.0.0-126.0.0.0) (default subnet mask: 255.0.0.0 or 0xFF000000) the first byte is the network number, and the last three bytes are host numbers. The IP address of this class is preceded by "0", so the network number of the address is between 1 and 126. It is generally used in large networks. The number of IP that can be assigned is 2 ^ 24-2

Class B: (128.0.0.0-191.255.0.0) (default subnet mask: 255.255.0.0 or 0xFFFF0000) the first two bytes are the network number, and the last two bytes are the host number. The IP address of this class is preceded by "10", so the network number of the address is between 128 and 191. It is generally used in medium-sized networks. The number of IP that can be allocated is 2 ^ 16-2

Class C: (192.0.0.0-223.255.255.0) (subnet mask: 255.255.255.0 or 0xFFFFFF00) the first three bytes are the network number, and the last byte is the host number. The first IP address of this class is "110", so the network number of the address is between 192 and 223. It is generally used in small networks. The number of IP that can be allocated is 2 ^ 8-2

Class D: is a multicast address. The first IP address of this class is "1110", so the network number of the address is between 224 and 239. It is generally used for multicast users [1].

Class E: is a reserved address. The IP address of this class is preceded by "1111", so the network number of the address is between 240 and 255.

Of the three main types of IP addresses, three areas are reserved as private addresses, and the address range is as follows:

Class An address: 10.0.0.0510.255.255.255

Category B address: 172.16.0.0" 172.31.255.255

Class C address: 192.168.0.0" 192.168.255.255

5. Summarize the configuration methods of IP

1) Edit the Nic configuration file:

[root@centos7 ~] # cd / etc/sysconfig/network-scripts/

[root@centos7 network-scripts] # cat ifcfg-ens160

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

NAME=ens160

UUID=b6745d07-b1ff-41dc-9124-0935d0a295a4

DEVICE=ens160

ONBOOT=yes

IPADDR=10.1.1.109

PREFIX=24

GATEWAY=10.1.1.254

DNS1=202.96.128.166

2) configuration of ip and ifconfig commands (temporarily valid):

[root@centos7 ~] # ifconfig ens160 add 1.1.1.1 netmask 255.255.255.0

[root@centos7 ~] # ifconfig

Ens160: flags=4163 mtu 1500

Inet 10.0.1.109 netmask 255.255.255.0 broadcast 10.0.1.255

Inet6 fe80::ba9a:e268:3d85:c60b prefixlen 64 scopeid 0x20

Ether 00:0c:29:ce:c2:9e txqueuelen 1000 (Ethernet)

RX packets 4081510 bytes 1791828103 (1.6 GiB)

RX errors 0 dropped 131 overruns 0 frame 0

TX packets 1003259 bytes 1246680678 (1.1 GiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Ens160:1: flags=4163 mtu 1500

Inet 1.1.1.1 netmask 255.255.255.0 broadcast 1.1.1.255

Ether 00:0c:29:ce:c2:9e txqueuelen 1000 (Ethernet)

[root@centos7 ~] # ip address add 1.1.1.1 Plus 24 dev ens160

[root@centos7 ~] # ip a

2: ens160: mtu 1500 qdisc mq state UP group default qlen 1000

Link/ether 00:0c:29:ce:c2:9e brd ff:ff:ff:ff:ff:ff

Inet 10.1.1.109/24 brd 10.0.1.255 scope global noprefixroute ens160

Valid_lft forever preferred_lft forever

Inet 1.1.1.1/24 scope global ens160

Valid_lft forever preferred_lft forever

Inet6 fe80::ba9a:e268:3d85:c60b/64 scope link noprefixroute

Valid_lft forever preferred_lft forever

3) graphical interface configuration

The above is the specific introduction of the network connection and hierarchical model and ip configuration method, the content is more comprehensive, and I also believe that there are quite a number of tools that we may see or use in our daily work. Through this article, I hope you can gain more.

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