EVPN小实验:配置实例间访问控制

前两个实验中我们发现EVPN中大量使用了VPN实例,并得到以下结论:RT是一种BGP扩展团体属性,用于控制EVPN路由的发布与接收。也就是说,RT决定了本端的EVPN路由可以被哪些对端所接收,以及本端是否接收对端发来的EVPN路由。RT分为ERT(Export RT,本端发送EVPN路由时,携带的RT属性设置为ERT)和IRT(Import RT,本端设置接收的对端的EVPN路由属性)。本端在收到对端的EVPN路由时,将路由中携带的ERT与本端的IRT进行比较,只有两者相等时才接收该路由,否则丢弃该路由

组网需求

VSR1、VSR2、VSR3为与服务器连接的分布式EVPN网关设备,VSR-RR为RR,负责在路由器之间反射BGP路由。

虚拟机VM 1属于VXLAN 10、位于VPN实例VPNA;VM 2和VM 4属于VXLAN 20、位于VPN实例VPNB;VM 3属于VXLAN 30、位于VPN实例VPNC。通过EVPN分布式网关配置,相同VXLAN之间可以二层互通,确保虚拟机在站点之间进行迁移时用户的访问流量不会中断;不同VXLAN之间通过分布式EVPN网关实现VM 1和VM 4之间互通,VM 4不能访问VM 3,VM 1和VM 3之间互通。

实验环境

VMWare ESXi 6.7.0(ProLiant DL360 Gen9,48核心,128G内存)

H3C VSR1000(Version 7.1.064, Release 0621P18,4核心,8G内存)

H3C VFW1000(Version 7.1.064, ESS 1171P13,4核心,8G内存)

Windows 7旗舰版(测试用虚拟机,8核心,16G内存)

组网图

互通配置组网图如下。

 

M地址指远程管理的带外管理口地址。新建一个vSwitch,所有线路均使用该vSwitch中端口组实现,建议将不同链路隔离进不同的VLAN,避免广播风暴。

配置步骤

1、配置IP地址和单播路由协议

调通底层网络,配置各接口的IP地址和子网掩码,并在IP核心网络内配置OSPF协议,和之前的实验配置基本相同。

将VM1的网关地址指定为192.168.2.1,将VM2和VM4的网关地址指定为192.168.10.1,将VM3的网关地址指定为192.168.20.1。

2、配置VSR1

如文章开始所讲,限制VXLAN网络间的访问时间上就是通过调整VPN实例的vpn-target来实现访问限制。调整后的VSR1配置如下:

#

ip vpn-instance vpna

 route-distinguisher 1:1

 #

 address-family ipv4

  vpn-target 2:2 3:3 1:1 import-extcommunity

  vpn-target 1:1 export-extcommunity

 #

 address-family evpn

  vpn-target 1:1 2:2 3:3 import-extcommunity

  vpn-target 1:1 export-extcommunity

#

ip vpn-instance vpnb

 route-distinguisher 2:2

 #

 address-family ipv4

  vpn-target 2:2 1:1 import-extcommunity

  vpn-target 2:2 export-extcommunity

 #

 address-family evpn

  vpn-target 2:2 1:1 import-extcommunity

  vpn-target 2:2 export-extcommunity

#

 vxlan tunnel mac-learning disable

#

ospf 1 router-id 1.1.1.1

 area 0.0.0.0

  network 1.1.1.1 0.0.0.0

  network 14.1.1.0 0.0.0.255

#

 l2vpn enable

 vxlan tunnel arp-learning disable

#

vsi vpna

 gateway vsi-interface 1

 vxlan 10

 evpn encapsulation vxlan

  route-distinguisher auto

  vpn-target auto export-extcommunity

  vpn-target auto import-extcommunity

#

vsi vpnb

 gateway vsi-interface 2

 vxlan 20

 evpn encapsulation vxlan

  route-distinguisher auto

  vpn-target auto export-extcommunity

  vpn-target auto import-extcommunity

#

interface LoopBack0

 ip address 1.1.1.1 255.255.255.255

#

interface GigabitEthernet2/0

 ip address 14.1.1.1 255.255.255.0

#

interface GigabitEthernet3/0

 xconnect vsi vpna

#

interface GigabitEthernet4/0

 xconnect vsi vpnb

#

interface Vsi-interface1

 ip binding vpn-instance vpna

 ip address 192.168.2.1 255.255.255.0

 mac-address 0001-0001-0001

 local-proxy-arp enable

 distributed-gateway local

#

interface Vsi-interface2

 ip binding vpn-instance vpnb

 ip address 192.168.10.1 255.255.255.0

 mac-address 0002-0002-0002

 local-proxy-arp enable

 distributed-gateway local

#

interface Vsi-interface3

 ip binding vpn-instance vpna

 l3-vni 1000

#

interface Vsi-interface4

 l3-vni 2000

#

interface Vsi-interface5

 l3-vni 3000

#

bgp 1234

 peer 4.4.4.4 as-number 1234

 peer 4.4.4.4 connect-interface LoopBack0

 #

 address-family l2vpn evpn

  peer 4.4.4.4 enable

3、配置VSR2

调整VPN实例的vpn-target来实现访问限制,调整后的VSR2配置如下:

#

ip vpn-instance vpnb

 route-distinguisher 2:2

 #

 address-family ipv4

  vpn-target 2:2 1:1 import-extcommunity

  vpn-target 2:2 export-extcommunity

 #

 address-family evpn

  vpn-target 2:2 1:1 import-extcommunity

  vpn-target 2:2 export-extcommunity

#

 vxlan tunnel mac-learning disable

#

ospf 1 router-id 2.2.2.2

 area 0.0.0.0

  network 2.2.2.2 0.0.0.0

  network 22.1.1.0 0.0.0.255

  network 24.1.1.0 0.0.0.255

#

 l2vpn enable

 vxlan tunnel arp-learning disable

#

vsi vpnb

 gateway vsi-interface 1

 vxlan 20

 evpn encapsulation vxlan

  route-distinguisher auto

  vpn-target auto export-extcommunity

  vpn-target auto import-extcommunity

#

interface LoopBack0

 ip address 2.2.2.2 255.255.255.255

#

interface GigabitEthernet2/0

 ip address 24.1.1.2 255.255.255.0

#

interface GigabitEthernet3/0

 xconnect vsi vpnb

#

interface Vsi-interface1

 ip binding vpn-instance vpnb

 ip address 192.168.10.1 255.255.255.0

 mac-address 0002-0002-0002

 local-proxy-arp enable

 distributed-gateway local

#

interface Vsi-interface3

 l3-vni 1000

#

interface Vsi-interface4

 ip binding vpn-instance vpnb

 l3-vni 2000

#

interface Vsi-interface5

 l3-vni 3000

#

bgp 1234

 peer 4.4.4.4 as-number 1234

 peer 4.4.4.4 connect-interface LoopBack0

 #

 address-family l2vpn evpn

  peer 4.4.4.4 enable

4、配置VSR3

调整VPN实例的vpn-target来实现访问限制,调整后的VSR3配置如下:

#

ip vpn-instance vpnc

 route-distinguisher 3:3

 #

 address-family ipv4

  vpn-target 3:3 1:1 import-extcommunity

  vpn-target 3:3 export-extcommunity

 #

 address-family evpn

  vpn-target 3:3 1:1 import-extcommunity

  vpn-target 3:3 export-extcommunity

#

 vxlan tunnel mac-learning disable

#

ospf 1 router-id 3.3.3.3

 area 0.0.0.0

  network 3.3.3.3 0.0.0.0

  network 34.1.1.0 0.0.0.255

#

 l2vpn enable

 vxlan tunnel arp-learning disable

#

vsi vpnc

 gateway vsi-interface 1

 vxlan 30

 evpn encapsulation vxlan

  route-distinguisher auto

  vpn-target auto export-extcommunity

  vpn-target auto import-extcommunity

#

interface LoopBack0

 ip address 3.3.3.3 255.255.255.255

#

interface GigabitEthernet2/0

 ip address 34.1.1.3 255.255.255.0

#

interface GigabitEthernet3/0

 xconnect vsi vpnc

#

interface Vsi-interface1

 ip binding vpn-instance vpnc

 ip address 192.168.20.1 255.255.255.0

 mac-address 0003-0003-0003

 local-proxy-arp enable

 distributed-gateway local

#

interface Vsi-interface3

 l3-vni 1000

#

interface Vsi-interface4

 l3-vni 2000

#

interface Vsi-interface5

 ip binding vpn-instance vpnc

 l3-vni 3000

#

bgp 1234

 peer 4.4.4.4 as-number 1234

 peer 4.4.4.4 connect-interface LoopBack0

 #

 address-family l2vpn evpn

  peer 4.4.4.4 enable

5、配置VSR-RR

配置VSR-RR作为RR路由反射器与其他路由器建立BGP连接, 配置发布EVPN路由,并关闭BGP EVPN路由的VPN-Target过滤功能。无需调整配置。

验证配置

1、验证分布式EVPN网关设备VSR1

查看EVPN自动发现的邻居信息,包含各VSI的IMET路由和MAC/IP路由。

display evpn auto-discovery imet

dis evpn auto-discovery macip-prefix

 

查看EVPN的ARP信息和MAC地址信息,

dis evpn route arp

dis evpn route mac

 

查看EVPN路由表信息,因为绑定了VPN实例,所以记得带实例查看。

display evpn routing-table vpn-instance vpna

 

查看Tunnel接口信息,可以看到VXLAN模式的Tunnel接口处于UP状态。

display interface tunnel

 

查看VSI虚接口信息,可以看到VSI虚接口处于UP状态。

display interface vsi-interface

 

 

查看VSI的详细信息,可以看到VSI内创建的VXLAN、与VXLAN关联的VXLAN隧道、与VSI关联的VSI虚接口等信息。多了3个自动创建的VSI接口。

display l2vpn vsi verbose

 

 

查看VSI的MAC地址表项信息,可以看到已学习到的MAC地址信息。

 

查看BGP l2vpn对等体信息。

display bgp l2vpn evpn

 

VSR1设备上的VPN实例vpna和vpnb的路由信息如下:

 

查看FIB表项信息,可以看到已学习到了虚拟机的转发表项信息,都要加VPN实例了。

 

2、验证主机

对比组网拓扑,在VM1这台主机(192.168.2.160)上ping测VM2(192.168.10.110)、VM3(192.168.20.200)和VM4(192.168.10.188),结果如下:

 

在VM2(192.168.10.110)这台主机上ping测VM1(192.168.2.160)、VM3(192.168.20.200)和VM4(192.168.10.188),结果如下:

 

在VM3(192.168.20.200)这台主机上ping测VM1(192.168.2.160)、VM2(192.168.10.110)和VM4(192.168.10.188),结果如下:

 

在VM4(192.168.10.188)这台主机上ping测VM1(192.168.2.160)、VM2(192.168.10.110)和VM3(192.168.20.200),结果如下:

 

综上,除VM3和VM4不能互访之外,其余主机全部实现互访。

总结

设备在发布和接收BGP EVPN路由时,按照如下规则选择RD和RT:

1、IMET路由和仅包含MAC地址信息的MAC/IP路由。

发布该类路由时,携带EVPN实例视图下配置的RD和Export Target;

接收该类路由时,将路由中的Route Target属性与本地EVPN实例视图下配置的Import Target进行比较。

2、包含ARP/ND信息的MAC/IP路由。

发布该类路由时,携带EVPN实例视图下配置的RD,并同时携带EVPN实例视图下配置的Export Target和VPN实例/公网实例下为EVPN配置(VPN实例视图、VPN实例EVPN视图、公网实例视图、公网实例EVPN视图下配置)的Export Target;

接收该类路由时,将路由中的Route Target属性与本地VPN实例/公网实例下为EVPN配置的Import Target进行比较。

3、IP前缀路由。

发布该类路由时,携带VPN实例/公网实例下为IPv4 VPN配置或IPv6 VPN配置的Export Target;

接收该类路由时,将路由中的Route Target属性与本地VPN实例/公网实例下为IPv4 VPN或IPv6 VPN配置的Import Target进行比较。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Danileaf_Guo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值