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

Subnetting of Azure Virtual Network based on RFC1918

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

The Azure virtual machine private network IP uses the RFC1918 standard internal address space, which is limited to the following address space:

10.0.0.0/8

10.0.0.0-10.255.255.255

172.16.0.0/12

172.16.0.0-172.31.255.255

192.168.0.0/16

192.168.0.0-192.168.255.255

The understanding of the RFC1918 standard is involved in subnetting, and many non-network engineers are very upset. We help them understand that / x means that the subnet mask is converted to binary, with a total of x 1s from left to right.

After making this transformation, we can use the subnet mask to help the user understand the problem. Use the following knowledge to quickly understand how subnet masks work:

[1] calculate the subnet mask according to the number of hosts

A company has 666 computers to form a peer-to-peer local area network. What is the most appropriate subnet mask?

Class An addresses can hold more than 16.7 million hosts

Class B addresses can accommodate more than 65000 hosts

Class C addresses can hold 254 hosts

So category B seems to be more appropriate for the time being.

But class B default subnet mask 255.255.0.0, binary 1111111111111111.00000000.00000000, 2 ^ 16-2' 65536-2' 65534P 65534 hosts, too many.

Try to narrow it down and do a rough calculation.

2 ^ 9 = 512

2 ^ 10 = 1024

1024 > 666 > 512

Then it is more appropriate to choose 2 ^ 10, then the last 10 bits of the subnet mask is 0.

11111111.11111111.11111100.00000000

Decimal 255.255.252.0

The subnet mask 255.255.252.0 is appropriate

[2] use the subnet mask to determine whether the IP address is the same network segment

Let's start with two concepts:

(1) Network identification

IP 192.168.0.1

Subnet mask 255.255.255.0

The two make "and" operation.

11000000.10101000.00000000.00000001

11111111.11111111.11111111.00000000

Get

11000000.10101000.00000000.00000000

192.168.0.0 is the network identity.

(2) Host identification

IP 192.168.0.1

Subnet mask inverse 00000000.00000000.00000000.11111111

The two make "and" operation.

11000000.10101000.00000000.00000001

00000000.00000000.00000000.11111111

Get

00000000.00000000.00000000.00000001

0.0.0.1 is the host ID

Get to the point: if you want to be in the same network segment, you must achieve the same network identity, that is, (1) part of the operation to get the same result.

For example

Two IP

138.138.0.111

138.138.3.222

Subnet mask

255.255.254.0

Please determine whether the two IP are in the same network segment?

Two ways

(1) operate on the subnet mask "and" respectively

138.138.0.111

10001010.10001010.00000000.01101111

11111111.11111111.11111110.00000000

Get a network identity

10001010.10001010.00000000.00000000

138.138.3.222

10001010.10001010.00000011.11011110

11111111.11111111.11111110.00000000

Get a network identity

10001010.10001010.00000010.00000000

The bottom tenth of the two network logos are different, so they are no longer the same network segment.

(2) calculate all addresses of the network segment in which an IP is located

138.138.0.111

255.255.254.0

10001010.10001010.00000000.01101111

11111111.11111111.11111110.00000000

Look at the subnet mask to ensure that the network identity is the same, IP should do this

10001010.10001010.0000000x.xxxxxxxx

This address contains:

138.138.0.x

138.138.1.x

Then 138.138.3.222 is obviously not in the range of these two addresses, so it is not in the same network segment.

[3] actual combat

The company has 666 hosts. What is the appropriate setting for IP and subnet mask?

666 hosts. We have calculated before to choose a Class B IP address and subnet mask of 255.255.252.0.

Here's what we choose:

IP 172.16.x.x

Subnet mask 255.255.252.0

The following xy are either 0 or 1

10101100.00010000.yyyyyyzz.xxxxxxxx

11111111.11111111.11111100.00000000

According to the subnet mask, y can be filled in freely, so we will fill in all zero.

10101100.00010000.000000zz.xxxxxxxx

Then assign a value to z

10101100.00010000.00000000.xxxxxxxx

10101100.00010000.00000001.xxxxxxxx

10101100.00010000.00000010.xxxxxxxx

10101100.00010000.00000011.xxxxxxxx

172.16.0.x

172.16.1.x

172.16.2.x

172.16.3.x

So these four IP segments, each segment has 254IP addresses that can be allocated, in fact, a total of 1024-21022 IP addresses are available, including 666 IP addresses required by customers.

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

Network Security

Wechat

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

12
Report