---
# System prepended metadata

title: 23 IPv6 Addressing and Subnetting

---

# 23 IPv6 Addressing and Subnetting

### Public and Private IPv6 Addresses
#### **Global unicast:**
Addresses that work like public IPv4 addresses.
**The organization that needs IPv6 addresses asks for a registered IPv6 address block**, which is assigned as a global routing prefix. 
After that, only that organization uses the addresses inside that block of addresses—that is, the addresses that begin with the assigned prefix.
:bulb: **在global routing**
#### **Unique local:**
Works somewhat like **private IPv4 addresses**, with the possibility that **multiple organizations use the exact same addresses**, and with no requirement for registering with any numbering authority.
:bulb: **Private IP在global是不會routing的** 只能在內網使用
### The IPv6 Global Routing Prefix
No other companies should use IPv6 addresses with that same prefix.
![](https://i.imgur.com/yIoixx1.png)

![](https://i.imgur.com/TWgOdWF.png)

**IANA** (Internet Assigned Numbers Authority)

- （American Registry for Internet Numbers，ARIN）
- （RIPE Network Coordination Centre，RIPE NCC）
- （Asia-Pacific Network Information Centre，APNIC）
- (Internet Service Provider，ISP）
![](https://i.imgur.com/uXdiXEN.png)

### Address Ranges for Global Unicast Addresses
Originally, IANA reserved all IPv6 addresses that **begin with hex 2 or 3 as global unicast addresses**. **(This address range can be written succinctly as prefix 2000::/3.)**
**Later IANA made the global unicast address range wider**, basically to include all IPv6 addresses not otherwise allocated for other purposes.


![](https://i.imgur.com/8gkTbTx.png)

### IPv6 Subnetting Using Global Unicast Addresses
Subnetting IPv6 addresses works generally like IPv4, but with mostly simpler math (hoorah!).
**Because of the absolutely large number of addresses available, most everyone uses the easiest possible IPv6 prefix length: /64.**
#### Deciding Where IPv6 Subnets Are Needed
![](https://i.imgur.com/5qNtSp3.png)

### The Mechanics of Subnetting IPv6 Global Unicast Addresses
![](https://i.imgur.com/g9EPECV.png)

![](https://i.imgur.com/qlWA7hA.png)

Now focus on the IPv6 global routing prefix and its prefix length. Unlike IPv4, IPv6 has no concept of address classes, so **no preset rules determine the prefix length of the global routing prefix.**

#### Address Structure for Company 1 Example
![](https://i.imgur.com/dd5i6UD.png)
With this structure, Company 1 can support 2^16 possible subnets (65,536). Few companies need that many subnets. Then, each subnet
supports over 10^18 addresses per subnet (2^64, minus some reserved values).


#### List All IPv6 Subnets
To find all the subnet IDs, you simply need to find all the unique values that will fit inside the subnet part of the IPv6 address, basically following these rules:
■ All subnet IDs begin with the global routing prefix.
■ Use a different value in the subnet field to identify each different subnet.
■ All subnet IDs have all 0s in the interface ID.

This company uses a global routing prefix of 2001:0DB8:1111::/48, which defines the first 12 hex digits of all the subnet IDs.

**Example**
![](https://i.imgur.com/s8FiTaf.png)

The example allows for 65,536 subnets, so clearly the example will not list all the possible subnets. However, in that fourth quartet, all combinations of hex values would be allowed.

#### Assign Subnets to the Internetwork Topology
![](https://i.imgur.com/DX2x1Ra.png)

#### Assigning Addresses to Hosts in a Subnet
![](https://i.imgur.com/uT5PQyL.png)

### Unique Local Unicast Addresses
![](https://i.imgur.com/6aCPWWJ.png)
**example**
- **adress :** fd12:3456:789a:1::1	
- **subnet :** fd12:3456:789a:1::/64