# 24 Implementing IPv6 Addressing on Routers
## Implementing Unicast IPv6 Addresses on Routers


### Static Unicast Address Configuration
Cisco routers give us two options for static configuration of IPv6 addresses.
1. In one case,you configure the full 128-bit address
2. while in the other, you configure a 64-bit prefix and let the router derive the second half of the address (the interface ID).
#### Configuring the Full 128-Bit Address

To statically configure the full 128-bit unicast address—either global unicast or unique local—**the router needs an ipv6 address address/prefix-length** interface subcommand on each interface.
The address can be an abbreviated IPv6 address or the full 32-digit hex address.

#### Enabling IPv6 Routing
On Cisco routers, **IPv4 routing is enabled by default, but IPv6 routing is not enabled by default.** The solution takes only a single command—ipv6 unicast-routing—which enables IPv6 routing on the router.
#### Verifying the IPv6 Address Configuration
- The show ipv6 interface brief
- The show ipv6 interface


### Generating a Unique Interface ID Using Modified EUI-64
- With IPv6, routers also typically use static IPv6 addresses, while user devices use DHCP or Stateless Address Auto Configuration (SLAAC) to dynamically learn their IPv6 address.
- IPv6 interface addresses,IOS supports two different methods to configure a stable address.
- One method uses the ipv6 address command to define the entire 128-bit address, as shown in Examples 24-1 and 24-2.

- The other method **uses this same ipv6 address command**, but the command configures only the 64-bit IPv6 prefix for the interface and lets the router automatically generate a unique interface ID.
This second method uses rules **called modified EUI-64 (extended unique identifier)**. Often,in the context of IPv6 addressing, people refer to modified **EUI-64** as just EUI-64;


stpe4 加入冒號 colon
接著拿第一個byte,第7bit顛倒

第7bit會0>1 或 1>0 所以參考下圖的話,一定是倆倆一組


G0/0 – MAC 0201.AA00.0001 – Interface ID 0001.AAFF.FE00.0001
G0/0 – MAC 30F7.0D29.8568 – Interface ID 32F7.0DFF.FE29.8568
### Dynamic Unicast Address Configuration
■ Stateful DHCP
■ Stateless Address Autoconfiguration (SLAAC)

### Special Addresses Used by Routers

**Link-Local Addresses**
IPv6 defines rules so that **packets sent to any link-local address should not be forwarded by any router to another subnet.**
As a result, **several IPv6 protocols make use of link-local addresses** when the protocol’s messages need to stay within the local LAN.
:bulb: **有效範圍只有在link local,線性拓樸的這個adrress才有效,把IPv6 enable就會有這個地址,這個address不允許重複但也不可能重複,這個IP也不會被routing**
:bulb: **主要用途自動配置地址、發現鄰居、發現router**
:bulb: **這個address也不會重複,後半段會用到MAC interface ID**,但如果手動配置則有可能重複
:bulb: **舉例像OSPF在建立routing會使用Link local,原因要有這個IP,它一定就是存在這個interface上,所以它是穩定的,而且又是唯一的**
:bulb: **但這兩點要互相通,必須互相知道對方的link local address**


**Routers also use link-local addresses as the next-hop IP addresses in IPv6 routes**, as shown in Figure 24-8. IPv6 hosts also use a default router (default gateway) concept.
Following are some key facts about link-local addresses:

### Creating Link-Local Addresses on Routers
IPv6 hosts and routers can calculate their own link-local address, for each interface, using some basic rules. First, all link-local addresses start with the same prefix.
Figure 24-9. By definition, the first 10 bits must match prefix FE80::/10, meaning that the **first three hex digits will be either FE8, FE9, FEA, or FEB.** However,**when following the RFC, the next 54 bits should be binary 0, so the link-local address should always start with FE80:0000:0000:0000** as the first four unabbreviated quartets.
The second half of the link-local address, in practice, can be formed using EUI-64 rules, can be randomly generated, or even configured.


First, examine the two pairs of highlighted entries in the example.
For each of the two interfaces that have a global unicast address (G0/0 and G0/0/0), the output lists **the global unicast, which happens to begin with 2001 in this case**. At the same time, the output also lists the **link-local address for each interface, beginning with FE80.**
### Routing IPv6 with Only Link-Local Addresses on an Interface
This chapter has shown **four variations** on the ipv6 address command so far.
1. ipv6 address address/prefix-length: Static configuration of a specific address
2. ipv6 address prefix/prefix-length eui-64: Static configuration of a specific prefix and prefix length, with the router calculating the interface ID using EUI-64 rules
3. ipv6 address dhcp: Dynamic learning on the address and prefix length using DHCP
4. ipv6 address autoconfig: Dynamic learning of the prefix and prefix length, with the router calculating the interface ID using EUI-64 rules (SLAAC)

Additionally, **the routers do not need to have global unicast (or unique local) addresses** on the WAN links for routing to work. **IPv6 routing protocols use link-local addresses as the next-hop address** when dynamically building IPv6 routes.
Additionally, static routes, as discussed in Chapter 25, “Implementing IPv6 Routing,” can use link-local addresses for the next-hop address.
### IPv6 Multicast Addresses
IPv6 uses multicast IPv6 addresses for several purposes.
Like IPv4, IPv6 includes a range of multicast addresses **that can be used by multicast applications**, with many of the same fundamental concepts as IPv4 multicasts.
### Reserved Multicast Addresses
Those broadcast packets were then sent as Ethernet broadcast frames, destined to the Ethernet broadcast address of FFFF.FFFF.FFFF

### Multicast Address Scopes


**Finally, the term link-local** has a couple of common uses in IPv6 and can be confusing as a result. The following descriptions should clarify the different uses of the term:
- ***Link-local address***: An IPv6 address that begins **FE80**. This **serves as a unicast address for an interface to which devices apply a link-local scope**. Devices often create their own linklocal addresses using EUI-64 rules. A more complete term for comparison would be linklocal unicast address.
- ***Link-local multicast address***: An IPv6 address that begins with **FF02**. This serves as **a reserved multicast address to which devices apply a link-local scope**.
- ***Link-local scope***: A reference to the scope itself, rather than an address. This scope defines that routers should not forward packets sent to an address in this scope.
### Solicited-Node Multicast Addresses
IPv6 Neighbor Discovery Protocol (NDP) replaces IPv4 ARP, as discussed in Chapter 25.


### Miscellaneous IPv6 Addresses

### Anycast Addresses
:bulb: 接收端有多個,但是封包只傳送到路由最近的接收端。
:bulb: Anycast addresses不能當來源位址,也不能指定給hosts。
:bulb: 格式跟unicast address一樣,所以分辨不出來
:bulb: 每個不同的anycast address對應某特定的服務, 服務內容視應用需求而定,並且是預先定義好的。目前anycast的實現只能指定給router,所有被指定到同一個anycast address的routers都將提供相同的特定服務。 當anycast封包在轉送過程中到達具有此anycast位址身份的router時,將被router攔截並做進一步處理。
Imagine that routers collectively need to implement some service. **Rather than have one router supply that service, that service works best when implemented on several routers.**
But the hosts that **use the service need to contact only the nearest such service, and the network wants to hide all these details from the hosts.**
Step 1. **Two routers configure the exact same IPv6 address**, designated as an anycast address, to support some service.
Step 2. In the future, when any router receives a packet for that anycast address, the other routers simply route the packet to the nearest router that supports the address.


### IPv6 Addressing Configuration Summary
