vpc(virtual PortChannel 虚拟链路聚合),技术容许将链接到两个Nexus系列交换机的物理链路看做为一条逻辑端口聚合链路。服务器
能够链接的设备:nexus2000系列的Fabric Extender(交换机矩阵扩展器),交换机,服务器等其余任何网络设备。网络
vpc技术能够提供二层多路径选择,让用户能够在有多条路径的状况下增长网络冗余,提示带宽,在多个节点之间实现多条并行路径和对流量进行负载均衡。app
启用vpc功能以后,须要建立一个对等体保持活动链接(keepalive link),该链接将发送vpc对等体之间的心跳信息。负载均衡
vpc域包括:vpc对等体设备(交换机)、vpc对等保持活动链路(心跳线)、vpc对等互联链路和链接到下游设备等的vpc域中的全部PortChannels。每一个设备上只能有一个vpc域ID。dom
vpc不只容许switch或者server链接到一对Nexus5000系列交换机建立PortChannel,还能够经过Nexus2000交换机来扩展交换机矩阵。以下图1部署场景在两个cisco上的两个端口之间建立一个vpc。ide
图2中的vpc部署场景容许cisco nexus2000系列交换机链接到一对nexus5000系列交换机,并使全部链接处于活动状态。oop
除了图1和图2中的两个拓扑以外,还能够在任何支撑PortChannel的设备上使用vpc,以便在设备上链接到一对nexus系列交换机实现弹性和高吞吐量。ui
Command | command description |
---|---|
show feature | 查看vpc功能是否启用 |
show vpc brief | 查看vpc简短的信息 |
show vpc consistency-parameters | 显示全部vpc接口上必须一致的参数的状态 |
show running-config vpc | 查看vpc的运行配置信息 |
show port-channel capacity | 显示port-channel数量和有效的port-channel数量 |
show vpc statistics | 查看vpc的统计信息 |
show vpc peer-keepalive | 查看vpc保持活动消息的信息 |
show vpc role | 显示vpc对等设备的状态,本地设备的角色,vpc系统的mac地址和系统优先级,和本地设备的mac地址和优先级 |
若是没有在设备上启用这些参数,则vpc一致性检查将忽略这些参数。spa
应该相同的配置参数:3d
配置管理接口ip和默认路由
n9k-1(config)# interface mgmt 0 n9k-1(config-if)# ip add 172.16.2.1/24 n9k-1(config-if)# vrf context management n9k-1(config-vrf)# ip route 0.0.0.0/0 172.16.2.254 (路由本实验能够忽略) n9k-1(config-vrf)# exit
启用vpc和lacp
n9k-1(config)# feature vpc n9k-1(config)# feature lacp
建立一个vlan
n9k-1(config)# vlan 101 n9k-1(config-vlan)# exit
建立vpc域
n9k-1(config)# vpc domain 1
配置vpc角色优先级
n9k-1(config-vpc-domain)# role priority 100 Warning: !!:: vPCs will be flapped on current primary vPC switch while attempting role change ::!! Note: --------:: Change will take effect after user has re-initd the vPC peer-link ::--------
配置对等保持活动连接
n7k-1(config-vpc-domain)# peer-keepalive destination 172.16.2.2 Note: --------:: Management VRF will be used as the default VRF ::--------
配置vpc对等链路。
注意:在vpc对等体交换机之间的peer link为trunk时,trunk必须容许全部vpc成员端口所属的vlan。
n9k-1(config-vpc-domain)# interface ethernet 1/1-2 n9k-1(config-if-range)# channel-group 1 mode active n9k-1(config-if-range)# interface port-channel 1 n9k-1(config-if)# vpc peer-link 2018 Nov 29 07:52:50 n9k-1 %$ VDC-1 %$ stp: Please note that spanning tree port type is changed to "network" port type on vPC peer-link. This will enable spanning tree Bridge Assurance on vPC peer-link provided the STP Bridge Assurance (which is enabled by default) is not disabled. n9k-1(config-if)# switchport mode trunk n9k-1(config-if)# switchport trunk allowed vlan 1,101 n9k-1(config-if)# exit
配置链接n2k port-channel(这步本实验忽略,由于没有下联n2k,直接互联了一个交换)
激活fex: n9k-1(config)# install feature-set fex n9k-1(config)# feature-set fex n9k-1(config)# fex 101 n9k-1(config-fex)# pinning max-links 1 n9k-1(config-fex)# exit n9k-1(config)# interface ethernet 1/3-4 n9k-1(config-if-range)# channel-group 100 n9k-1(config-if-range)# interface port-channel 100 n9k-1(config-if)# switchport mode fex-fabric n9k-1(config-if)# fex associate 101 n9k-1(config-if)# exit
将下联接口加入vpc
n9k-1(config)# interface ethernet 1/7 n9k-1(config-if)# channel-group 10 n9k-1(config-if)# interface port-channel 10 n9k-1(config-if)# vpc 10 n9k-1(config-if)# switchport access vlan 101 n9k-1(config-if)# exit
配置管理接口ip和默认路由
n9k-2(config)# interface mgmt 0 n9k-2(config-if)# ip add 172.16.2.2/24 n9k-2(config-if)# vrf context management n9k-2(config-vrf)# ip route 0.0.0.0/0 172.16.2.254 (路由本实验能够忽略) n9k-2(config-vrf)# exit
启用vpc和lacp
n9k-2(config)# feature vpc n9k-2(config)# feature lacp
建立一个vlan
n9k-2(config)# vlan 101 n9k-2(config-vlan)# exit
建立vpc域
n9k-2(config)# vpc domain 1 2018 Nov 29 08:38:14 n9k-2 %$ VDC-1 %$ %STP-2-VPC_PEERSWITCH_CONFIG_DISABLED: vPC peer-switch configuration is disabled. Please make sure to change spanning tree "bridge" priority as per the recommended guidelines.
配置vpc角色优先级
本部忽略,不用配置。
配置对等保持活动连接
n9k-2(config-vpc-domain)# peer-keepalive destination 172.16.2.1
配置vpc对等链路。
注意:在vpc对等体交换机之间的peer link为trunk时,trunk必须容许全部vpc成员端口所属的vlan。
n9k-2(config-vpc-domain)# interface ethernet 1/1-2 n9k-2(config-if-range)# channel-group 1 mode active n9k-2(config-if-range)# interface port-channel 1 n9k-2(config-if)# vpc peer-link 2018 Nov 29 08:40:31 n9k-2 %$ VDC-1 %$ stp: Please note that spanning tree port type is changed to "network" port type on vPC peer-link. This will enable spanning tree Bridge Assurance on vPC peer-link provided the STP Bridge Assurance (which is enabled by default) is not disabled. n9k-2(config-if)# switchport mode trunk n9k-2(config-if)# switchport trunk allowed vlan 1,101 n9k-2(config-if)# exit
配置链接n2k port-channel (这步本实验忽略,由于没有下联n2k,直接互联了一个交换)
激活fex: n9k-2(config)# install feature-set fex n9k-2(config)# feature-set fex n9k-2(config)# fex 101 n9k-1(config-fex)# pinning max-links 1 n9k-2(config-fex)# exit n9k-2(config)# interface ethernet 1/3-4 n9k-2(config-if-range)# channel-group 100 n9k-2(config-if-range)# interface port-channel 100 n9k-2(config-if)# switchport mode fex-fabric n9k-2(config-if)# fex associate 101 n9k-2(config-if)# exit
将下联接口加入vpc
n9k-2(config)# interface ethernet 1/7 n9k-2(config-if)# channel-group 10 n9k-2(config-if)# interface port-channel 10 n9k-2(config-if)# vpc 10 n9k-2(config-if)# switchport access vlan 101 n9k-2(config-if)# exit
swi-1(config)# interface range ethernet 0/0 to 0/1 swi-1(config-if-range)# channel-group 1 swi-1(config-if-range)# interface port-channel 1 swi-1(config-if)# switchport access vlan 101 swi-1(config-if)# exit swi-1配置以下: interface Port-channel1 switchport access vlan 101 ! interface Ethernet0/0 channel-group 1 mode on ! interface Ethernet0/1 channel-group 1 mode on
验证对等活动链接:
show vpc brief
sh vpc peer-keepalive
sh vpc role
激活vlan接口和hsrp功能
n9k-1(config)# feature interface-vlan n9k-1(config)# feature hsrp
配置hsrp
激活track功能:
n9k-1(config)# feature tacacs+
配置track:
n9k-1(config)# track 1 interface ethernet 1/7 line-protocol
n9k-1(config-if)# interface vlan 101 n9k-1(config-if)# ip add 172.16.101.1 255.255.255.0 n9k-1(config-if)# hsrp version 2 n9k-1(config-if)# hsrp 101 n9k-1(config-if-hsrp)# priority 120 n9k-1(config-if-hsrp)# ip 172.16.101.3 n9k-1(config-if-hsrp)# track 1 decrement 11 n9k-1(config-if-hsrp)# exit
配置用于hsrp通讯的接口
n9k-1(config)# interface Ethernet1/4 n9k-1(config-if)# switchport mode trunk n9k-1(config-if)# exit
n9k-2的配置
n9k-2(config)# feature interface-vlan n9k-2(config)# feature hsrp n9k-2(config)# feature tacacs+ n9k-2(config)# track 1 interface ethernet 1/3 line-protocol n9k-2(config-track)# exit n9k-2(config)# interface vlan 101 n9k-2(config-if)# ip add 172.16.101.2 255.255.255.0 n9k-2(config-if)# hsrp version 2 n9k-2(config-if)# hsrp 101 n9k-2(config-if-hsrp)# priority 110 n9k-2(config-if-hsrp)# ip 172.16.101.3 n9k-2(config-if-hsrp)# track 1 decrement 11 n9k-2(config-if-hsrp)# exit n9k-2(config)# interface Ethernet1/4 n9k-2(config-if)# switchport mode trunk n9k-2(config-if)# exit
interface vlan101 ip add 172.16.101.100 255.255.255.0 interface Port-channel1 switchport access vlan 101 ! interface Ethernet0/0 channel-group 1 mode on ! interface Ethernet0/1 channel-group 1 mode on ip route 0.0.0.0/0 172.16.101.3
单独的hsrp实验,这里再也不叙述。
hsrp的生成树会阻塞端口,vpc+hsrp则不会。
hsrp模拟链路中断,切换网关,丢包3个,比vpc+hsrp收敛慢。切回来的时候和vpc+hsrp是同样的。
hsrp修改优先级,切换网关,丢包现象和vpc+hsrp收敛同样。
vpc+hsrp 实现下联交换或者主机的上联链路带宽增长。