To understand subnetting simply, it is enough to learn subnetting (detailed explanation of examples)

Why subnetting?

1. Meet the needs of different networks for IP addresses

2. Realize the layering of the network

3. Save IP address

4. The default subnet mask can be further divided, called variable length subnet mask "VLSM"

Defects of classful IP address planning: The problem of using the default mask: the address range is too large or too small, resulting in a waste of IP addresses!

Let's first understand the rules through a few examples

practice makes perfect


Example 1: 192.168.1.100/29=255.255.255.248 Find network address, host address and broadcast address

Solution: Class C network has 24 bits, borrowing 5 bits, can divide 2^5=32 subnets, each subnet can accommodate 2^3-2=6 hosts

        block = 2^3 (host bits) = 256-248 (mask) = 8

        The closest multiple of 8 to 100 is = 96

So: Network address : 192.168.1.96/29

           Host address: 192.168.1.97~192.168.1.102

           Broadcast address: 192.168.1.103


Example 2: There is a class C network address segment 192.168.1.0/24, please use the variable-length subnet mask to assign IP addresses to the three subnets respectively

Requirements: The first department in three regions needs 30 hosts, the second department needs 20 hosts, and the third department needs 10 hosts

Method 1 (the number of hosts is a bit wasteful):

There are 3 departments, at least 2 digits are used to have 4 subnets, and the number of hosts in each department is 2^6=62, which meets the needs of 3 departments. At this time, the mask number is /26=255.255.255.192

block=2^6=64

So: the network segment of the first department is: 192.168.1.0/26

           The network segment of the second department is: 192.168.1.64/26

           The network segment of the first department is: 192.168.1.128/26

Method 2 (more precise division to save IP addresses):

The 30 hosts in the first department reserve at least 5 host bits (2^x-2>=30), borrow up to 3 bits, and have 8 subnets. At this time, the mask is /27

block=2^5=32

So: the subnet address is: 192.168.1.0/27

           Host address range: 192.168.1.1~192.168.1.30

           The broadcast address is: 192.168.1.31/27

The 20 hosts in the second department reserve at least 5 host bits (2^x-2>=20), borrow up to 3 bits, and have 8 subnets. At this time, the mask is /27

block=2^5=32

So: the subnet address is: 192.168.1.32/27

           Host address range: 192.168.1.33~192.168.1.62

           The broadcast address is: 192.168.1.63/27

The 10 hosts in the third department reserve at least 4 host bits (2^x-2>=10), borrow up to 4 bits, and have 16 subnets. At this time, the mask is /28

block=2^4=16

So: the subnet address is: 192.168.1.64/28

           Host address range: 192.168.1.65~192.168.1.78

           The broadcast address is: 192.168.1.79/28

In summary:

           The network segment of the first department is: 192.168.1.0/27

           The network segment of the second department is: 192.168.1.32/27

           The network segment of the first department is: 192.168.1.64/28


Example 3: A company has four departments: production department, sales department, finance department, and customer service department. The number of hosts in each department does not exceed 50 at most. If the company obtains a class C address 192.168.100.0/24, how should the subnet be divided?

Solution: For four departments, borrow at least 2 network bits, each department has 62 (there are 6 host bits left: 2^6-2) hosts

block=2^6=64

Network segment of production department: 192.168.100.0/26

Network segment of sales department: 192.168.100.64/26

Finance department network segment: 192.168.100.128/26

Network segment of customer service department: 192.168.100.192/26

Thinking: If the company has five departments, and the number of hosts in each department does not exceed 30 at most, how should subnets be divided?

Solution: Five departments borrow at least 3 host slots, and each department has 30 (there are 5 host slots left: 2^5-2) hosts

block=2^5=32

First subnet: 192.168.100.0/27

Second subnet: 192.168.100.32/27

Third subnet: 192.168.100.64/27

Fourth subnet: 192.168.100.96/27

Fifth subnet: 192.168.100.128/27


Example 4: Interview questions related to subnetting

First question: What is the subnet number of 61.179.150.39/28? What is the radio number? What is the range of available IP addresses?

Solution: block=2^4=16

The closest multiple of 16 to 39 is = 32

So: the subnet number is: 61.179.150.32/28

            The broadcast number is: 61.179.150.47/28

            Available IP address range: 61.179.150.33~61.179.150.46

Second question: Can 19.224.17.0/17 be configured on the interface of the router? If so, why? Why not?

Solution: block=2^7=128

      So the subnet address is: 192.224.0.0/17

      The available address range is: 192.224.0.1~192.224.127.254

      So 19.224.17.0/17 can be configured on the interface of the router

The third question: Are the two addresses 37.95.221.16/5 and 41.222.221.16/5 in the same network segment, and can they be pinged? Why?

37.95.221.16/5 blocks = 2^3 = 8 ; the multiple of 8 closest to 37 is = 32

So the network segment address is: 32.0.0.0/5

The available address range is: 32.0.0.1~39.255.255.254

41.222.221.16/5 blocks = 2^33 = 8 ; the multiple of 8 closest to 41 is = 40

So the network segment address is: 40.0.0.0/5

The available address range is: 40.0.0.1~47.255.255.254

Therefore, the two addresses are not in the same network segment, and they cannot ping each other. 

The fourth question: give the subnet number and broadcast number of the IP address 37.95.221.16 of the third question

Same question as above: subnet number: 32.0.0.0/5

              Broadcast number: 39.255.255.255


Through the above examples, I believe you have roughly understood it. It is very fast to find these addresses and use blocks to solve them!

2^m=The number of subnets generated after borrowing bits from the host, m is the number of bits borrowed

2^n-2=①The number of host IPs available in each subnet generated after borrowing from the host ②n is the remaining number of digits after the source host bits are removed and borrowed number and broadcast number are not available


On a calm day without wrinkles

Perhaps, living up to the time is the best effort, and hard work is the best self


©2022-4-24 yu

おすすめ

転載: blog.csdn.net/m0_53367084/article/details/124379057