vPC是一种实现跨设备链路聚合的机制,基于LACP进行了扩展,能够实现多台设备间的链路聚合,从而把链路可靠性从单设备级提高到了多设备级。目前,vPC可以在Cisco Nexus 9000、7000、5000和3000系列平台上实施。
名词
- VPC - Virtual Port Channel
- VPC Peer - 指的是通过vPC Peer-link链接的两台相邻交换机,其它设备通过Multi-Channel Ethernet (MEC)跟这两台交换机链接。
- VPC Peer-link - 用于同步和转发两台VPC PEER的数据,包括组播,广播,单播等。需要至少10G以上的端口链接。
- VPC Peer Keepalive Link - 提供一个L3通道来再次验证两个VPC PEER是否运作正常。可以检测出VPC Peer自己是否发生故障或者对方已经关闭。它不转发和同步数据,使用UDP 3200端口,默认检测时间为1秒超时5秒。
- VPC domain - 通过domain ID来区分不同domain。
- VPC Member port - 加入VPC Peer-link的端口。
- Cisco Fabric Service (CFS) - 该协议用于有状态的同步和配置,不需要进行额外的配置。
vPC配置步骤
vPC配置通常有9个步骤,应该注意的是,vPC 配置的顺序很重要,基本的 vPC 设置是通过使用前 4 个步骤建立的:
步骤 1:开启vPC特性并在两台 Nexus 交换机上配置 vPC domain ID。
步骤 2:选择一个Peer Keepalive链接部署方式。
步骤 3:建立vPC Peer Keepalive链接。
步骤 4:配置vPC Peer-Link,完成全局 vPC 配置。
步骤 5:将vPC配置到下游交换机或设备。
步骤 6:(可选)开启peer gateway以优化HSRP。
步骤 7:(可选)开启peer switch特性来优化vPC的STP。
步骤 8:(可选)其它优化VPC设定。
步骤 9:(可选)验证vPC参数。
CISCO NEXUS VPC 配置示例
这里我们以两台N5K交换机为例来配置vPC。两台交换机分别命名为N5k-Primary和N5k-Secondary。
步骤 1:开启vPC特性并在两台 Nexus 交换机上配置 vPC domain ID。
两台交换机必须使用相同的domain ID,这里把domain ID配置为1。show vpc role
命令的显示的系统MAC地址来自vPC的domain ID,它等于01。
步骤 2:选择一个Peer Keepalive链接部署方式。
Peer Keepalive有如下部署方式:
这里我们采用第二种方式启用SVI进行。先启用一个专用VLAN,然后配置SVI并划分到一个专用VRF里面来区分和隔离其它流量。默认情况下,vPC Peer Keepalive数据包使用管理接口并在VRF management中传输。但是强烈建议为vPC Peer Keepalive链路单独配置一个VRF,以确保Peer Keepalive流量始终在Peer Keepalive链路上传输,而从不在Peer-Link上传输。
这里我们使用接口Ethernet1/32用作Peer Keepalive的专用接口:
验证peer keepalive链接:
前几个包丢包是正常现象,因为交换机需要首先发出 ARP 请求以获取192.168.1.1的MAC地址,然后发送 ICMP数据包。
步骤 3:建立vPC Peer Keepalive链接。
在两台交换机上使用show vpc peer-keepalive
命令验证:
步骤 4:配置vPC Peer-Link,完成全局 vPC 配置。
开启lacp特性,并建立PortChannel用于vPC Peer-Link。
把PortChannel配置成Trunk,并允许相关Vlan流量。建议排除Peer Keepalive VLAN,如上面配置的Vlan 23,同时不建议在该Trunk上允许non-vPC VLAN,因为这种配置可能会导致当vPC出现问题时non-vPC VLAN的流量中断,如果VPC同行链接失败。
在两台交换机上使用show vpc
验证:
步骤 5:将vPC配置到下游交换机或设备。
上述步骤中已正确建立vPC域,因此现在可以为下游交换机配置vPC。这台下游交换机将分别连接到两台vPC Peer交换机,以增加冗余和带宽可用性。
步骤 6:(可选)开启peer gateway以优化HSRP。
在vPC中使用HSRP没有任何特殊配置,同正常的HSRP操作一样,Active HSRP接口响应ARP请求,区别的是vPC HSRP(active 和 standby)均会转发流量。
如果发送到3层网关的帧使用MAC burn -in-address(实mac)而不是HSRP MAC(虚mac)地址,那么因PortChannel hash可能会将它转发到错误的vPC peer,而该错误的vPC peer将会通过vPC peer link将帧发给另一个vPC peer。这样因为 vPC duplicate prevention rule,帧将不会再给vPC成员端口。解决以上问题的配置命令:peer-gateway。该命令允许vPC peers 交换各自的BIA MAC地址的信息,这样它们就可以在本地直接转发流量,而不必通过vPC peer link转发流量。
步骤 7:(可选)开启peer switch特性来优化vPC的STP。
通常情况下,我们需要将Primary Switch配置成root primary,将Secondary Switch配置成此root secondary。开启peer switch特性后可以使两台vPC交换机运行为单个生成树根。加快了vPC交换机出现故障时STP的收敛速度。