IPv6 Addressing

An IPv6 address is 128 bits long, written in 8 group of 2 bytes in hexadecimal notation (each digit indicates 8 bits).

Collapsing 0s

Can collapse a group containing all 0s, but no more than a single group. E.g.

1111:0000:2222:0000:3333:4444:5555:6666

can collapse to: 1111:2222:0000:3333:4444:5555:6666

invalid collapse: 1111:2222:3333:4444:5555:6666 ×

For groups that are not all 0s, can drop leading 0s. e.g.

1111:0000:2222:0333:0044:0005:ffff:ffff

can collapse to: 1111:2222:333:44:5:ffff:ffff

portions of IPv6 address

IPv6 address has a network portion (a.k.a. network prefix) and a host portion (a.k.a. interface identifier). 

The distribution of these fields varies depending on which classification the IPv6 traffic belongs to: {unicast, multicast, anycast}.

IPv6 link-local address

Link-local unicast: traffic from one device to another within the same network. 

A link-local address has its leftmost 10 bits set to 1111111010 and next 54 bits set to all 0s, so the first half is fe80:0000:0000:0000.

e.g.

interface identifier: 64 bits long, identifies a network interface on an endpoint host. Cut the 48-bit MAC address in half, insert value 0xfffe between each half, then invert the 7th bit of the 1st byte.

e.g. interface ID of MAC address 78:31:c1:cb:b2:56

 IPv6 address can be represented with CIDR like IPv6 address.

e.g. a link-local address with 64 bits of addressable space: fe80:0000:0000:0000:/64

IPv6 global unicast address

Global unicast: traffic that is routed over the public internet.

A global unicast address has its leftmost 3 bits set to 001, next 45 bits are global routing prefix, next 16 bits are subnet ID (similar to netmask portion in IPv4), then final 64 bits are interface ID. E.g.

global routing prefix: assigned to organizations by the Internet Assigned Numbers Authority (IANA), used to identify an organization’s IP space.

Routing prefix and subnet ID can vary in size.

原文地址:https://www.cnblogs.com/RDaneelOlivaw/p/14673338.html