how to calculate subnet mask from ip address with example
how to calculate subnet mask from ip address with example
Discover how to calculate subnet mask from ip address with example, include the articles, news, trends, analysis and practical advice about how to calculate subnet mask from ip address with example on alibabacloud.com
There are two ways to compute the subnet mask:
Method One: Use the subnet number to calculate:
1. First of all, the number of subnets from the decimal number into binary number;
2. Then, the number of digits of the binary number obtained by the statistic is set to n;
3. Finally, the
(2, n)-2 (all zeros are used for network addresses, and all 1 is used for broadcast addresses)
The number of 1 in the subnet mask can be used to calculate the number of subnetworks.
For example, if the IP address is 151.244.20.34
Question:
If a company has 100 computers and a class C registered IP address segment: 218.102.142.0, its Intranet (LAN) needs to be further divided into two subnets, each with 40 computers and 60 computers,
Requirements:
(1) Specify the subnet mask;
(2) assume that the IP
This article mainly introduces how to use Python to calculate network segments based on IP addresses and subnet masks. It involves Python character string operation techniques based on the Linux platform and has some reference value, for more information about how to use Python to calculate network segments based on
This article describes how to verify the validity of IP addresses and subnet masks in js. For more information, see
The Code is as follows:
Function checkIP){Obj = ip;Var exp =/^ (\ d {1, 2} | 1 \ d | 2 [0-4] \ d | 25 [0-5]) \. (\ d {1, 2} | 1 \ d | 2 [0-4] \ d | 25 [0-5]) \. (\ d {1, 2} | 1 \ d | 2 [0-4] \ d | 25 [0-5]) \. (\ d {1, 2} | 1 \ d | 2 [0-4] \ d
is 202.112.14.159.In the ccna test, you also need to plan the subnet address and calculate the subnet mask based on the number of hosts on each network. This can also be calculated based on the above principles. For example, if a
mask in the actual application
255 128 0 0
255 192 0 0
。。。。。。
255 255 192 0
255 255 240 0
。。。。。。
255 255 255 248
255 255 255 252
What do these subnet masks mean? These subnet masks appear to divide a network into multiple networks.
2 Class C Network Division Examples
When the subnet is divided, the number of subnets i
, why calculate network addressThe bottom line is that the computers in the network can communicate with each other. First look at the simplest network, Figure 3 is to use a network cable (crossover) directly connect two computers. Here are several IP address settings to see if the network is on or off in different settings.1, set the
different networks, so it does not pass.Here is a conclusion: the computer with a direct connection to the network cable or through the hub (hub) or the ordinary switch between the computer to be able to communicate with each other, the computer must be on the same network, that is, their network address must be the same, And the host address must be different. If it is not a network will not be able to pa
is a private address and cannot be applied directly in the Internet. The Internet must be converted to a public address.I. Why do I need to calculate the network address?In a word, computers in the network can communicate with each other. first, let's look at the simplest network. Figure 3 uses a network cable (crossover line) to directly connect the two compute
network of no more than 254 computers, the use of "255.255.255.0" as a subnet mask, and now most of the local area network will not exceed this number, so "255.255.255.0" is the most commonly used IP address subnet mask , I see t
packets will be handed over to the default gateway for processing, this will inevitably increase the burden on the default gateway, resulting in reduced network efficiency. Therefore, the subnet mask should be set based on the network size. If a network has no more than 254 computers, you can use "255.255.255.0" as the subnet
the example we cited above, the same as the North Street tenants because the street names are North Street, and their respective number, so they can find each other.Computing Network address is to determine the network in the computer is not the same network, in can pass, not on theNote that this is not the same network that is referring to the IP
need to compute the subnet mask and allocate the corresponding host block, although using the binary calculation can draw the corresponding conclusion, but it is more convenient to calculate the decimal method. After long-term practice and experience accumulation, the author sums up the subnet
class C is not enough, it must be Class B ), however, the default subnet mask of Class B is 255.0.0, which can accommodate 60 thousand computers. Obviously, this is not suitable. How many subnet masks are suitable? Let's first list a formula.2 to the power of M = 560First, we confirm that 2 must be greater than the power of 8, because we know that the power of 2
I don't need to analyze it professionally. I use dummies to answer questions.
This is a simulated question. Use this question as an example.
URL type: Of course, it is Class B.
Convert the IP address and subnet mask to binary, and then perform operations on them.
145.1
bits and 1 are the same, the IP address belongs to the same network segment, the one after the 24-bit path changes randomly and belongs to the same network segment. In this example, the IP address (a) 188.188.0.111 is in the range of 188.188.0.0 ~ 188.188.1.255, which belon
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.