IPV6 Technical Notes (analysis IPv4toIPv6)

IPV6 Technical Notes

IPv6 address entry concept

What is IPv6?

IPv6, stands for Internet Protocol version 6, that is Internet Protocol version 6, also known as Internet protocol sixth edition. Is the Internet Engineering Task Force (IETF) designed to replace IPv4 next-generation IP protocol, the number of addresses can be compiled on a known address for every grain of sand around the world. As the biggest problem is the limited IPv4 network address resources, severely restricted the application and development of the Internet. IPv6 use, not only to solve a number of network address resource issues, but also to solve a variety of obstacles to access devices connected to the Internet.

IPv4 address of the predicament solution:

  1. nat (one static, dynamic address pool-many, pat), but nat resource-consuming recommended for use in the above firewall
  2. Subnetting
  3. Dhcp dynamic address assignment
  4. CIDR (classless address division) Classless Inter-Domain Routing
  5. enfroced better address managerment (strengthening the address management)

The advantages of IPv6 addresses

  1. ipv6 support a larger address space, the power of the number 2 ^ 128
  2. Multihomed (Multihoming), may be arranged at a plurality of interfaces ip above
  3. Autoconfiguration, stateless network device (a router) to automatically configure the IP address
  4. Plug and Play
  5. end to end without nat (not need nat techniques) the transmission end
  6. ipv6 cancel the broadcast address instead of to anycast address
  7. Routes more quickly, more quickly forwarded
  8. There are no broadcast and no arp, nor the network virus and network layer 2 storm
  9. No checksum, since the frame 2 and the upper layer TCP / IP has a checksum
  10. Extended head
  11. ipsec ipv6 enforce the use of safety technology
  12. ipv6 compatible dual stack support (ipv4 and ipv6), and support data conversion between ipv6 ipv4

IPv6 address format

IPv6地址的长度为128位,相比IPv4地址长度32位变的更长,因此IPv6地址采用每4位组合起来转换成16进制的方式,每4个16进制数再以冒号分隔成8段,例如:2001:0000:0001:00a2:0000:0000:0000:0ec3。每一节中起始的0可以省略,全是0的使用一个0表示。
省略前:2001:0000:0001:00a0:0000:0000:0000:0ec3
省略后:2001:0:1:a2:0:0:0:ec3
然后,用双冒号替代一组联续出现的0,只能取代一组,所以选最长的一组。
取代前:2001:0:1:a2:0:0:0:ec3
取代后:2001:0:1:a2::ec3
最终,2001:0000:0001:00a2:0000:0000:0000:0ec3 = 2001:0:1:a2::ec3

Ipv6 address representation is divided into three types, namely:

  1. The preferred format
    1. Representation is the preferred format ipv6 speak of 128
  2. Compressed representation
    1. A complete ipv6 address, the regular emergence of many zeros, will not affect the structure of the 0 address to write omitted representation, called compression format.
      1. The first case:
        • A complete ipv6 address if the continuous multiple segments are 0, then the multiple segments use a double colon to represent, in the compressed IPv6 addresses, an address can only appear a ::.
      2. The second case:
        • When expressed ipv6 address, write 0 will not allow omitting a portion of the leading segment, because they do not affect the structure.
      3. The third case:
        combine the first two methods, is about the whole of the four characters are all part of the written :: 0, 0 will be omitted meaningless not written, it is the most convenient structure representation may occur.
  3. ipv6 ipv4 is embedded in the
    not yet fully transition the network from ipv4 to ipv6 time, some devices can occur that is connected to the network ipv4, ipv6 and connected to the network, for such a situation, we need to address both represent ipv4 address, and it can represent ipv6 address. In the representation is defined two types of ipv6 address carried ipv4 address, they are "compatible ipv4 ipv6 address" and "ipv4 ipv6 address mapping."
    1. Compatible ipv6 ipv4 address
      ipv4 address used in "compatible ipv4 ipv6 address" must be a global ipv4 unicast address.
    2. ipv6 ipv4 address mappings
      defining a second class ipv6 ipv4 address containing the address embedded. This address type is used to represent ipv6 ipv6 node address.

ipv6 basic protocol header

Reference: https://ccie.lol/knowledge-base/ipv4-and-ipv6-packet-header/

ipv6 extension headers

  1. IPv6 basis header
  2. By-hop options header
  3. Destination Options header (first and a destination selected from the destination address field applied ipv6 additional destinations listed in the channel head)
  4. Routing Headers
  5. Segmented head
  6. Authentication Header
  7. ESP header
  8. Destination Options header
  9. Upper head
    using IPv6 extension headers, must be sorted from above, seen from the above sequence, then only the destination options extension header may appear multiple times in the same IP packet, and includes a case only care of routing extension header.

ipv6 defines six optional extensions:

  1. By-hop options header
  2. Routing Headers
  3. Segmented head
  4. Destination Options header
  5. Authentication Header
  6. Encapsulating Security

IPv6 address allocation

ipv6 prefix Address allocation The proportion accounted address Remark
::0/8 Reserved by IETF 1/256 [1]
0200::/7 Reserved by IETF 1/128 [2]
2000::.3 Global unicast 1/8
FE80::/10 Link-local unicast 1/1024 [3]
FEC0::/10 Ressrved by IETF(formely Site-local unicast)
FC00 :: / 7 Unique local ipv6 address 1/128
FF00 :: / 8 Multicast 1/256
Others Reserved by IETF

Three types of addresses IPv6

There are three main types of IPv6 addresses: unicast address, multicast address, and anycast address .

Unicast Address : identifier for a single interface, similar to an IPv4 unicast address. Sent to a unicast address of the data packets delivered to the interface identified by that address.

Unicast addressing mode, IPv6 Interface (Host) that uniquely identifies the subnet. IPv6 packet includes a source IP address and destination IP address. The host interface is equipped with a unique IP address in the network segment. When the network switch or router destined to a single host receives the unicast IP packet, it sends one of the output interface that is connected to a particular host.

Multicast (multicast) address : used to identify a group of interfaces (group of interfaces that typically belong to different nodes), similar to the IPv4 multicast address. Sent to the multicast address data packets identified by that address is transmitted to all interfaces.

IPv4 and IPv6 multicast mode the same. Destined for a plurality of host data packets on a particular multicast address. All hosts interested in this multicast need to join the multicast group. All interface to receive multicast packets of the group added and processed, while the other hosts are not interested in the multicast data is multicast data is ignored.

Anycast Address : identifies a set of interfaces (group of interfaces that typically belong to different nodes). A set of interfaces from a source node transmitting anycast packet data address identified by that address is transmitted to the nearest (to measure according to the routing protocol in use) an interface.

Introducing a new IPv6 addressing, called Anycast addressing. In this addressing mode, the plurality of interfaces (Host) are assigned the same anycast IP address. When the host wants to communicate with a host computer when equipped with any of a multicast IP address, it sends a unicast message. With the help of sophisticated routing mechanisms, routing cost, the unicast message is delivered to the nearest sender host.

IPv6 does not use function broadcast address, broadcast address instead of a multicast address.

IPv6-Prefix:
IPv6 network, routers use the IPv6 address to determine whether the Prefix in the same network, the more common way is to IPv6 128-bit
addresses cut into 64-bit 64-bit Prefix and the Interface ID, indicates the length of the IPv6 Prefix after the address is plus / xx,
e.g. :: 1/128 figure above, expressed as a 128-bit Prefix. Assuming that all IPv6 addresses using the Prefix 64, can have 2 ^ 64
networks, each network can accommodate 2 ^ 64 IP addresses, 264 2: 18446744073709551616, which is astronomical. So in the
IPv6 network, then the network does not need to have divided Subnet.

EUI-64 address:

IEEE EUI-64 format based. The format of the MAC address already exists as a 64-bit interface identifier, this unique identifier both locally and globally. IPv6 unicast addresses are used to identify a unique interface identifier of the interface on the link. IPv6 unicast addresses are currently required interfaces marked
identifier is 64 bits. IEEE EUI-64 format interface identifier from the link-layer address (MAC address) from the interface changes. IPv6 address
interface identifier is 64, while the MAC addresses are 48 bits, it is necessary (from a high of 24 after the start) is inserted into the MAC address
hexadecimal number FFFE (1111111111111110). To ensure the interface identifier obtained from the MAC address is unique, but also the Uni
Versal / the Local (the U-/ L) bit (bit 7 from the high-order bit) is set to "1." The resulting set of numbers which can serve as an interface standard EUI-64 format
identifier. IPv6 address is too long, if you want is a very painful individually configure IPv6 address port, using the EUI-64 can be set only Prefix
part, then the interface will automatically generate Interface ID using the MAC address, greatly reduce the workload.

举例,MAC地址:0012-3400-ABCD
中间插入FFFE使其成为EUI-64 Interface ID: 0012:34FF:FE00:ABCD
最后把第7位改成1:0212:34FF:FE00:ABCD

IPv6 Unicast Addressing (unicast)

Substantially IPv6 prefix, subnet ID, interface composition

Prefix: v4 address corresponding to the network ID
Interface ID: ID corresponding to the host address v4

There are three different types of IPv6 unicast address scheme:

There unicast global unicast address (public address), a link local address (a communication on the same link), the loopback address, address, unique local address (a private address) is not specified, the embedded addresses of Ipv4.

Global Aggregatable Address (2000::/4—3fff::/4),一个接口可配置多个Global地址。(一个端口可以配置多个全球可聚合单播地址,但是一个端口只能配置一个FE80::/10 FE80链路本地地址),可以理解为IPv4公网地址。提供给网络服务提供商。这种地址类型允许路由前缀的聚合,从而限制了全球路由表项的数量。

  1. 2001::/4,ipv6的第一个商业网
  2. 2002::/4,6to4 tunnel
  3. 2003::/16 用于实验用的地址

一般从运营商处申请到的IPv6地址空间为/48,三个最高有效位始终设置为001,再由自己根据需要进一步规划:

link-local (FE80::/10) 也称为链路本地地址,本链路唯一的,用在ipv6的路由协议里面,作为通信地址,每个网卡只能配置一个。可以理解为标识符或者定位符。链路本地地址的前10位为1111111010。此地址用于邻居发现协议,也用于无状态自动配置中本地链路上节点之间的通信。使用链路本地地址作为源或目的地址的数据报文不会被转发到其他链路上。通常使用FE80::/10表示。

Stateless Address Autoconfiguration(SLAAC)无状态地址自动配置。在IPv4网络中,我们可以通
过DHCP让端口自动获取到IP地址,而在IPv6网络里,则通过Auto-configuration来获取IP地址。前面我们
说过EUI-64可以自动产生Interface ID,所以现在要解决的就是如何自动获得Prefix。IPv6使用的是Stat
eless Address Autoconfiguration,Interface向Link-Local发出RS(Router Solicitation)多播
请求来获取配置参数,IPv6 Router回应RA(Router Advertisement)包含Internet层配置参数的路由器
宣告报文进行回应。

site local (FEC0::/10) 用于站点的,存在一定的争议,现在已经被收回了。

特殊地址

地址0:0:0:0:0:0:0:0/128不指定任何内容,称为未指定地址。 简化后,所有的0被压缩为:: / 128。

在IPv4中,地址0.0.0.0与网络掩码0.0.0.0表示默认路由。 相同的概念也适用于IPv6,地址0:0:0:0:0:0:0:0,网络掩码全0表示默认路由。 应用IPv6规则后,此地址压缩为:: / 0。

IPv4中的环回地址由127.0.0.1到127.255.255.255系列表示。 但在IPv6中,只有0:0:0:0:0:0:0:1/128表示环回地址。 环回地址后,可以表示为:: 1/128。

任意播地址(Anycast Address)

任播地址设计用来在多个主机或者节点提供相同的服务时提供冗余和负载分担功能。任播地址九游这样的性质:发送到任播地址的分组,被按照路由协议的侧脸距离,路由到该任播地址的“最近的”接口。任意播又称为泛播。

泛播对于提供某些类型的服务特别有用,尤其是对于客户机和服务器之间不需要有特定关系的一些服务,录入域名服务器和时间服务器,DNS等。MSDP的AnycastRP就是这样的一种典型应用。

任播地址时根据单播地址空间分配的,因此任播地址在句法上不能与单播地址相互。当单播地址分配给与多于一个接口时,该单播地址转化为任播地址。分得该地址的节点必须被显示配置,以便知道该地址是任播地址。这个地址是由路由协议定义的,不能手工配置,任意播地址只能出现在路由器上,并且不能作为数据包的原地址来使用。

任播地址是根据单播地址空间分配的,使用任何已定义的单播地址格式。

节点和路由器必须具备的IPV6地址

组播地址

IPv6 多播(组播)地址是一组接口的标识符(典型在不同节点上)。一个接口可以属于任何数目的多播组。

组播地址最高位前8位固定为全1,也就是“FFXX::/8”

img

永久分配的多播地址的“含义”独立于范围值。

例如,如果给“NTP服务器组”分配一个组ID 为101(16进制)的永久多播地址,那么

FF01:0:0:0:0:0:0:101意味着在相同接口(即,相同节点)上的所有NTP服务器(作为发送者)。
FF02:0:0:0:0:0:0:101意味着在相同链路上的所有NTP服务器(作为发送者)。
FF05:0:0:0:0:0:0:101意味着在相同站点内的所有NTP服务器(作为发送者)。
FF0E:0:0:0:0:0:0:101意味着在互联网中的所有NTP服务器。

常见的组播地址

所有节点地址:
FF01:0:0:0:0:0:0:1     FF01::1
FF02:0:0:0:0:0:0:1     FF02::1
上述多播地址标识范围1(接口本地)或范围2(链路本地)内的所有IPv6节点组。
所有路由器地址:

FF01:0:0:0:0:0:0:2     FF01::2
FF02:0:0:0:0:0:0:2     FF02::2
FF05:0:0:0:0:0:0:2     FF05::2
上述多播地址标识范围1(接口本地)、范围2(链路本地)或范围5(站点本地)内的所有IPv6路由器组。

IPv6组播地址的MAC地址映射

img

被请求节点组播地址Solicited-node

在IPv6组播地址中,有一种特别的组播地址,叫做Solicited-node地址(被请求节点组播地址)。
Solicited-node地址是一种特殊用途的地址.主要用于重复地址检测(DAD)和替代IPv4中的ARP。
Solicited-node地址由前缀FF02::1:FF00:0 / 104和ipv6单播地址的最后24位组成。
一个IPv6单播地址对应一个Solicited-node地址。Solicited-node地址有效范围为本地链路范围。
地址格式: FF02:0:0:0:0:1:FFXX:XXXX,具体的对应关系如下:

img

IPv6 Tunneling

将互联网完全从IPv4转换到IPv6将会是一个及其漫长的过程,目前IPv4仍然占据重要地位。所以在这个转
换的过程中,将会有相当长的一个时期IPv4与IPv6会共同存在于互联网当中。如果两张网完全各自独立是
不现实的,所以就需要一种技术实现IPv4可以与IPv6网络互通。IPv6 Tunneling可以让IPv6报文包裹在
IPv4之中进行传输,IPv6 Tunneling有两种技术,分别是ISATAP6to4 Tunnel

ISATAP

ISATAP(Intra-Site Automatic Tunnel Addressing Protocol)是一种IPv6转换传送机制,允许IPv6
数据包通过IPv4网络上双栈节点传输。它将IPv4地址夹入IPv6地址中,当两台 ISATAP 主机通讯时,可自
动抽取出IPv4地址建立Tunnel即可通讯,且并不需透过其它特殊网络设备,只要彼此间IPv4网络通畅即可。
ISATAP分为Server与Client两个角色,Client向Server请求IPv6地址并建立IPv6 Tunnel。这样Client
便可以透过ISATAP Server与IPv6网络通讯。

我们以下面的场景来演示一下ISATAP如何工作。

● R1和R2位于IPv4网络中,R1(ISATAP Client)的default Route指向R2,无法与IPv6网络进行通信。
● R2与R3跑EIGRP,让R1可以与R3(ISATAP Server)通过IPv4进行通信。
● R3是ISATAP Server,充当中介的角色,连接IPv4和IPv6网络。
● R3与R4跑OSPFv3。
● R4和R5位于IPv6网络中,只有IPv6地址,没有IPv4地址。

示例参考1:https://www.kclouder.cn/network-basic-ivp6/

6to4 Tunnel
ISATAP比较适合单机连接到IPv6网络,并且现在大部分OS都支持ISATAP,比如Windows、Linux系统。如果
希望把两个IPv6网络通过IPv4连接起来,即点对点连接,则使用6to4比较合适。我们以下图为例,这是一个
全路由网络的示例 ,来演示一下如何配置6to4 Tunnel将两个独立的IPv6网络通过IPv4网络打通。
● R2和R3位于IPv4网络中,配置6to4 tunnel。
● R1和R5位于IPv6网络A中,通过R1连接到R2。
● R4和R6位于IPv6网络B中,通过R4连接到R3。

示例参考2:https://www.kclouder.cn/network-basic-ivp6/

ICMPv6协议

ICMPv6由ipv6节点使用,用于报告在分组处理过程中出现的错误,以及执行其他网络互连层功能。icmpv6是ipv6的整体部分,是基础协议,在ipv6的next header取值为58.

消息通用格式:

类型: 指出消息类型。他的值决定其余数据格式。消息类型分为两类:出错消息和指示消息。

出错消息由在它们的消息type字段的二进制值的高阶位取0标识。于是,出错消息的消息类型从0到127;指示消息的消息类型值从128到255.

代码: 依赖于消息类型。它用于生产消息粒度的附加层。

校验和:用户检测ICMPv6消息和ipv6首部部分中的数据错误。

ipv6数据报文

上图显示了icmpv6报文中的通用消息格式、差错报文、通告报文

示例:

ping包时可以查看到回显请求和应答请求。

Type:Echo(ping) reply (129)


Type: Echo(ping) request (128)

==========

ICMPv6与ICMPv4报文类型的比较

了解更多报文类型可以有助于理解原理。

NDP(neighbor discovery protocal) 功能

  1. DAD重复复制检测
  2. 代替ARP
  3. 无状态自动配置
  4. MTU发送
  5. ICMPv6重定向
  6. 发现临近的,帮助转发分组的路由器
  7. 跟踪邻居可达性,侦听邻居链路层地址。

ipv6地址组播

DHCPv6协议

DHCPv6使用组播,所有的DHCP服务器和中继代理监听多播地址(链路范围的FF02::1:2),用于客户端和相邻的服务器及中继代理的通信之用,站点内的所有DHCP服务器侦听多播地址(站点范围的FF05::1:3),用于中继代理和服务器之间的通信。

DHCPv6使用UDP,DHCPv6客户端监听UDP端口546,而DHCPv6服务器和中继代理监听UDP端口547.

IPv6地址获取原理

IPv6地址分配原理有2种,一种是快速分配DHCP地址,另一种是请求多个IPv6地址。

  1. 2个数据包交互情况

当客户端并不需要服务器为其分配IP地址,而是需要获取诸如DNS Server、NTP Server这样的其他配置信息的时候,他只需要与服务器进行一个简单的只包含两个消息的交换即可。客户端发送一个DHCP配置SOLICIT消息到一个特定多播地址,请求地址和其他配置信息,该信息提示服务器:客户端可以接受一个立即的回应消息。而服务器以一个携带了被请求的配置信息的DHCP回应消息应答。所有配置给客户端使用的地址都包括一个有效生存期和首选生存期,为了在生存期到期后继续使用这些地址,客户端向服务器发送DHCP更新消息,服务器通过DHCP回应消息通告新的生存期。

  1. 4个数据包交互情况

要请求一个或者多个IPv6地址,客户端首先需要确定服务器的位置,然后再进行地址和配置新的请求。客户端首先发送一个DHCP Solicit消息到一个特定多播地址,来查找可用的DHCP服务器。所有符合客户单要求的服务器以DHCP Request消息来获取地址和其他配置。

OSPFv3路由协议

OSPFv3证书标准是RFC2740.

OSPFv3使用的协议号与OSPFv2一样,都是89.

OSPFv3协议报文的源IPv6除了虚连接外,依赖使用本地链路地址;目的IPv5地址则是选择ALLSPFRouters、ALLDRouters以及邻接路由器的本地链路地址(虚链路除外),ALLSPFRouters为组播IPv6地址FF02::5,ALLDRouters为组播IPv6地址FF02::6.

OSPFv3单area和DHCPv6配置示例

参考:https://www.kclouder.cn/huawei-ipv6/

实验拓扑:

这里我们将主机演示一下在华为交换机或路由器上配置IPv6地址进行通信、配置DHCPv6、通过配置OSPFv3演示IPv6路由基础、配置IPv6 over IPv4隧道以及配置IPv4 over IPv6隧道的方法。通过本篇文章,我们将掌握基本IPv6地址的配置方法、掌握OSPFv3路由协议的配置方法、掌握DHCPv6服务器功能的配置方法以及一些常见的IPv6命令的使用方法。

配置IPv6
1、我们以下图中的拓扑为例,R1、R2、R3通过一台交换机互联,我们需要在这三台路由器上配置IPv6地址,然后再启用OSPFv3以及DHCPv6。
2、首先在三台服务器的环回接口上配置IPv6全球单播地址,在所有路由器的g0/0/0接口上配置链路本地地址(Link-local)。以下命令以R1为例,以相同的方式配置R2和R3。
# R1
ipv6
int loopback 0
 ipv6 enable
 ipv6 address 2001:1::a 64
int g0/0/0
 ipv6 enable
 ipv6 address fe80::1 link-local

# R2
ipv6
int loopback 0
 ipv6 enable
 ipv6 address 2001:1::b 64
int g0/0/0
 ipv6 enable
 ipv6 address fe80::2 link-local
 
 # R3
ipv6
int loopback 0
 ipv6 enable
 ipv6 address 2001:1::c 64
int g0/0/0
 ipv6 enable
 ipv6 address fe80::3 link-local
 
3、配置完成后,查看并确认接口地址配置正确,并且是UP状态。
display ipv6 int g0/0/0
display ipv6 int loo0

img

4、配置OSPFv3,在路由器上开启OSPFv3进程,并指定三台路由器的router-id。然后在接口下使能OSPFv3进程并指定所属区域。以下命令以R1为例,以相同的方式配置R2和R3。
# R1
ospfv3 1
 router-id 1.1.1.1
int g0/0/0
 ospfv3 1 area 0
int loo0
 ospfv3 1 area 0

# R1
ospfv3 1
 router-id 2.2.2.2
int g0/0/0
 ospfv3 1 area 0
int loo0
 ospfv3 1 area 0
 
 # R1
ospfv3 1
 router-id 3.3.3.3
int g0/0/0
 ospfv3 1 area 0
int loo0
 ospfv3 1 area 0
 
5、配置完成后,在路由器上查看OSPFv3的邻居关系。可以看到OSPF邻接关系已经形成,R1为DR,R2为BDR,R3为DROther。
display ospfv3 peer

img

img

img

6、使用Ping ipv6命令检测链路本地地址和Loopback0接口的全球单地址是否可达。比如在R1上执行以下命令,如下图可以看到网络是可达的。
ping ipv6 fe80::2 -i g0/0/0
ping ipv6 2001:3::c

img

7、通过抓包可以看到ICMPv6类型的报文。

img

8、下面我们来配置DHCPv6,在R2上开启DHCPv6服务器功能,然后创建IPv6地址池并指定地址池中IPv6地址的前缀长度,再配置IPv6地址池中不参与自动分配的IPv6地址(通常为需要保留的网关地址)以及DNS服务器的IPv6地址。
dhcp enable
dhcpv6 duid ll
dhcpv6 pool pool1
 address prefix 2001:face::/64
 dns-server 2001:444e:5300::1
 excluded-address 2001:face::1

9、在g0/0/0接口配置IPv6地址为地址池中的网关地址,并配置DHCPv6服务器功能以及指定的地址池的名称。
int g0/0/0
ipv6 address 2001:face::1 64
dhcpv6 server pool1

img

10、在R1和R3上配置DHCPv6客户端功能,并在相应的接口下配置通过DHCPv6自动获取IPv6地址功能。同时,我们再配置一台PC自动获取IPv6地址。
dhcp enable
dhcpv6 duid ll
int g0/0/0
 ipv6 address auto dhcp

11、在R2上查看DHCPv6地址池的信息,可以看到有三个地址通过DHCPv6分配了出去。

img

12、在R1和R3上查看通过DHCPv6获取到的IPv6地址。

img

13、在PC上查看通过DHCPv6自动获取到的IPv6地址,注意自动配置的网关为R2的G0/0/0的链路本地地址。

img

14、测试一下DHCPv6地址的连通性。PC ping R2, R1 ping PC,R3 ping R1。

img

img

img

15、在R2上查看IPv6的路由表,可以看到loopback0的地址通过OSPFv3进行路由。

img

链路聚合LACP配置示例

1、以下图拓扑为例,两台交换机通过LACP链路相连,同时在两台交换机配置有两个VLAN(VLAN 100和VLAN200)并对应有各自的主机相连接,两台交换机再与R1相连用来访问外网。

2、首先在两台交换机上启用IPv6,然后创建VLAN100和VLAN200,然后配置LACP。
# 两台交换机同样的配置方法
ipv6
vlan batch 100 200
int eth-trunk 1
 mode lacp-static
 port link-type trunk
 port trunk-allow-pass vlan 200 300
int g0/0/1
 eth-trunk 1
 priority 100
int g0/0/2
 eth-trunk 1
 priority 100 
lacp priority 100

3、上述基本配置完成以后,创建VLANIF 100和VLANIF 200,并配置IPv6地址。以SW1为例。
# LSW1 配置
int vlanif 100
 ipv6 enable
 ipv6 address fc00:1::1/64
int vlanif 200
 ipv6 enable 
 ipv6 address fc00:2::1/64

# LSW2 配置
int vlanif 100
 ipv6 enable
 ipv6 address fc00:1::2/64
int vlanif 200
 ipv6 enable 
 ipv6 address fc00:2::2/64


4、配置连接主机的接口,以SW1为例(SW2使用同样的配置)。
int g0/0/3
 port link-type access
 port default vlan 100
int g0/0/4
 port link-type access
 port default vlan 100

5、配置连接路由器的接口,以SW1为例。
# SW1
interface g0/0/5
  port link-type hybird
  port hybrid pvid vlan 100
  port hybrid untagged vlan 100
 
# SW2
interface g0/0/5
  port link-type hybird
  port hybrid pvid vlan 100
  port hybrid untagged vlan 100
  

img

6、两台交换机配置完成以后,为4台PC配置好对应的IPv6地址。

7、配置路由器,启用IPv6并给两个接口配置好IPv6地址。

img

8、配置完成,在PC1上分别ping PC2和路由器的接口地址。

img

9、在PC3上分别ping PC4和路由器的接口地址。

img

IPv4toIPv6隧道配置示例

配置IPv6 over IPv4
1、如下图拓扑,R2与R3属于边界路由器,需要启动IPv4/IPv6双协议栈,并配置IPv6 over IPv4隧道。边界路由器收到从IPv6网络侧发出来的报文后,如果报文目的地地址不是自身且下一跳接口为Tunnel接口,就把收到的IPv6报文的数据部分加上IPv4报头,封装成IPv4报文转发到对端的边界路由器上,对端路由器执行报文解封装,去掉IPv4报头,然后将解封后的IPv6报文发送到IPv6网络中。

img

2、首先配置路由器使能IPv6,并配置IPv6地址。
R1:
ipv6
int g0/0/0
 ipv6 enable
 ipv6 address 2001::1/64
R2:
ipv6
int g0/0/0
 ipv6 enable
 ipv6 address 2001::2/64
int g0/0/1
 ip address 119.1.1.2 24
R3:
ipv6
int g0/0/0
 ipv6 enable
 ipv6 address 2002::3/64
int g0/0/1
 ip address 119.1.1.3 24
R4:
ipv6
int g0/0/0
 ipv6 enable
 ipv6 address 2002::4/64

3、在R2和R3上配置IPv6 over IPv4隧道。
R2:
int tunnel 0/0/1
 ipv6 enable
 ipv6 address 2020::2 /64
 tunnel-protocol ipv6-ipv4
 source 119.1.1.2
 destination 119.1.1.3

R3:
int tunnel 0/0/1
 ipv6 enable
 ipv6 address 2020::3 /64
 tunnel-protocol ipv6-ipv4
 source 119.1.1.3
 destination 119.1.1.2

img

4、隧道建立完成,为R1和R4上配置IPv6默认路由。
R1:
ipv6 route-static :: 0 2001::2
R4:
ipv6 route-static :: 0 2002::3

5、为R2和R3配置静态路由,下一跳需要指向隧道对端IPv6地址。
R2:
ipv6 route-static 2002:: 64 2020::3
R3:
ipv6 route-static 2001:: 64 2020::2

6、在R1上PR4的IPv6地址,可以Ping通说明IPv6 over IPv4隧道建立成功。

img

Guess you like

Origin www.cnblogs.com/passzhang/p/12057592.html