Question in some competition exam:
The subnet mask for a particular network is 255.255.31.0. Which of the following pairs of IP addressed could belong to this network?
1: 172.57.88.62 & 172.56.87.23
2: 10.35.28.2 & 10.35.29.4
3: 191.203.31.87 & 192.234.31.88
4: 128.8.129.43 & 128.8.161.55
Now I am having a confusion in this question that i have read that a subnet mask is of pattern:
1111 1111. 1111 1111. 1111 1
I mean 1's start from left side but in this subnet mask:
1111 1111. 1111 1111. 0001 1111. 0000 0000
So what is the actual principle behind. please explain. i am totally confused.
Thanks in advance :)
That's a discontiguous subnet mask, which is no longer supported on most routers. The principle is the same: convert the dotted-quad IP addresses and mask to 32-bit unsigned integers and AND each address with the mask. If the results are the same, they're in the same subnet.
This type of subnet mask is kind of theoretical rather than practical. We use subnet mask of all 1's from most significant bit and all 0's at the end just to ensure that hosts in a particular subnet gets contiguous IPs. But if we have a subnet like this : 255.255.31.0
We would not be able to allocate contiguous IPs to host in a particular subnet.
But still it is a possibility (theoretically). This kind of subnet masks are barely used in practice.
Coming to the question,
The idea to figure out the IPs belonging to same network is same as in the normal subnet mask scenario.
Just take 'AND' of bits of given IPs with subnet mask (needless to say, resultant would be network id)and check which turns out to be the same for the pair.
options-
(a). This is incorrect in the first place.
Net IDs : 172.57.(something).0 and 172.56.(something).0
second octet is different
(b). Net IDs : 10.35.28.0 and 10.35.29.0
This is incorrect since third octet is different.
(c). Net IDs : 191.203.31.0 and 192.234.31.0
Clearly, this is incorrect since second and third octet are different.
(d). This will be answer (Because rest three are incorrect).
let's check it,
128.8.129.43 AND 255.255.31.0 => 128.8.1.0
128.8.161.55 AND 255.255.31.0 => 128.8.1.0
BINGO !
So, network id turns out to be the same in both cases. So, (d) will be answer.
"There are 10 types of people in this world - one who understand ternary, one who don't and others who just thought that this is gonna be a 'binary' joke."
Ans: option (d)
Explanation:
Here is the question is: Which of the following pair of IP addresses belongs to the given network. Applying a subnet mask to an IP address separates network address from host address.
So you have to find the network-id from the IP address using the given subnet mask. Below shows the example of how to find a network-id from given Subnet mask and IP address
The network bits are represented by the 1's in the subnet mask, and the host bits are represented by 0's. Performing a bitwise logical AND operation on the IP address with the subnet mask produces the network address. For example, applying the Class C subnet mask to our IP address 216.3.128.12 produces the following network address:
IP: 1101 1000 . 0000 0011 . 1000 0000 . 0000 1100 (216.003.128.012)
Mask: 1111 1111 . 1111 1111 . 1111 1111 . 0000 0000 (255.255.255.000)
------------------------------------------------------
1101 1000 . 0000 0011 . 1000 0000 . 0000 0000 (216.003.128.000)
Therefore the network-id is: 216.003.128.000
Hence doing the above for all the options, you will find that option (d) belongs to the same network.
Related
What is the subnet (network and CIDR) for "half" of the IPv4 address space? I do not mind if this includes (it inevitable will) private/reserved IP subnets.
To put it even more in context: the subnet/CIDR for the whole IPv4 range is 0.0.0.0/0
The two ranges 0.0.0.0/1 and 128.0.0.0/1 cover the whole IPv4 space.
CIDR format is a.b.c.d/x where a, b, c and d are the decimal representation of the 4 bytes in the IPv4 address and x is the length of the subnet mask.
To divide the whole range
00000000.00000000.00000000.00000000 to 11111111.11111111.11111111.11111111
in two parts you just consider the ranges
00000000.00000000.00000000.00000000 to 01111111.11111111.11111111.11111111
+
10000000.00000000.00000000.00000000 to 11111111.11111111.11111111.11111111
I hope this answers your question.
there are 32 bits in an ipv4 address. All CIDR(classless Interdomain Routing) does is count the number of bits that are ones in sub net mask in the format /32 = 32 1's. Also called running ones from left to right. For 0.0.0.0/0 the cidr is /0 bc the subnet has 0 running ones in it.
Ex: 192.16.0.0 /16 = subnet mask 255.255.0.0 because there are 16 running one from left to right 11111111.11111111.00000000.00000000
In binary 8 ones = 255
Similarly, this concept is used for calculating VLSM(Variable length subnet masking)
Ex.
172.30.64.1 /18 = subnet mask 255.255.192.0
11111111.11111111.11000000.00000000 bc /18 means there are 18 running ones in the subnet mask. The third octet is 192 bc 11000000 in decimal is 128+64=192.
Hope this helps! -j
I am trying to understand how subnetting is involved in CIDR notation. As far as I understand, there is a network and host portion to every IP address. The netmask specifies how many leading bits should be used in this network portion, while the remaining bits become the possible hosts. Before CIDR was created, I understand that there were different classes A-D (0, 10, 110, 1111 leading bits) that had very specific netmasks, and that you could add a subnet mask by taking away some of the host bits.
What I am confused about is if you want subnets using CIDR notation, do you still need a separate subnet mask along with the CIDR notation? As far as I am aware, CIDR simply supports more flexible netmask length (so you don't end up having something like 65536 possible hosts when you only need like 400). But something like 174.43.8.0/23 still only has 1 single subnet, and 512 possible hosts. If you wanted subnets for this wouldn't you still need to add a subnet mask like 255.255.255.0 if you wanted 2 different subnets?
You're on the right track. CIDR provides a classless way of allocating subnets that is more versatile than the original Class A-C system. It is another way of specifying a subnet mark, but with a more compact notation than specifying a netmask like 255.255.255.0.
To understand CIDR, you have to first understand that that a subnet mask is four eight bit numbers (called octets) that form a 32 bit value. A CIDR of /24 or /8 is just a way of representing how many of the leftmost bits in that 32 bit value are 1's, with the 0's on the right side representing the size of the subnet (stay with me here...I'll make that clearer in a second).
If you want a subnet with 16 IP's, you need a netmask of 11111111 11111111 11111111 11110000. You'll notice that there are four zeros in that mask, and there are sixteen possible values that you can specify with four bits. Written in CIDR notation, this would be a /28 network (32 minus the four "zero" bits)
Similarly, if you want a subnet with 512 IP's, you need to set nine of the bits in your 32-bit subnet mask to zero (because a nine bit binary number has 512 possible values from 0-511). So that would be 32-9=23, or a /23.
Now one last thing you need to remember. For every CIDR, you will always have some IP addresses that can't be used for hosts (these are used for broadcast and gateway). You can find a nice cheat sheet showing the actual numbers here:
http://www.rjsmith.com/CIDR-Table.html
Hope that helps!
I am given a list of IPs, some of them have a netmask, other no.
I got the idea of how to create a mask but i'm not understanding why there are cases where an IP doesn't have a mask.
Like the following:
121.34.56.64–121.34.56.128 > Don't have mask
128.131.9.0–128.131.9.192 > Don't have mask
93.20.10.0–93.20.11.0 > Don't have mask
While the following actually have mask address:
67.56.34.64-67.56.34.79 > Prefix notation: 67.56.34.64/28 | Address/Mask: 67.56.34.64/255.255.255.240 and so on.
For example if I look at the third one of the addresses without mask i do the following:
93.20.10.0–93.20.11.0
93.20. 0000 101|0 . 0000 0000
93.20. 0000 101|1 . 0000 0000
NetMask: 255.255.254.0, that is not correct.
Can somebody explain me why and how to understand when a mask exists?
All IP addresses have a subnet mask and through Variable Length Subnet Masking (VLSM) they can change subnet masks depending on how we carve up the larger address pool.
Most likely your addresses are slightly off but based on the ranges given we can figure out what the masks should be.
Using your list:
121.34.56.64–121.34.56.128 if this range is inclusive then there are addresses in 2 subnets listed here and the actual range is probably 121.34.56.64-121.34.56.127 so the mask would be 255.255.255.192 or a /26.
128.131.9.0–128.131.9.192 if this range is inclusive then there are addresses in multiple subnets listed here and the actual range is probably 128.131.9.0-128.131.9.191. This is tricky since there isn't a mask that allows 192 addresses so it is likely that this isn't a single subnet but an aggregation of multipe subnets that could be 3 /26s, 6 /27s, 12 /28s, 24 /29s, 48, /30s, 96 /31s, or 192 /32s, or some combination of those. For example it could be 2 /26s and 2 /27s.
93.20.10.0–93.20.11.0 if this range is inclusive then there are addresses in 2 subnets listed here and the actual range is probably 92.20.10.0-92.20.10.255 so the mask would be 255.255.255.0 or a /24.
So you can deduce what some of the subnet masks might be but for the ones that don't fall on the subnet boundaries more information will be required.
This is a very simple question with a very simple answer, I apologize for asking it however as I found the answer isn't readily available and this may help somebody else.
I have a class C address 193.50.0.1 and am using the mask 28 to split it into 16 subnets with 14 hosts.
I understand that my first address would be:
Network 195.50.0.0/28
Netmask 255.255.255.240
Broadcast 195.50.0.15
Host range 195.50.0.1 – 195.50.0.14
But I am confused where the boundaries of the next subnet start, would be simple a matter of incrementing the start and ending positions for the next 15 subnets? for example would the next network be:
Network 195.50.0.16/28
Netmask 255.255.255.240
Broadcast 195.50.0.27
Host range 195.50.0.17 – 195.50.0.26
If not, how do I calculate the next subnet?
Here is the answer:
Network 195.50.0.16/28
Netmask 255.255.255.240
Broadcast 195.50.0.31
Host range 195.50.0.16 – 195.50.0.31
You can get host range by separating IP to NET_ID and HOST_ID
NET ID = (28bits) 11000011.00110010.00000000.0001
HOST ID = (4bits) 0000 ~ 1111
So the host range is :
11000011.00110010.00000000.00010000 195.50.0.16
11000011.00110010.00000000.00011111 195.50.0.31
You can use 'AND' operation to get Broadcast
195.50.0.16 11000011.00110010.00000000.00010000
(HOST_ID are '1') 00000000.00000000.00000000.00001111
-----------------------------------------------------------------------------------
Broadcast 11000011.00110010.00000000.00011111 = 195.50.0.31
Assume your company is given an address of 200.5.16.0/24, 5 subnets are required.
I found that:
Binary: 1111111.11111111.11111111.111000
Decimal: 255.255.255.224
Create a table that contains the network addresses of the subnets created within your network? Write down the Network Addresses, 1st and 2nd valid IP addresses in CIDR
(table displayed in below link)
http://gyazo.com/d93608e491c5197b21d0d64c34c3904a
Can someone do the first few for me and explain the process on how to do it? Thanks
The process of dividing a network into smaller network sections is called subnetting. This can be useful for many different purposes and helps isolate groups of hosts together and deal with them easily.
Each address space is divided into a network portion and a host portion. The amount the address that each of these take up is dependent on the class that the address belongs to. For instance, for class C addresses, the first 3 octets are used to describe the network. For the address 192.168.0.15, the 192.168.0 portion describes the network and the 15 describes the host.
By default, each network has only one subnet, which contains all of the host addresses defined within. A netmask is basically a specification of the amount of address bits that are used for the network portion. A subnet mask is another netmask within used to further divide the network.
Each bit of the address that is considered significant for describing the network should be represented as a "1" in the netmask.
For more details, please r
http://www.cisco.com/c/en/us/support/docs/ip/routing-information-protocol-rip/13788-3.html
You already figured out that with this mask 1111111.11111111.11111111.11100000 you can create 5 networks, just put numbers in them:
Mask: 11100000
Subnetworks:
00000000 = 0
00100000 = 32
01000000 = 64
01100000 = 96
10000000 = 128
10100000 = 160 - 192
The problem here is that you are not using the upper 64 addresses (192-255).
Alternative
You can make 4 subnetworks and split the last one:
Mask: 11000000
Subnetworks:
00000000 = 0
01000000 = 64
10000000 = 128
11000000 = 192 (split this one)
Subnetwork: 200.5.16.192/26
Mask: 11100000
Subnetworks:
11000000 = 192
11100000 = 224