- 2020-12-13 12:08
*views 2*- computer network

<>1. Subnet Division

ip Addresses are generally divided into a class ,b class ,c class ,d class ,e class IP address

A Class address ：1.0.0.1－126.255.255.254

B Class address ：128.1.0.1－191.255.255.254

C Class address ：192.0.1.1－223.255.255.254

d class e Class is generally not used

A Class default subnet mask is 255.0.0.0

B Class default 255.255.0.0

C Class default 255.255.255.0

network address = Subnet mask & ip address

Examples 1：

A host IP The address is 210.33.5.68, The subnet mask is 255.255.255.128. Find its network address

solution ：

255 All for 1, With any number & All for 1, So the first three numbers are all original numbers , The fourth number

01000100

&

10000000

128 & 68=0

so The network address is 210.33.5.0

Examples 2：

some A Class network 20.0.0.0 The subnet mask for is 255.224.0.0, Please determine the number of subnets that can be divided , Write the subnet number of each subnet .

solution ：

Because there is only one subnet mask 255, So it's time ip The address is a class , The second number of subnet mask is 224 Namely 11100000, We can see that A Class network with the second byte 3bit The subnet is divided , Therefore, the number of subnets is 2

3=8 individual .

8 The subnet numbers are ：

20.000 00000.0.0 Namely 20.0.0.0

20.001 00000.0.0 Namely 20.32.0.0

20.010 00000.0.0 Namely 20.64.0.0

20.011 00000.0.0 Namely 20.96.0.0

20.100 00000.0.0 Namely 20.128.0.0

20.101 00000.0.0 Namely 20.160.0.0

20.110 00000.0.0 Namely 20.192.0.0

20.111 00000.0.0 Namely 20.224.0.0

（ because 224 The first three binary numbers are 1, So it's divided 23 individual , And this 8 One is the complete permutation of three binaries , Just calculate it ）

Examples 3：

Will a c network 200.161.30.0 Divided into 4 Subnet , Please calculate the valid hosts for each subnet IP Address range and corresponding subnet mask

solution ：

the reason being that c class , So the default subnet mask is 255.255.255.0, So we should start from the fourth place , There are four subnets , Namely 22=4, Divided into 11000000 Namely 192,

So the subnet mask is 255.255.255.192

So the four network addresses are

200.161.30.00000000, Namely 200.161.30.0

200.161.30.01000000, Namely 200.161.30.64

200.161.30.10000000, Namely 200.161.30.128

200.161.30.11000000, Namely 200.161.30.192

each ip The range of addresses is ：

（ All are excluded 1 He Quanwei 0 Of ip address ）

Subnet 1：200.161.30.00 000001~200.161.30.00 111110, Namely 200.161.30.1 ~ 200.161.30.62

Subnet 2：200.161.30.01 000001~200.161.30.01 111110, Namely 200.161.30.65 ~ 200.161.30.126

Subnet 3：200.161.30.10 000001~200.161.30.10 111110, Namely 200.161.30.129 ~ 200.161.30.190

Subnet 4：200.161.30.11 000001~200.161.30.11111110, Namely 200.161.30.193 ~ 200.161.30.254

Examples 4：

The network address of a company is 192.3.2.0, Now it's divided into five subsidiaries , The largest subsidiary is 28 Computers , Each subsidiary is in a subnet , be

1. What is the subnet mask

2. 5 What are the network addresses of the subsidiaries

solution ：

the reason being that c Class address , Partition starts with the fourth byte , It needs to be divided into five word nets ,log2

5=3, At least three bits are required , The fourth byte of 8 individual bit, Host number 8-3=5 position , Therefore, each subnet can be allocated 25

-2=30 Host （ All for 1 He Quanwei 0 No division ）,30>28, So it can meet the requirements .

1. Top three bit by 1, Others are 0, Then the subnet mask is 255.255.255.11100000, Namely 255.255.255.224.

2. Because you need three bit, So it can be divided 23=8 Subnet , The address is as follows

192.3.2.000 00000 Namely 192.3.2.0

192.3.2.001 00000 Namely 192.3.2.32

192.3.2.010 00000 Namely 192.3.2.64

192.3.2.011 00000 Namely 192.3.2.96

192.3.2.100 00000 Namely 192.3.2.128

192.3.2.101 00000 Namely 192.3.2.160

192.3.2.110 00000 Namely 192.3.2.192

192.3.2.111 00000 Namely 192.3.2.224

<>2.IP Datagram fragmentation

IP Datagram is divided into header and data part

Examples 1：

The length of the data part of a datagram is 3400 byte （ Use fixed head ）, Now it's going through a network transmission , The network's MTU by 800 byte , Try to find

1. It should be divided into several datagrams

2. Data field length of each datagram

3. Offset field value of each datagram

solution ：

Fixed head size is 20 byte ,MTU Is the largest transmission unit ,MTU= First + Data section

So the length of each piece of data is 780,3400/780≈5, So there are five datagrams

Datagram data field length MF position （ Is there a datagram in the back ,1 yes 0 nothing ）DF position （ Can it be divided into pieces ）0 can 1 No slice offset （ Starting part /8）

Raw datagram 3400000

Data slice 1780100

Data slice 27801097.5

Data slice 378010195

Data slice 478010292.5

Data slice 528000390

Data slice 5 What's the length of that 3400 Subtract the first four 780, Data slice 2 The slice offset of is （780）/8, Data slice 3 by （780*2）/8 and so on .

<>3.CRC Check code / Cyclic redundancy code

Examples 1：

Generating polynomials p（x）=x3+x2+1, Information bits M by 101001

solution ：

1. Generating polynomials based on p（x） Determine divisor

p（x）=x3+x2+1 => Divisor 1101

2. Generating polynomials based on p（x） The highest order complement of 0,

p（x）=x3+x2+1 The highest order is 3, The information bit is followed by three 0 => 101001000

3. Let the information bit （ repair 0 after ） XOR with divisor , Get the remainder

4. Get the remainder to complete the number of digits , After the original information bit

We need to complete it with three numbers , therefore 1=>001,101001=>101001001

here 101001001 namely CRC Check code

Examples 2：

If the information code is 10110011, Generating polynomials G（X）=X4+X3+1, The calculated CRC The check code is （） .

solution ：

（1） Generating polynomials G(X) The corresponding binary number is 11011( yes X The power of , In the corresponding position, it is 1）

（2） The number of bits of check code is the highest degree of generating polynomial , That is, the check code generated by the generating polynomial is 4 position

（3） Because the number of bits of the check code is 4 position , Therefore, it is necessary to fill in the information code 4 individual 0, The information code is 101100110000

（4） Divide the complementary information code by the generating polynomial （ use “ model 2 division ”( In fact, it is also or ^), The remainder is CRC Check code .

<>4. Code division multiple access CDMA

Examples 1:

solution :

use S Multiply separately A,B,C,D And each number ÷8, The final number , by 0 I just didn't send it ,1 It's sending 1,-1 It's sending 0.

<>5. Byte padding

Examples 1：

One PPP The data part of the frame （ Write in hexadecimal ） yes 7D 5E FE 27 7D 5D 7D 5D 65 7D 5E. What is the real data

because PPP The flag field of the frame is 7E, therefore , To distinguish the flag field from the information field , The information fields appear in each of the 0x7E Turn into (0x7D,0x5E),0x7D Turn into (0x7D,0x5D).

therefore 7D 5E FE 27 7D 5D 7D 5D 65 7D 5E In fact, it is :

7D 5E FE 27 7D 5D 7D 5D 65 7D 5E

So the real data is 7E FE 27 7D 7D 65 7E

Technology

- Python146 blogs
- Java131 blogs
- Vue86 blogs
- Flow Chart79 blogs
- javascript42 blogs
- C++41 blogs
- programing language38 blogs
- MySQL37 blogs
- more...

Daily Recommendation

©2020-2021 ioDraw All rights reserved

The problem of string left rotation Interview essential ： Data structure time complexity and usage Remove outliers , use python to write matlab Of hampel(X) function BN layer pytorch realization Linux C Three methods of redirecting standard input and output to file [ Thesis reading ]HRNetV1,HRNetV2,HRNetV2p2021 World ranking of Computer Science Major ! This year's ranking reshuffle What certificates can big data test ? use Python and Pygame Implementation of code rain 2020 The 11th National Blue Bridge Cup B group C/C++