1 需求说明
在网络中配置三层EVPN功能,实现三层流量互访:
- PC1的网关为192.168.10.254/24
- PC2的网关为192.168.20.254/24
- L3VPN实例名称为 A
2 实验拓扑
3 配置步骤
- 在骨干网上配置ospf IGP实现各个PE设备之间的互通
- 在骨干网上配置MPLS基本能力和MPLS LDP,建立MPLS LSP。
- 配置PE上的L3VPN实例 A
- 配置建立PE之间的BGP EVPN对等体关系。
- 配置CE接入PE,在pe的bgp vpn路由里面引入发布路由。
- 配置结果验证。
4 配置文件
PE1的配置文件
sysname PE1
undo dcn 关闭不需要的功能
ip vpn-instance A 配置L3 VPN实例,并使能evpn路由
ipv4-family
route-distinguisher 10:10
vpn-target 10:10 both evpn
evpn mpls routing-enable
mpls lsr-id 1.1.1.1
mpls
mpls ldp
interface Ethernet1/0/0
ip binding vpn-instance A
ip address 192.168.10.254 255.255.255.0
interface Ethernet1/0/1
ip address 13.1.1.1 255.255.255.0
mpls
mpls ldp
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
ipv4-family vpn-instance A 引入路由到BGP,并宣告的evpn里面
import-route direct
advertise l2vpn evpn
l2vpn-family evpn 与对端PE建立evpn对等体
peer 2.2.2.2 enable
ospf 1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 13.1.1.1 0.0.0.0
RT3的配置文件
sysname RT1
mpls lsr-id 3.3.3.3
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip address 13.1.1.3 255.255.255.0
mpls
mpls ldp
interface GigabitEthernet0/0/1
ip address 23.1.1.3 255.255.255.0
mpls
mpls ldp
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 13.1.1.3 0.0.0.0
network 23.1.1.3 0.0.0.0
PE2的配置文件
sysname PE2
undo dcn
ip vpn-instance A
ipv4-family
route-distinguisher 10:10
vpn-target 10:10 both evpn
evpn mpls routing-enable
mpls lsr-id 2.2.2.2
mpls
mpls ldp
interface Ethernet1/0/0
ip address 23.1.1.2 255.255.255.0
mpls
mpls ldp
interface Ethernet1/0/1
ip binding vpn-instance A
ip address 192.168.20.254 255.255.255.0
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
ipv4-family vpn-instance A
import-route direct
advertise l2vpn evpn
l2vpn-family evpn
peer 1.1.1.1 enable
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 23.1.1.2 0.0.0.0
PC的配置文件
5 查看状态
5.1 查看evpn邻居关系
与对端PE2建立BGP EVPN 对等体
[PE1]dis bgp evpn peer
BGP local router ID : 13.1.1.1
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
2.2.2.2 4 100 58 58 0 00:46:50 Established 1
5.2 查看vpn实例的路由
可以看到从对端PE2学习来的 192.168.20.0/24 网段的路由信息
[PE1]display ip routing-table vpn-instance A
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole
route
------------------------------------------------------------------------------
Routing Table : A
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 Direct 0 0 D 192.168.10.254 Ethernet1/0/0
192.168.10.254/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/0
192.168.10.255/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/0
192.168.20.0/24 IBGP 255 0 RD 2.2.2.2 Ethernet1/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0