1

In IPv4, we had to find the Network Address using the IP address and the subnet mask. With IPv6 there's already the Network Prefix in the IP address.

Suppose I have an IP address A: 2001:db8:a0b:12f0::1/48 and B: 2001:2AC:CAD:0000::/64, the network prefix with mask for A is:2001:0db8:0a0b:0000:0000:0000:0000:0000 and B is: 2001:02AC:0CAD:0000:0000:0000:0000:0000. How can I determine whether these two devices will be able to communicate?
Any help will be greatly appreciated. Thanks.

1 Answers1

3

Given your additional comments, you're not asking if machines with specific addresses can communicate, you're asking if two addresses are in the same subnet. In the first case, things like routing and firewalling are relevant, the second is just math.

There's no real difference between subnet calculations in IPv4 and IPv6, it's just more bits. You can use normal techniques as explained in detail in this question, or you can use a tool like sipcalc to calculate this:

% sipcalc 2001:db8:a0b:12f0::1/48
-[ipv6 : 2001:db8:a0b:12f0::1/48] - 0

[IPV6 INFO]
Expanded Address    - 2001:0db8:0a0b:12f0:0000:0000:0000:0001
Compressed address  - 2001:db8:a0b:12f0::1
Subnet prefix (masked)  - 2001:db8:a0b:0:0:0:0:0/48
Address ID (masked) - 0:0:0:12f0:0:0:0:1/48
Prefix address      - ffff:ffff:ffff:0:0:0:0:0
Prefix length       - 48
Address type        - Aggregatable Global Unicast Addresses
Network range       - 2001:0db8:0a0b:0000:0000:0000:0000:0000 -
              2001:0db8:0a0b:ffff:ffff:ffff:ffff:ffff

% sipcalc 2001:2AC:CAD:0000::/64
-[ipv6 : 2001:2AC:CAD:0000::/64] - 0

[IPV6 INFO]
Expanded Address    - 2001:02ac:0cad:0000:0000:0000:0000:0000
Compressed address  - 2001:2ac:cad::
Subnet prefix (masked)  - 2001:2ac:cad:0:0:0:0:0/64
Address ID (masked) - 0:0:0:0:0:0:0:0/64
Prefix address      - ffff:ffff:ffff:ffff:0:0:0:0
Prefix length       - 64
Address type        - Aggregatable Global Unicast Addresses
Network range       - 2001:02ac:0cad:0000:0000:0000:0000:0000 -
              2001:02ac:0cad:0000:ffff:ffff:ffff:ffff

As you can see form the ranges, there's no overlap in these two networks.

Teun Vink
  • 17,433
  • 6
  • 46
  • 70