冒分十六进制表示法
格式为X:X:X:X:X:X:X:X,其中每个X表示地址中的16b,以十六进制表示 例如:ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 这种表示法中,每个X的前导0是可以省略的
0位压缩表示法
在某些情况下,一个IPv6地址中间可能包含很长的一段0,可以把连续的一段0压缩为“::”。但为保证地址解析的唯一性,地址中”::”只能出现一次 例如
FF01:0:0:0:0:0:0:1101 → FF01::1101 0:0:0:0:0:0:0:1 → ::1 0:0:0:0:0:0:0:0 → ::
内嵌IPv4地址表示法
为了实现IPv4-IPv6互通,IPv4地址会嵌入IPv6地址中,此时地址常表示为:X:X:X:X:X:X:d.d.d.d,前96b采用冒分十六进制表示,而最后32b地址则使用IPv4的点分十进制表示,例如::192.168.0.1与::FFFF:192.168.0.1就是两个典型的例子,注意在前96b中,压缩0位的方法依旧适用
R1-R4的全局和相关接口都使用ipv6功能,同事生成本地链路地址(R1为例)
[R1]ipv6
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ipv6 enable
[R1-GigabitEthernet0/0/0]ipv6 address auto link-local
[R1-GigabitEthernet0/0/0]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address 2001::1/64
ipv6 address auto link-local
#
return
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address 2001::2/64
ipv6 address auto link-local
#
return
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 2002::1/64
ipv6 address auto link-local
dhcpv6 server pool1
#
return
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/2
ipv6 enable
ipv6 address 2003::1/64
ipv6 address auto link-local
undo ipv6 nd ra halt
#
return
[R2]dhcp enable
[R2]dhcpv6 pool pool1
[R2-dhcpv6-pool-pool1]dis this
[V200R003C00]
#
dhcpv6 pool pool1
address prefix 2002::/64
#
return
[R2-dhcpv6-pool-pool1]int g0/0/1
[R2-GigabitEthernet0/0/1]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 2002::1/64
ipv6 address auto link-local
dhcpv6 server pool1
#
return
[R3]dhcp enable
[R3-GigabitEthernet0/0/0]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address auto link-local
ipv6 address auto dhcp
#
return
[R2-GigabitEthernet0/0/2]dis this
[R2-GigabitEthernet0/0/2]undo ipv6 nd ra halt
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address auto link-local
ipv6 address auto global
#
return
[R4]ipv6 route-static 2001:: 64 2003::1
[R4]ipv6 route-static 2002:: 64 2003::1
[R1]ipv6 route-static 2002:: 15 2001::2
[R3]ipv6 route-static :: 0 2002::1