vrf + vpc 常见配置
时间: 2023-08-16 16:07:11 浏览: 61
在使用 VRF 和 VPC(Virtual Port Channel)时,需要进行以下常见配置:
1. 配置 VRF:创建一个 VRF 实例并配置路由表。
```
Switch(config)# ip vrf <vrf-name>
Switch(config-vrf)# rd <vrf-id>
Switch(config)# ip route vrf <vrf-name> <destination-network> <netmask> <next-hop>
```
2. 配置 VPC:创建一个 VPC domain 并配置 VPC peer-link 和 VPC member port。
```
Switch(config)# vpc domain <domain-id>
Switch(config-vpc-domain)# peer-switch
Switch(config-vpc-domain)# peer-keepalive destination <peer-ip-address>
Switch(config-vpc-domain)# peer-gateway
Switch(config)# interface port-channel <channel-number>
Switch(config-if)# switchport mode trunk
Switch(config-if)# vpc <vpc-number>
```
3. 配置 VPC + VRF:在 VPC member port 上启用 VRF forwarding。
```
Switch(config)# interface <interface-type><interface-number>
Switch(config-if)# vrf member <vrf-name>
```
4. 配置 VPC + VRF + HSRP:在 VPC member port 上启用 HSRP 并将 HSRP 路由器虚拟 IP 地址分配给 VRF 实例。
```
Switch(config)# interface vlan <vlan-id>
Switch(config-if)# vrf forwarding <vrf-name>
Switch(config-if)# ip address <ip-address> <netmask>
Switch(config-if)# hsrp <group-id>
Switch(config-if)# hsrp <group-id> ip <virtual-ip-address>
Switch(config-if)# hsrp <group-id> priority <priority>
```
注意:以上命令中的 <vrf-name> 和 <vrf-id> 是您为 VRF 实例指定的名称和 ID,<channel-number> 是 VPC peer-link 的编号,<vpc-number> 是 VPC member port 的编号,<group-id> 是 HSRP 组的编号,<peer-ip-address> 是 VPC peer-keepalive 的 IP 地址,<priority> 是 HSRP 路由器的优先级。