eNSP实验BGP_MPLS_VPN

更新时间:2024-05-14 21:33:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

BGP MPLS VPN 配置实验 目录

1 网络拓扑 2 2 配置文件 2 2.1 PE1的相关配置 2 2.1.1 在MPLS骨干网上配置IGP协议,实现骨干网PE和P的互通 2.1.2 在PE1上配置与PE2、P的IBGP 3 2.1.3 MPLS骨干网上配置MPLS基本能力和MPLS LDP,建立LDP LSP 2.1.4 在PE设备上配置VPN实例,将CE接入PE 3 2.1.5 在PE与CE之间建立EBGP对等体,引入VPN路由 4 2.2 P的相关配置 5 2.2.1 在MPLS骨干网上配置IGP协议,实现骨干网PE和P的互通 2.2.2 P上配置与PE1、PE2的IBGP 5 2.2.3 MPLS骨干网上配置MPLS基本能力和MPLS LDP,建立LDP LSP 2.2.4 xxx 6

2 3

5 6

2.3 PE2相关配置 6 2.3.1 在MPLS骨干网上配置IGP协议,实现骨干网PE和P的互通 6 2.3.2 在PE2上配置与P、PE1的IBGP 7 2.3.3 MPLS骨干网上配置MPLS基本能力和MPLS LDP,建立LDP LSP 7 2.3.4 在PE设备上配置VPN实例,将CE接入PE 8 2.3.5 PE与CE之间建立EBGP对等体,引入VPN路由 8 2.4 CE1的相关配置 9 2.5 CE2的相关配置 9 2.6 CE3的相关配置 9 2.7 CE4的相关配置 9 3 实验结果: 10 3.1 PE1 vpn 路由表 10 3.2 P路由表 11

3.3 Ping:相同VPN之间可以通,不同VPN之间不通, 13

1 网络拓扑

2 配置文件

2.1 PE1的相关配置

2.1.1 在MPLS骨干网上配置IGP-OSPF协议,实现骨干网PE和P的互通 #

Sysna PE1 ospf 1

area 0.0.0.0

network 10.0.0.0 0.0.0.3

network 1.1.1.1 0.0.0.0 (igp-ospf)

#

interface LoopBack0

ip address 1.1.1.1 255.255.255.255

ospf enable 1 area 0.0.0.0 端口使能ospf) interface Ethernet0/0/0

ip address 10.0.0.1 255.255.255.252

ospf enable 1 area 0.0.0.0 ( 端口使能ospf) #

2.1.2 在PE1上配置与PE2、P的IBGP #

bgp 65115

router-id 1.1.1.1

peer 3.3.3.3 as-number 65115

peer 3.3.3.3 connect-interface LoopBack0 (配置bgp) peer 2.2.2.2 as-number 65115

peer 2.2.2.2 connect-interface LoopBack0 ipv4-family unicast undo synchronization

network 1.1.1.1 255.255.255.255 network 10.0.0.0 255.255.255.252 peer 2.2.2.2 enable

peer 3.3.3.3 enable (宣告网络) #

2.1.3 MPLS骨干网上配置MPLS基本能力和MPLS LDP,建立LDP LSP #

mpls lsr-id 1.1.1.1 mpls

lsp-trigger all

mpls ldp (使能mpls) #

interface Ethernet0/0/0 mpls

mpls ldp (端口使能mpls) #

2.1.4 在PE设备上配置VPN实例,将CE接入PE

ip vpn-instance VPN1 创建并进入VPN实例视图 ipv4-family

route-distinguisher 100:1 为vpn-instance创建RD

vpn-target 111:1 export-extcommunity 为vpn-instance创建vpn-target扩展团体 vpn-target 111:1 import-extcommunity (配置VPN1) #

ip vpn-instance VPN2 ipv4-family

route-distinguisher 200:1

vpn-target 222:1 export-extcommunity

vpn-target 222:1 import-extcommunity (配置VPN2) #

interface Ethernet0/0/1

ip binding vpn-instance VPN1 将接口与vpn-instance关联 ip address 10.0.0.13 255.255.255.252 (端口绑定VPN) interface GigabitEthernet0/0/0 ip binding vpn-instance VPN2

ip address 10.0.0.9 255.255.255.252 (端口绑定VPN) #

2.1.5 在PE与CE之间建立EBGP对等体,引入VPN路由 #

bgp 65115

ipv4-family vpnv4 进入MBGP的VPNv4地址族视图 policy vpn-target

peer 2.2.2.2 enable 激活MBGP对等体

peer 3.3.3.3 enable (建立邻居关系 ) #

ipv4-family vpn-instance VPN1 进入BGP的VPN地址族视图 import-route direct

import-route static (配置 vpn路由) ipv4-family vpn-instance VPN2 import-route direct

import-route static (配置 vpn路由) #

ip route-static vpn-instance VPN1 0.0.0.0 0.0.0.0 10.0.0.14

ip route-static vpn-instance VPN2 0.0.0.0 0.0.0.0 10.0.0.10 ( 配置vpn静态路由:PE和CE间通过静态路由链接的配置) #

2.2 P的相关配置

2.2.1 在MPLS骨干网上配置IGP协议,实现骨干网PE和P的互通 #

sysna P ospf 1

area 0.0.0.0

network 10.0.0.0 0.0.0.3 network 10.0.0.4 0.0.0.3

network 2.2.2.2 0.0.0.0 (igp-ospf) #

interface LoopBack0

ip address 2.2.2.2 255.255.255.255

ospf enable 1 area 0.0.0.0 ( 端口使能ospf) interface Ethernet0/0/0

ip address 10.0.0.2 255.255.255.252

ospf enable 1 area 0.0.0.0 ( 端口使能ospf) interface Ethernet0/0/1

ip address 10.0.0.5 255.255.255.252

ospf enable 1 area 0.0.0.0 ( 端口使能ospf) #

2.2.2 P上配置与PE1、PE2的IBGP #

bgp 65115

router-id 2.2.2.2

peer 1.1.1.1 as-number 65115

peer 1.1.1.1 connect-interface Ethernet0/0/0 peer 3.3.3.3 as-number 65115

peer 3.3.3.3 connect-interface Ethernet0/0/1 (配置bgp) #

ipv4-family unicast undo synchronization

network 2.2.2.2 255.255.255.255 network 10.0.0.0 255.255.255.252 network 10.0.0.4 255.255.255.252 peer 1.1.1.1 enable

peer 3.3.3.3 enable (宣告网络) #

2.2.3 MPLS骨干网上配置MPLS基本能力和MPLS LDP,建立LDP LSP #

mpls lsr-id 2.2.2.2 mpls

lsp-trigger all

mpls ldp (使能mpls) #

interface Ethernet0/0/0 mpls

mpls ldp (端口使能mpls) #

interface Ethernet0/0/1 mpls

mpls ldp (端口使能mpls) #

2.2.4 建立P与PE1、PE2的邻居关系 #

bgp 65115

ipv4-family vpnv4 policy vpn-target peer 1.1.1.1 enable

peer 3.3.3.3 enable (建立邻居关系 ) #

2.3 PE2相关配置 和PE1类似

2.3.1 在MPLS骨干网上配置IGP协议,实现骨干网PE和P的互通 #

Sysna PE2 ospf 1

area 0.0.0.0

network 10.0.0.4 0.0.0.3

network 3.3.3.3 0.0.0.0 (igp-ospf) #

interface LoopBack0

ip address 3.3.3.3 255.255.255.255

ospf enable 1 area 0.0.0.0 端口使能ospf) interface Ethernet0/0/0

ip address 10.0.0.6 255.255.255.252

ospf enable 1 area 0.0.0.0 ( 端口使能ospf) #

2.3.2 在PE2上配置与P、PE1的IBGP #

bgp 65115

router-id 3.3.3.3

peer 1.1.1.1 as-number 65115

peer 1.1.1.1 connect-interface LoopBack0 (配置bgp) ipv4-family unicast undo synchronization

network 3.3.3.3 255.255.255.255 network 10.0.0.4 255.255.255.252 peer 2.2.2.2 enable

peer 1.1.1.1 enable (宣告网络) #

2.3.3 MPLS骨干网上配置MPLS基本能力和MPLS LDP,建立LDP LSP #

mpls lsr-id 3.3.3.3 mpls

lsp-trigger all

mpls ldp (使能mpls) #

interface Ethernet0/0/0 mpls

mpls ldp (端口使能mpls)

#

2.3.4 在PE设备上配置VPN实例,将CE接入PE #

ip vpn-instance VPN1 ipv4-family

route-distinguisher 100:1

vpn-target 111:1 export-extcommunity vpn-target 111:1 import-extcommunity # (配置VPN1) ip vpn-instance VPN2 ipv4-family

route-distinguisher 200:1

vpn-target 222:1 export-extcommunity

vpn-target 222:1 import-extcommunity (配置VPN2) #

interface Ethernet0/0/1

ip binding vpn-instance VPN1

ip address 10.0.0.17 255.255.255.252 (端口绑定VPN) interface GigabitEthernet0/0/0 ip binding vpn-instance VPN2

ip address 10.0.0.21 255.255.255.252 (端口绑定VPN) #

2.3.5 PE与CE之间建立EBGP对等体,引入VPN路由 bgp 65115

ipv4-family vpnv4 policy vpn-target peer 2.2.2.2 enable

peer 1.1.1.1 enable (建立邻居关系 ) #

ipv4-family vpn-instance VPN1 import-route direct

import-route static (配置 vpn路由) ipv4-family vpn-instance VPN2 import-route direct

import-route static (配置 vpn路由) #

ip route-static vpn-instance VPN1 0.0.0.0 0.0.0.0 10.0.0.18 ip route-static vpn-instance VPN2 0.0.0.0 0.0.0.0 10.0.0.22 #

( 配置vpn静态路由)

2.4 CE1的相关配置 #

Sysn CE1

interface Ethernet0/0/0

ip address 10.0.0.10 255.255.255.252

ip route-static 0.0.0.0 0.0.0.0 10.0.0.9 (配置静态路由) #

save

2.5 CE2的相关配置 #

Sysn CE2

interface Ethernet0/0/0

ip address 10.0.0.14 255.255.255.252 ip route-static 0.0.0.0 0.0.0.0 10.0.0.13 #

2.6 CE3的相关配置 #

Sysn CE3

interface Ethernet 0/0/0

ip address 10.0.0.18 255.255.255.252 ip route-static 0.0.0.0 0.0.0.0 10.0.0.17 #

2.7 CE4的相关配置 # Sys

Sysn CE4

interface Ethernet 0/0/0

ip address 10.0.0.22 255.255.255.252 ip route-static 0.0.0.0 0.0.0.0 10.0.0.21 #

3 实验结果:

3.1 PE1 vpn 路由表 [PE1]disp ip rout

[PE1]disp ip routing-table

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------ Routing Tables: Public

Destinations : 8 Routes : 8

Destination/Mask Proto Pre Cost Flags NextHop

1.1.1.1/32 Direct 0 0 D 127.0.0.1 2.2.2.2/32 OSPF 10 1 D 10.0.0.2 3.3.3.3/32 OSPF 10 2 D 10.0.0.2 10.0.0.0/30 Direct 0 0 D 10.0.0.1 Interface LoopBack0

Ethernet0/0/0 Ethernet0/0/0 Ethernet0/0/0

10.0.0.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0 10.0.0.4/30 OSPF 10 2 D 10.0.0.2 Ethernet0/0/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0

[PE1]disp ip routing-table vp

[PE1]disp ip routing-table vpn-instance ? STRING<1-31> VPN instance name

[PE1]disp ip routing-table vpn-instance VPN1 Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------ Routing Tables: VPN1

Destinations : 4 Routes : 4

Destination/Mask Proto Pre Cost Flags NextHop

0.0.0.0/0 Static 60 0 RD 10.0.0.14 10.0.0.12/30 Direct 0 0 D 10.0.0.13 10.0.0.13/32 Direct 0 0 D 127.0.0.1 10.0.0.16/30 IBGP 255 0 RD 3.3.3.3

[PE1]

[PE1]disp ip routing-table vpn-instance VPN2 Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------ Routing Tables: VPN2

Destinations : 4 Routes : 4

Destination/Mask Proto Pre Cost Flags NextHop

0.0.0.0/0 Static 60 0 RD 10.0.0.10 10.0.0.8/30 Direct 0 0 D 10.0.0.9 10.0.0.9/32 Direct 0 0 D 127.0.0.1 10.0.0.20/30 IBGP 255 0 RD 3.3.3.3 [PE1]

3.2 P路由表

disp ip routing

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------ Routing Tables: Public

Destinations : 9 Routes : 9

Interface Ethernet0/0/1 Ethernet0/0/1 Ethernet0/0/1 Ethernet0/0/0 Interface GigabitEthernet0/0/0 GigabitEthernet0/0/0 GigabitEthernet0/0/0 Ethernet0/0/0 Destination/Mask Proto Pre Cost Flags NextHop Interface

1.1.1.1/32 OSPF 10 1 D 10.0.0.1 Ethernet0/0/0 2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0

3.3.3.3/32 OSPF 10 1 D 10.0.0.6 Ethernet0/0/1 10.0.0.0/30 Direct 0 0 D 10.0.0.2 Ethernet0/0/0 10.0.0.2/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0 10.0.0.4/30 Direct 0 0 D 10.0.0.5 Ethernet0/0/1 10.0.0.5/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/1 127.0.0.0/8 Direct 0 0 D 127.0.0.1 127.0.0.1/32 Direct 0 0 D 127.0.0.1

PE2 Vpn 路由表 dis ip rout

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------ Routing Tables: Public

Destinations : 8 Routes : 8

Destination/Mask Proto Pre Cost Flags NextHop

1.1.1.1/32 OSPF 10 2 D 10.0.0.5 2.2.2.2/32 OSPF 10 1 D 10.0.0.5 3.3.3.3/32 Direct 0 0 D 127.0.0.1 10.0.0.0/30 OSPF 10 2 D 10.0.0.5 10.0.0.4/30 Direct 0 0 D 10.0.0.6 10.0.0.6/32 Direct 0 0 D 127.0.0.1 127.0.0.0/8 Direct 0 0 D 127.0.0.1 127.0.0.1/32 Direct 0 0 D 127.0.0.1

dis ip rou

dis ip routing-table vpn-instance VPN1 Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------ Routing Tables: VPN1

Destinations : 3 Routes : 3

Destination/Mask Proto Pre Cost Flags NextHop

10.0.0.12/30 IBGP 255 0 RD 1.1.1.1 10.0.0.16/30 Direct 0 0 D 10.0.0.17 10.0.0.17/32 Direct 0 0 D 127.0.0.1

dis ip routing-table vpn-instance VPN2

InLoopBack0 InLoopBack0 Interface Ethernet0/0/0 Ethernet0/0/0 LoopBack0

Ethernet0/0/0 Ethernet0/0/0 Ethernet0/0/0 InLoopBack0 InLoopBack0 Interface Ethernet0/0/0 Ethernet0/0/1 Ethernet0/0/1 Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------ Routing Tables: VPN2

Destinations : 4 Routes : 4

Destination/Mask Proto Pre Cost Flags NextHop Interface

0.0.0.0/0 Static 60 0 RD 10.0.0.22 GigabitEthernet0/0/0 10.0.0.8/30 IBGP 255 0 RD 1.1.1.1 Ethernet0/0/0

10.0.0.20/30 Direct 0 0 D 10.0.0.21 10.0.0.21/32 Direct 0 0 D 127.0.0.1

3.3 Ping:相同VPN之间可以通,不同VPN之间不通, CE2-CE4不通

ping 10.0.0.22

PING 10.0.0.22: 56 data bytes, press CTRL_C to break Request time out Request time out Request time out Request time out Request time out

--- 10.0.0.22 ping statistics --- 5 packet(s) transmitted 0 packet(s) received 100.00% packet loss

CE2-CE3能通

ping 10.0.0.18

PING 10.0.0.18: 56 data bytes, press CTRL_C to break

Reply from 10.0.0.18: bytes=56 Sequence=1 ttl=253 time=390 ms Reply from 10.0.0.18: bytes=56 Sequence=2 ttl=253 time=140 ms Reply from 10.0.0.18: bytes=56 Sequence=3 ttl=253 time=140 ms Reply from 10.0.0.18: bytes=56 Sequence=4 ttl=253 time=140 ms Reply from 10.0.0.18: bytes=56 Sequence=5 ttl=253 time=120 ms

--- 10.0.0.18 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss

round-trip min/avg/max = 120/186/390 ms

GigabitEthernet0/0/0 GigabitEthernet0/0/0

本文来源:https://www.bwwdw.com/article/goz7.html

Top