Computer Networks—Chapter 4 Network Layer Exercises (Part)

 Idea: Convert all prefix matches to binary, and separate each eight digits with ".". Then use the binary corresponding to the destination address to find the one that matches the prefix, which is the next hop address

        

    For ease of calculation, remember:

                2 to the 1st power: 2
                2 to the 2nd power: 4
                2 to the 3rd power: 8
                2 to the 4th power: 16
                2 to the 5th power: 32
                2 to the 6th power: 64
                2 to the 7th power: 128
                2 The 8th power: 256
                The 9th power of 2: 512
                The 10th power of 2: 1024

 untie:

        The network prefix corresponding to R3 is: 11000000.00000100.10011001.00

        The network prefix corresponding to m0 is: 10000000.01100000.00100111.0

        The network prefix corresponding to m1 is: 10000000.01100000.00100111.1

        The network prefix corresponding to R2 is: 10000000.01100000.00101000.0

        

        When calculating the destination address, the previous ones correspond directly (the network prefix is ​​the same), and only the last number is calculated. For example, if the first and the last are 10, the binary value of 10 is calculated, but it needs to be represented by eight bits, that is, 00001010. The next hop can be obtained by observing that the first digit corresponds to the last binary digit above.

        (1) 10 ——— 00001010 The next hop is m0

        (2) 12 ——— 00001100 The next hop is R2

        (3) 151———— 10010111 The next hop is R4

        (4) 17 ——— 00010001 The next hop is R3

        (5) 90 ——— 01011010 (01≠00) means there is no correspondence, so use the default, and the next hop is R4

 

 Idea: To do this question, it is best to draw a chart and fill in the numbers, which is more convenient to check and more intuitive. First of all, it depends on the length of the fixed header. Its range can be between 20 and 60, and it is subtracted when calculating. First calculate the number of fragments to be divided, and then calculate the slice offset.

Solution: Take the first part 20, 1500-20=1480

        4000/1480=3 (for further system) is divided into 3 data pieces

                                


                                        Data Field Length MF DF Fragment Offset

        Raw Datagram 4000 0 0                       


        Data piece 1 1480 1 0 0


        Data piece 2 1480 1 0 185


        Data Sheet 3 1020 0 0 370


Calculation of slice offset:

                Data slice 1: The first slice does not need an offset, so the offset is 0

                Data piece 2: 1480*1/8=185

                Data piece 3: 1480*2/8=370

As for why some headers on the Internet are 24, the reason is because: the length of each fragment outside the datagram fragment must be an integer multiple of 8 bytes, that is, the fragment offset cannot contain decimals. The first part is 20 fixed part and the variable part is up to 60, the unit is 4 

Analysis: The composition of the routing table is composed of: destination network address, destination network subnet mask, and next hop. The data is still filled in in the form of a drawing table, and the binary AND operation of the subnet mask and the destination address is required for forwarding. 

(1) Routing table of R


        Destination network address Destination network subnet mask Next hop

        145.13.0.1 255.255.192.0 direct delivery, interface m0 

        145.13.61.1 255.255.192.0 direct delivery, interface m1

        145.13.128.1 255.255.192.0 direct delivery, interface m2

        145.13.192.1 255.255.192.0 direct delivery, interface m3

                * Interface m4


(2)160And192 = 128

        The received packet is forwarded from the router's interface m2

calculate:

        Calculation of the subnet mask:

         It can be seen that each destination address is followed by 18 bits, namely 11111111.11111111.11000000.000000 

          Convert to decimal: 255.255.192.0

The penultimate digit of the destination address is 160, converted to binary: 10100000

The penultimate digit of the subnet mask is 192, converted to binary: 11000000


                                        10100000

         And                         11000000


                                        10000000


10000000 is converted to 128 in decimal, see Figure 128 corresponding to N3

Idea: Convert both the network address and the destination address into binary, and use the longest prefix matching criterion for judgment.

4-49 Solution:

         According to the longest prefix matching criterion, select route 3

4-50 solution:

         There is no problem with the longest prefix matching criterion. The problem lies in the IP address of host H. When assigning the host number of this network in the destination network 11.0.0.0/8, it is not allowed to reuse any address in route 3. This leads to duplication of addresses, causing confusion.

Guess you like

Origin blog.csdn.net/qq_61897141/article/details/127505441