Cisco N3K VPC+HSRP+ospf 配置

VPC概念

  • VPC:vpc是指vpc对等体设备和下游设备之间的组合PortChannel。

  • vpc对等交换:就是组成vpc功能的两个nexus系列交换机,一个设备为主,一个为备。

  • vpc对等连接:用于同步vpc对等设备之间状态的连接。vpc对等链路在两个vpc交换机之间携带控制通信量,还有组播、广播数据通信量。在某些链路故障场景中,还携带单播通信量。对等链路至少是两个10GE接口。

  • vpc域:该域包括vpc对等设备、vpc对等保持活动连接和连接到下游设备的vpc中的所有PortChannels。同时,所有关于vpc的全局配置都关联到vpc域下。

  • vpc对等保持活动连接(心跳线):对等保持活动连接监视vpc对等交换机的生命力。在vpc对等设备之间发送周期性的保持活动连接。vpc对等活动连接可以是管理接口(MGMT)或交换机虚拟接口(SVI),但不可以使用物理接口。没有数据或同步流量在vpc登对保持活动连接上移动;该连接上的唯一通信量是表明交换机正在操作和运行vpc的消息。

一、背景需求

        Cisco 两台交换机需要虚拟成一台交换机使用(类似 交换机堆叠),去链接二层接入交换机,提供网络链路高可用。如下图:

  

  对于二层交换 2960x  需要看到 上层的两台 N3k 交换为一台设备,中间连接链路做链路聚合。

 二、配置详解

   N3K_1和 N3K2  配置保持一致

     1、全局下开启 VPC + HSRP+ospf  

feature vpc
feature hsrp
feature ospf

  2、配置 VPC 域ID

vpc domain 30
  role priority 8192      # N3K_1:8192    N3K_2:16384   设置角色优先级
  peer-keepalive destination 10.8.240.21 source 10.8.240.20    #IP 为MGMT地址
  peer-gateway
  auto-recovery

   

   3、VPC peer-link 接口配置    

interface Ethernet1/49
  switchport mode trunk
  channel-group 49 mode active

interface Ethernet1/50
  switchport mode trunk
  channel-group 49 mode active

interface port-channel49
  speed 40000
  description vPc peer-link
  switchport mode trunk
  spanning-tree port type network
  vpc peer-link

    4、下联接口配置

interface Ethernet1/51/1
  speed 10000
  switchport mode trunk
  channel-group 50 mode active
  no shutdown

interface port-channel50
  speed 10000
  switchport mode trunk
  vpc 50   #两台N3K 的VPC ID 必须一致

  

  2960X交换机配置

 1:、接口配置(和普通链路聚合配置一样)

interface TenGigabitEthernet1/0/1
 switchport mode trunk
 channel-group 24 mode active

interface TenGigabitEthernet1/0/2
 switchport mode trunk
 channel-group 24 mode active

interface Port-channel24
 switchport mode trunk

三、hsrp+ospf 配置 

N3k_1:
interface Vlan10
  no shutdown
  ip address 192.168.0.2/24
  ip router ospf 10 area 0.0.0.20    #ospf 路由发布
  hsrp version 2
  hsrp 10 
    preempt 
    priority 105
    ip 192.168.0.1 
    track 1


track 1 interface Ethernet1/48 line-protocol

N3k_2:
interface Vlan10
  no shutdown
  ip address 192.168.0.3/24
  ip router ospf 10 area 0.0.0.20
  hsrp version 2
  hsrp 10 
    ip 192.168.0.1 
    track 1


track 1 interface Ethernet1/48 line-protocol

四、查看配置

   

N3k-core-01# show vpc 
Legend:
                (*) - local vPC is down, forwarding via vPC peer-link

vPC domain id                     : 30  
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                          : primary, operational secondary
Number of vPCs configured         : 6   
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    Po49   up     all                                      

vPC status
----------------------------------------------------------------------------
id     Port        Status Consistency Reason                     Active vlans
------ ----------- ------ ----------- -------------------------- -----------       
50     Po50        up     success     success                    all       
51     Po51        up     success     success                    all        
52     Po52        up     success     success                    all        
53     Po53        up     success     success                    all        
N3k-core-01# show vpc statistics peer-link 
port-channel49 is up
  Hardware: Port-Channel, address: 0062.ecef.8e5c (bia 0062.ecef.8e5c)
  Description: vPc peer-link
  MTU 9216 bytes, BW 80000000 Kbit, DLY 10 usec
  reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA
  Port mode is trunk
  full-duplex, 40 Gb/s
  Input flow-control is off, output flow-control is off
  Switchport monitor is off 
  EtherType is 0x8100 
  Members in this channel: Eth1/49, Eth1/50
  Last clearing of "show interface" counters never
  1 interface resets
  Load-Interval #1: 30 seconds
  30 seconds input rate 13194296 bits/sec, 5755 packets/sec
  30 seconds output rate 1558864 bits/sec, 802 packets/sec
  Load-Interval #2: 5 minute (300 seconds)
    input rate 11.66 Mbps, 5.24 Kpps; output rate 1.49 Mbps, 625 pps
  RX
    53092855268 unicast packets  943847523 multicast packets  37779519 broadcast packets
    54074482310 input packets  12067581932262 bytes
    3615421391 jumbo packets  0 storm suppression packets
    0 runts  0 giants  0 CRC  0 no buffer
    0 input error  0 short frame  0 overrun   0 underrun  0 ignored
    0 watchdog  0 bad etype drop  0 bad proto drop  0 if down drop
    0 input with dribble  0 input discard
    0 Rx pause
  TX
    27613649710 unicast packets  1107185465 multicast packets  48743817 broadcast packets
    28769578992 output packets  4953197509995 bytes
    1283510513 jumbo packets
    0 output errors  0 collision  0 deferred  0 late collision
    0 lost carrier  0 no carrier  0 babble 0 output discard
    0 Tx pause
N3k-core-01# show hsrp brief 
                     P indicates configured to preempt.
                     |
Interface   Grp Prio P State    Active addr      Standby addr     Group addr
Vlan10      10 105  P Active   local            192.168.0.3        192.168.0.1       (conf)
Vlan11      11 105  P Active   local            1921.68.1.3        192.168.1.1       (conf)
。。。。。。

此篇博客为本人个人工作总结,仅供参看。谢谢

IT运维开发路上的点点滴滴。。。
原文地址:https://www.cnblogs.com/weijie0717/p/7488982.html