Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I have problem calculating a subnet mask.
Suppose xyz college is planning to setup a small private network with network address 192.168.20.0. The number of departments in the college are 7 and the max no. of host in each department is 25. How to calculate subnet mask?
When I tried to google to find a tutorial for calculating such kind of problems, got nothing.
A mask of /27 will give you 5 bits for the host ip addresses and 5 bits will be enough to represent 25 hosts. Each department can go on a different network, eg: Dept A can be 192.168.20.0/27 and Dept B can be 192.168.21.0/27 etc...
I realize this question is 2 years old but thought I'd add to it if others come here with a homework problem similar to this one. Assuming that each network never needs more than 30 hosts, (it states that 25 will be the most) then you could use 5 host bits and 27 subnet identifier bits for each network.
5 bits can represent 30 hosts because:
2^5 = 32
So 32 numbers can be represented with 5 binary bits.
Subtract 2 because the lowest address in each subnet is the network address while the highest address is the broadcast
32-2=30 assignable addresses
4 bits would not have been enough as (2^4)-2=14.
If you go with more bits, you'll have larger gaps between subnets and potentially wasted addresses.
Generally, these are assigned as the lowest available addresses (at least they will be for the sake of your homework).
192.168.20.0 in binary = 11000000.10101000.00010100.00000000
While sashang's answer works, if this is homework, your professor will be looking for you to update the right most subnet identifier (or network identifier) bits first. We know there are 27 bits in the subnet identifier from the "/27" in CIDR notation. They are the first 27 bits in bold below.
11000000.10101000.00010100.00000000
If you increment from the far right and make 7 subnets, here's the subnet addresses you would get. I'll just bold the binary digits that will change and not the rest of the network address to the left.
11000000.10101000.00010100.00000000 = 192.168.20.0/27
11000000.10101000.00010100.00100000 = 192.168.20.32/27
11000000.10101000.00010100.01000000 = 192.168.20.64/27
11000000.10101000.00010100.01100000 = 192.168.20.96/27
11000000.10101000.00010100.10000000 = 192.168.20.128/27
11000000.10101000.00010100.10100000 = 192.168.20.160/27
11000000.10101000.00010100.11000000 = 192.168.20.192/27
Related
I have an Ipv4 180.3.0.0 (class B, network bits reserved - 16bits).
What are my possible subnet masks if i want my network to have at least 22 subnets and 120 maximum hosts?
I can understand that i need to give 5 bits for 22 subnets and 7 bits for 126 usable hosts but i can't undestand how when the question ask a minimum 22 subnets and a maximum 120 hosts each subnet.
What i tried so far is i tried to give certain bits to the subnet part and the others to hosts part, creating a range of possibilities but i don't see how that solves my problem.
Anyone can help me understand the logic behind this?
As I see it, the "at least" and "maximum" constraints indicate the priority of the values: the 120 maximum hosts carries a bit more weight as it dictates the size of mask you will need to use even after you've satisfied the number of subnets constraint. With a /16 network it would be easy to subnet it to provide more than enough large networks. For example, you could subnet it to a /24 and get 256 subnets (which is fine given the at least 22 networks condition) each with 254 host addresses. However, this fails the maximum 120 hosts constraint. So to satisfy the scenario you must select a mask that still provides many more subnets than required but that are each smaller in size (less than 120 hosts).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
According to TCP, sequence number is used to refer to bytes instead of being a counter. The sequence number is 32-bit integer (~4.2 GB).
If I am sending file directly using TCP, I can't exceed this number.
This was okay with old file-systems but now we have files exceeding this size.
I believe Application layer protocols has been modified to bypass this limit, can any provide an example for this or at least list the used techniques?
For reference, the question was based on the following problem
Textbook : Computer Networking: A Top-Down Approach by James F. Kurose , Keith W. Ross.
P26. Consider transferring an enormous file of L bytes from Host A to Host B.
Assume an MSS of 536 bytes.
a. What is the maximum value of L such that TCP sequence numbers are not
exhausted? Recall that the TCP sequence number field has 4 bytes.
If I am sending file directly using TCP, I can't exceed this number.
Yes you can. You are mistaken. It wraps around.
P26. Consider transferring an enormous file of L bytes from Host A to Host B. Assume an MSS of 536 bytes. a. What is the maximum value of L such that TCP sequence numbers are not exhausted? Recall that the TCP sequence number field has 4 bytes.
'Sequence numbers are not exhausted' is a constraint for the purposes of this question, but the authors aren't necessarily thereby claiming that such a limit applies to any TCP transmission. If they are, they're manifestly wrong. Consider that the initial sequence number is chosen randomly, and therefore can be 2^32-1. Does that imply a limit on that connection of one byte? Of course it doesn't.
I also note that the MSS of 536 bytes is entirely irrelevant to the question. Possibly this is just a substandard text.
EDIT I've now located this source. You didn't misunderstand it. There is nothing in the book about TCP sequence number exhaustion except for this stupid question. Nothing about it wrapping around either, which is a curious omission. The MSS is used in the second part of the book problem, not quoted here.
I'm studying IP classes and the topic of subnetting is confusing me.
I'm doing some practice questions and the question I'm stuck on requires me to find number of addresses under each subnet.
What I have so far is, a block 211.17.180.0/24 from which I was able to obtain subnet mask /24 = 255.255.255.0. And that there's 32 subnets. I'm not too sure how to proceed from this point. Normally, I would say there's 254 usable addresses (excluding 211.17.180.0 and 211.17.180.255) but I'm not sure how to deal with 32 subnets.
Ok, I may have figured out how to solve this problem
Since there are 32 subnets, I multiply by 2, getting 64 addresses(multiply because there are 2 unusable address per every subnet)
Then, 256-64=192/32=6, so, there are 6 addresses per every subnet in this block.
I'm not sure if this is the right way to solve this problem, some confirmation would be really appreciated!
From what I understand, the problem mentions that there are 32 subnets inside the /24 block.
Your answer is correct, here's an alternative way to think about it if you think this is confusing:
If there are 32 subnets, it means you'll need 5 bits to encode subnet identification (211.17.180.0/29 through 211.17.180.31/29), which leaves you with 3 usable bits for the host IP on each subnet; since 2 addresses are unusable on each subnet, we get at most 2^3-2 = 6 usable addresses per subnet.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
If you're given:
Number of needed subnets: 2
Network Address: 195.223.50.0
I can answer the following:
Address Class: C
Default Subnet Mask: 255.255.255.0
Custom Subnet Mask: 255.255.255.192
Total number of subnets: 2^2 = 4
Total number of host addresses: 2^6 (8-2 = 6)
Number of usable addresses: 2^6 -2
Number of bits borrowed: 2
BUT.... if I'm asked....
What is the 3rd subnet range?
What is the subnet number for the 2nd subnet?
What is the subnet broadcast address for the 1st subnet?
What are the assignable addresses for the 3rd subnet?
How would I answer these... All I remember from the procedure is to look at the last number in the Custom subnet mask (192) and do 256 - 192 to get 64 and then use 64 to increment something. But I'm not sure what each question is asking. Please help, and explain step by step for each question.
Also, what would be different if I was faced with the Address Class of B in this situation?
this really isn't a programming question, and we generally don't use Classful Addressing (A,B,C,D...) anymore as everything is now CIDR and VLSM (http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
But as you are using a subnet mask of 255.255.255.192 that equates to a /26 (64 IPS). to computer number of ips per CIDR you can use the following formula num ips (/x) = 2^(32-x) So /26 = 2^(32-26) or 2^6 which is 64.
The rest is basically just binary math.
1 /24 = 2 /25
1 /25 = 2 /26
1 /26 = 2 /27
And so forth.
So when breaking a /24 down into /26 subnets, you will get 4 Subnets of 64 hosts each.
(important to remember that each subnet's size will alway be a power of 2, and they always need to start on bit boundary).
So the first subnet will start at .0 (this isn't always the case, since if you are given a /27 and need to break it down into 4 /29's it is possible that it will start on a different number, but in the case of /24's first subnet is 0)
The IP of the subnet is the network, the last IP of the subnet is the broadcast, the rest of the ips are the useable host addresses.
To compute the useable IPs you would use 2^(32-x)-2. So in your case of /26 ,each subnet will have 62 useable IPS.
So back to first subnet.
195.223.50.0/26
195.223.50.0 is the network (first address)
195.223.50.64 is the broadcast (last address)
195.223.50.1 - 195.223.50.62 are useable hosts
The next subnet's network is 195.223.50.64, and the next one would be 195.223.50.128 and the last one would be 195.223.50.192
what is different when staring with a /16 (standard subnet size for legacy class b networks) is that you start off with 2^16 (65k) IPS to break up into subnets, as opposed to 2^8(256), an you have much greater room to be wasteful.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm reading one of the Distance vector protocol RIP and come to know maximum hop count it uses is 15 hops but My doubt is why 15 is used as maximum Hop count why not some other number 10,12 or may be 8 ?
My guess is that 15 is 16 - 1, that is 2^4 - 1 or put it otherwise: the biggest unsigned value that holds in 4 bits of information.
However, the metric field is 4 bytes long. And the value 16 denotes infinity.
I can only guess, but I would say that it allows fast checks with a simple bit mask operation to determine whether the metric is infinity or not.
Now the real question might be: "Why is the metric field 4 bytes long when apparently, only five bits are used ?" and for that, I have no answer.
Protocols often make arbitrary decision. RIP is a very basic (and rather old protocol). You should keep that in mind when reading about it. As said above, the max hop count will be a 4 byte field, where 16 is equivalent to infinity. 10 is not a power of 2 number. 8 was probably deemed too small to reach all the routers.
The rationale behind keeping the maximum hop count low is the count to infinity problems. Higher max hop counts would lead to a higher convergence time. (I'll leave you to wikipedia count to infinity problem). Certain versions of RIP use split horizon, which addresses this issue).