1、什么是端口捆绑?
在我们深入研究 vPC 之前,快速回顾一下端口捆绑很重要。
端口捆绑是一种提供将多个接口聚合(绑定)在一起的技术。然后流量呗负载分担到每个连接上。端口捆绑提供 3 个主要优势,
- 冗余- 如果接口之一出现故障,流量将通过其余链路发送。
- 带宽- 由于将多个接口捆绑在一起而增加了带宽。然后在“捆绑”中的每个链接之间对流量进行负载平衡。
尽管端口捆绑很棒,但问题是“捆绑”中的所有链接都必须来自同一交换机上的端口。
2、什么是 vPC?
vPC(虚拟端口捆绑),也称为多机箱 EtherChannel (MEC),是 Cisco Nexus 交换机上的一项功能,可提供跨多个交换机(即 vPC 对等体)配置端口捆绑的能力。
vPC 类似于 Catalyst 6500s 上的虚拟交换机系统 (VSS)。但是,vPC 和 VSS 之间的主要区别在于 VSS 创建单个逻辑交换机,这样的结果是管理和配置都在同一个控制平面。而使用 vPC,每台交换机都是独立管理和配置的。
请务必记住,使用 vPC 时,两台交换机都是独立管理的。这意味着您需要在两台 Nexus 交换机上创建并允许您的 VLAN。
3、组件
vPC 由以下组件组成。下面的示例图显示了关键的 vPC 组件,
让我们看看每个 vPC 组件,
- vPC 域- 包括 vPC 对等点、KeepAlive 链接和使用 vPC 技术的端口捆绑。
- vPC 对等交换机- vPC 域中的另一台交换机。每个交换机都通过 vPC 对等链路连接。还值得注意的是,一个设备被选为主要设备,而另一个设备被选为次要设备。
- vPC Peer-Keepalive 链路- 连接两个 vPC 对等交换机并传输进出每个对等交换机的监控流量。执行监控以确保交换机正常运行并运行 vPC。
- vPC 对等链路- 连接两个 vPC 对等交换机,并将 BPDU、HSRP 和 MAC 地址传送到其 vPC 对等方。在 vPC 成员端口发生故障时,它还携带单播流量到对端交换机。
- 孤立端口- 孤立端口是配置有 vPC VLAN(即通过 vPC 对等链路承载的 VLAN)且未配置为 vPC 成员端口的端口。
4、孤立端口
如前所述,孤立端口是未配置为 vPC 成员端口并配置有 vPC VLAN(即 VLAN 通过 vPC 对等链路承载)的端口。
问题就在这里。当 vPC peer-link 关闭时,只有 vPC 成员端口关闭,即孤立端口保持up。因此,配置了 NIC 组合或处于活动/备用设置并连接到两个交换机的设备将无法正确故障转移。为了确保孤立端口正确关闭,使用了接口命令孤立端口暂停。
对于有主备链路的单台设备,建议在两台交换机之间进行port-channel端口,并将两个端口都配置为vPC成员端口。
5、对等链接
vPC 对等链路是 vPC 域中最重要的组件。正如我们提到的,如果一个成员端口出现故障,那么 peer-link 将用于向对等体发送单播流量。
参考如下示例:
流量到达 Server1,目的地是 Server2。
流量通过 Po30 发送到 Switch1。
由于成员端口关闭,数据包无法通过 Switch1 上的 Po40 路径。
相反,数据包通过 vPC 对等链路发送到对等交换机,并通过 Po40 发送到 Server2。
图 2:PeerLink 场景
6、配置
下面展示了必要的配置。此配置适用于两个交换机。但是,请确保相应地修改 IP 地址。
此外,请注意,在此示例中,以下端口捆绑将用于PeerLink和KeepAlive。
Po300 - vPC PeerLink
Po400 - vPC KeepAlive
6.1 创建 vPC VRF
vrf context VPC_KEEPALIVE
6.2 启用 vPC
feature vpc
6.3 创建 vPC 域
vpc domain 105
peer-keepalive destination 10.1.1.1 source 10.1.1.2 vrf VPC_KEEPALIVE
6.4 创建 vPC Peerlink
interface Ethernet1/37
description vPC Peerlink
switchport mode trunk
channel-group 300 mode active
interface Ethernet1/38
description vPC Peerlink
switchport mode trunk
channel-group 300 mode active
interface port-channel300
description vPC Peerlink
vpc peer-link
6.5 创建 vPC KeepAlive
interface Ethernet1/47
description vPC Keepalive
no switchport
channel-group 400 mode active
interface Ethernet1/48
description vPC Keepalive
no switchport
channel-group 400 mode active
interface port-channel400
description vPC Keepalive
vrf member VPC_KEEPALIVE
no switchport
ip address 10.1.1.[1-2]/30
6.6 创建 vPC 成员端口
最后,我们通过在每个交换机上创建一个端口通道来创建一个虚拟端口通道。端口通道配置是标准配置,但我们也包括命令vpc 30. 此命令添加到两个交换机上的两个端口通道。
# switch 1
interface gi0/30
channel-group 30
interface po30
vpc 30
# switch 2
interface gi0/30
channel-group 30
interface po30
vpc 30
完成后,使用以下命令检查 vPC 的状态。
7 显示/调试命令
7.1 Brief
要查看 vPC 设置及其运行方式的概述,首先要检查的地方是通过命令show vpc brief.
switch2# show vpc brief
Legend:
(*) - local vPC is down, forwarding via vPC peer-link
vPC domain id : 100
Peer status : peer adjacency formed ok
vPC keep-alive status : peer is alive
Configuration consistency status : success
Per-vlan consistency status : success
Type-2 consistency status : success
vPC role : secondary
Number of vPCs configured : 2
Peer Gateway : Enabled
Peer gateway excluded VLANs : -
Dual-active excluded VLANs : -
Graceful Consistency Check : Enabled
Auto-recovery status : Enabled (timeout = 240 seconds)
vPC Peer-link status
---------------------------------------------------------------------
id Port Status Active vlans
-- ---- ------ --------------------------------------------------
1 Po2 up 1,9,1120,4093
vPC status
----------------------------------------------------------------------------
id Port Status Consistency Reason Active vlans
------ ----------- ------ ----------- -------------------------- -----------
30 Po30 up success success 1120
40 Po40 up success success 1120
7.2 孤立端口
要确认哪些端口是孤立端口,请使用以下命令,
switch1# sh vpc orphan-ports
Note:
--------::Going through port database. Please be patient.::--------
VLAN Orphan Ports
------- -------------------------
400 Eth1/1, Eth1/2, Eth1/3, Eth1/4, Eth1/5, Eth1/6
7.3 一致性
为了显示 vPC 对等体之间的一致性,show vpc consistency-parameter …使用了。
switch2# sh vpc consistency-parameters vpc 30
Legend:
Type 1 : vPC will be suspended in case of mismatch
Name Type Local Value Peer Value
------------- ---- ---------------------- -----------------------
Shut Lan 1 No No
STP Port Type 1 Edge Trunk Port Edge Trunk Port
STP Port Guard 1 None None
STP MST Simulate PVST 1 Default Default
lag-id 1 [(7f9b, [(7f9b,
0-2-4-ef-be-69, 801b, 0-2-4-ef-be-69, 801b,
0, 0), (8000, 0, 0), (8000,
f4-cf-e2-0-1e-76, 2, f4-cf-e2-0-1e-76, 2,
0, 0)] 0, 0)]
mode 1 active active
Speed 1 10 Gb/s 10 Gb/s
Duplex 1 full full
Port Mode 1 trunk trunk
Native Vlan 1 1 1
MTU 1 1500 1500
Admin port mode 1
vPC card type 1 Empty Empty
Allowed VLANs - 2-8,10-4092,4094 2-8,10-4092,4094
Local suspended VLANs - - -
7.4 Peer-KeepAlive
最后,show vpc peer-keepalive使用该命令检查 vPC keepalive 的状态。
switch2# show vpc peer-keepalive
vPC keep-alive status : peer is alive
--Peer is alive for : (2300862) seconds, (249) msec
--Send status : Success
--Last send at : 2015.03.19 06:52:22 954 ms
--Sent on interface : Po400
--Receive status : Success
--Last receive at : 2015.03.19 06:52:22 955 ms
--Received on interface : Po400
--Last update from peer : (0) seconds, (219) msec
vPC Keep-alive parameters
--Destination : 10.1.1.1
--Keepalive interval : 1000 msec
--Keepalive timeout : 5 seconds
--Keepalive hold timeout : 3 seconds
--Keepalive vrf : VPC_KEEPALIVE
--Keepalive udp port : 3200
--Keepalive tos : 192