08-28-2010 06:26 PM - edited 03-04-2019 09:35 AM
Hi every body.
In ipv4 i used the following steps to find valid ip range, subnet,next subnet
Example:
10.10.10.0/24
subnet:
256-255=1
10.10.10.0 is the subnet
next subnet :
should be the multiple of 1
so 10.10.11.0 is next subnet after subnet 10.10.10.0
valid ip range:
10.10.10.1--10.10.10.254
=============================
Let say we have ipv6 prefix i.e 2001:0000::/23
our goal is to find valid ip address range, network number, next network number. Here i am stumped.
thanks and have a great weekend.
Solved! Go to Solution.
08-29-2010 01:05 PM
Hello Sarah,
for IPv6 given the ultra big space no one cares of the number of hosts in a subnet.
The typical IPv6 subnet is an EUI-64 that has a 64 bit network portion and a 64 bit host portion.
Typical IPv6 prefix is a /48 that allows you to have 65535 /64 IPv6 subnets.
to be noted EUI-64 is taken from MAC address and 16 bits have a fixed value so in this case only 2^48 -2 are the possible hosts.
Hope to help
Giuseppe
08-30-2010 01:56 AM
Hello Sarah and Giuseppe,
Giuseppe is of course right. However, if taking this purely technically, a similar method (although not so straightforward) can be used to compute networks and their multiples in IPv6 addresses.
Let say we have ipv6 prefix i.e 2001:0000::/23
our goal is to find valid ip address range, network number, next network number. Here i am stumped.
Okay but let's take a more appropriate example, say: 2001:4118:ABCD::/46.
So the /46 prefix means that the "mask" (which is not used in this format in IPv6) is 16+16+8+6 bits long, translating into FFFF:FFFF:FFFC. How did I calculate that? Well, it is worth memorizing the following table of translation from decimal to hexadecimal mask byte:
Number of bits (CIDR) | Decimal value | Hexadecimal value |
---|---|---|
/0 | 0 | 0x0 |
/1 | 128 | 0x80 |
/2 | 192 | 0xC0 |
/3 | 224 | 0xE0 |
/4 | 240 | 0xF0 |
/5 | 248 | 0xF8 |
/6 | 252 | 0xFC |
/7 | 254 | 0xFE |
/8 | 255 | 0xFF |
Now note that each hexadecimal digit (0-9, A-F) is a direct expression of a 4-bit value. In hexadecimal notation, we can perform the binary AND on individual hexadecimal digits. Also note that for sake of easiness, we can translate each nibble to a value between 0 and 15 and compute the AND in decimal, then reconvert the result back to hexadecimal if that suits you better. Let's call this one hexadecimal digit (a group of 4 bits) a nibble.
So, to compute the address of the network, we have:
2001:4118:ABCD::
&&
FFFF:FFFF:FFFC::
The only "interesting" nibble here is the last one where the mask nibble is set to C (all other nibbles are uninteresting because any nibble bitwise ANDed with 0xF yields the same value again, and all other nibbles ANDed with 0 yield 0). All we have to do now is compute the binary AND of 0xD in the address and of the 0xC in the mask. Let's do it in decimal and in the very similar way to how we compute it for IPv4 addresses but here, we are in the scope of a single nibble so instead of subtracting the mask from 256, now we subtract the mask from 16:
0xD = 14 (nibble in the address)
0xC = 12 (nibble in the mask)
16 - 0xC = 16 - 12 = 4 - the networks are multiples of 4 on the interesting nibble
0xD = 14 rounded down to a multiple of 4 is 12 which is 0xC in hexadecimal
Thus, the network number in this case would be 2001:4118:ABCC::, and the next network would be 4 "steps" further at the interesting nibble and above: 2001:4118:ABC(C+4):: yielding 2001:4118:ABD0:: (note that 0xC + 4 = 0x10 so the predecessing nibble had to be incremented as well).
So the general process is:
I guess that after a longer practice the converting between decimal and hexadecimal will not be necessary anymore. This can be computed directly in hexadecimal, however, a care must be then taken to not to mix decimal and hexadecimal notations.
Please ask further if there is anything unclear!
Best regards,
Peter
08-29-2010 01:05 PM
Hello Sarah,
for IPv6 given the ultra big space no one cares of the number of hosts in a subnet.
The typical IPv6 subnet is an EUI-64 that has a 64 bit network portion and a 64 bit host portion.
Typical IPv6 prefix is a /48 that allows you to have 65535 /64 IPv6 subnets.
to be noted EUI-64 is taken from MAC address and 16 bits have a fixed value so in this case only 2^48 -2 are the possible hosts.
Hope to help
Giuseppe
08-29-2010 02:13 PM
Thanks Giuseppe.
08-30-2010 01:56 AM
Hello Sarah and Giuseppe,
Giuseppe is of course right. However, if taking this purely technically, a similar method (although not so straightforward) can be used to compute networks and their multiples in IPv6 addresses.
Let say we have ipv6 prefix i.e 2001:0000::/23
our goal is to find valid ip address range, network number, next network number. Here i am stumped.
Okay but let's take a more appropriate example, say: 2001:4118:ABCD::/46.
So the /46 prefix means that the "mask" (which is not used in this format in IPv6) is 16+16+8+6 bits long, translating into FFFF:FFFF:FFFC. How did I calculate that? Well, it is worth memorizing the following table of translation from decimal to hexadecimal mask byte:
Number of bits (CIDR) | Decimal value | Hexadecimal value |
---|---|---|
/0 | 0 | 0x0 |
/1 | 128 | 0x80 |
/2 | 192 | 0xC0 |
/3 | 224 | 0xE0 |
/4 | 240 | 0xF0 |
/5 | 248 | 0xF8 |
/6 | 252 | 0xFC |
/7 | 254 | 0xFE |
/8 | 255 | 0xFF |
Now note that each hexadecimal digit (0-9, A-F) is a direct expression of a 4-bit value. In hexadecimal notation, we can perform the binary AND on individual hexadecimal digits. Also note that for sake of easiness, we can translate each nibble to a value between 0 and 15 and compute the AND in decimal, then reconvert the result back to hexadecimal if that suits you better. Let's call this one hexadecimal digit (a group of 4 bits) a nibble.
So, to compute the address of the network, we have:
2001:4118:ABCD::
&&
FFFF:FFFF:FFFC::
The only "interesting" nibble here is the last one where the mask nibble is set to C (all other nibbles are uninteresting because any nibble bitwise ANDed with 0xF yields the same value again, and all other nibbles ANDed with 0 yield 0). All we have to do now is compute the binary AND of 0xD in the address and of the 0xC in the mask. Let's do it in decimal and in the very similar way to how we compute it for IPv4 addresses but here, we are in the scope of a single nibble so instead of subtracting the mask from 256, now we subtract the mask from 16:
0xD = 14 (nibble in the address)
0xC = 12 (nibble in the mask)
16 - 0xC = 16 - 12 = 4 - the networks are multiples of 4 on the interesting nibble
0xD = 14 rounded down to a multiple of 4 is 12 which is 0xC in hexadecimal
Thus, the network number in this case would be 2001:4118:ABCC::, and the next network would be 4 "steps" further at the interesting nibble and above: 2001:4118:ABC(C+4):: yielding 2001:4118:ABD0:: (note that 0xC + 4 = 0x10 so the predecessing nibble had to be incremented as well).
So the general process is:
I guess that after a longer practice the converting between decimal and hexadecimal will not be necessary anymore. This can be computed directly in hexadecimal, however, a care must be then taken to not to mix decimal and hexadecimal notations.
Please ask further if there is anything unclear!
Best regards,
Peter
08-30-2010 08:05 AM
Thanks Peter. I am working on it.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: