组网需求
- PE1和PE2位于MPLS骨干网
- CE1和PE1之间为公共网络,期间通过设备R1互联
- CE2与PE2直连
- CE1与CE2属于同一个VPN要求他们之间能互通
组网拓扑
配置思路
- 配置各个路由器基本功能以及各个接口IP地址
- 配置PE1与PE2之间的OSPF协议,保持互通,并配置MPLS和接口使能MPLS
- 配置PE1与PE2的VPN实例,并绑定响应接口
- 配置PE1与CE1之间网络互通
- 配置PE1与CE1之间隧道的互通
- 配置PE2与CE2之间网络互通
- 配置PE1与PE2之间BGP协议以及MP-BGP
- 路由互相引入
配置命令
配置各个路由器基本功能以及各个接口IP地址
PE1配置
1
2
3
4
5
6
7
8
9sys
sys PE1
int g0/0/0
ip add 110.1.1.1 30
int g0/0/1
ip add 50.1.1.1 30
int LoopBack 0
ip add 1.1.1.9 32
PE2配置
1
2
3
4
5
6
7
8
9sys
sys PE2
int g0/0/0
ip add 110.1.1.2 30
int g0/0/1
ip add 11.1.1.1 30
int LoopBack 0
ip add 3.3.3.9 32
R1配置
1
2
3
4
5
6
7sys
sys R1
int g0/0/0
ip add 30.1.1.2 30
int g0/0/1
ip dd 50.1.1.2 30
CE1配置
1
2
3
4
5
6
7sys
sys CE1
int g0/0/0
ip add 30.1.1.1 30
int g0/0/1
ip add 21.1.1.1 30
CE2配置
1
2
3
4
5
6
7sys
sys CE2
int g0/0/0
ip add 41.1.1.1 30
int g0/0/1
ip add 11.1.1.2 30
配置PE1与PE2之间的OSPF协议,保持互通,并配置MPLS和接口使能MPLS
PE1配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15sys
ospf 10
area 0
network 1.1.1.9 0.0.0.0
network 110.1.1.0 0.0.0.3
mpls lsr-id 1.1.1.9
mpls
lsp-trigger all
quit
mpls ldp
int g0/0/0
mpls
mpls ldp
PE2配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16sys
ospf 10
area 0
network 3.3.3.9 0.0.0.0
network 110.1.1.0 0.0.0.3
mpls lsr-id 3.3.3.9
mpls
lsp-trigger all
quit
mpls ldp
int g0/0/0/
mpls
mpls ldp
配置VPN实例,并在指定接口绑定VPN实例
PE1配置
1
2
3
4
5
6
7
8
9
10sys
ip vpn-instance vpn1
route-distinguisher 100:1
vpn-target 111:1 export-excommunity
vpn-target 111:1 import-excommunity
int Tunnel 0/0/0
ip binding vpn-instance vpn1
ip add 2.2.2.2 30
PE2配置
1
2
3
4
5
6
7
8
9
10sys
ip vpn-instance vpn1
route-distinguisher 200:1
vpn-target 111:1 export-excommunity
vpn-target 111:1 import-excommunity
int g0/0/1
ip binding vpn-instance vpn1
ip add 11.1.1.1 30
配置PE1与R1与CE1之间网络互通
PE1配置
1
2
3
4
5sys
ospf 20
area 0
network 50.1.1.0 0.0.0.3
R1配置
1
2
3
4
5
6sys
ospf 20
area 0
network 50.1.1.0 0.0.0.3
network 30.1.1.0 0.0.0.3
CE1配置
1
2
3
4
5sys
ospf 20
area 0
network 30.1.1.0 0.0.0.3
配置PE2与CE2之间网络互通
PE2配置
1
2
3
4
5
6
7
8sys
isis 50 vpn-instance vpn1
network-entity 50.0000.0000.0003.00
int g0/0/1
isis enable 50
isis small-hello
CE2配置
1
2
3
4
5
6
7
8
9
10
11
12sys
isis 50
network-entity 50.0000.0000.0004.00
int g0/0/0
isis enable 50
isis small-hello
int g0/0/1
isis enable 50
isis small-hello
配置GRE隧道,指定IP地址、源地址、目的地址、隧道协议
PE1配置
1
2
3
4
5
6sys
int Tunnel 0/0/0
tunnel-protocol gre
source 50.1.1.1
destination 30.1.1.1
CE1配置
1
2
3
4
5
6
7sys
int Tunnel 0/0/0
tunnel-protocol gre
ip add 2.2.2.1 30
source 30.1.1.1
destination 50.1.1.1
配置GRE隧道路由,实现网络互通
PE1配置
1
2
3
4
5
6
7
8sys
isis 50 vpn-instance vpn1
network-entity 50.0000.0000.0002.00
int Tunnel 0/0/0
isis enable 50
isis small hello
CE1配置
1
2
3
4
5
6
7
8sys
isis 50
network-entity 50.0000.0000.0001.00
int Tunnel 0/0/0
isis enable 50
isis small-hello
配置BGP路由,实现MP-BGP
PE1配置
1
2
3
4
5
6
7
8
9
10sys
bgp 100
peer 3.3.3.9 as-number 100
peer 3.3.3.9 connect-interface LoopBack 0
ipv4-family vpnv4
peer 3.3.3.9 enable
ipv4-family vpn-instance
import-route isis 50
PE2配置
1
2
3
4
5
6
7
8
9
10sys
bgp 100
peer 1.1.1.9 as-number 100
peer 1.1.1.9 connect-interface LoopBack 0
ipv4-family vpnv4
peer 1.1.1.9 enable
ipv4-family vpn-instance vpn1
import-route isis 50
将MPLS骨干网中的路由引入到PE与CE间路由表
PE1配置
1
2
3
4sys
isis 50
import-route bgp
PE2配置
1
2
3
4sys
isis 50
import-route bgp
查看结果
查看VPN1的路由
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19dispaly ip routing-table vpn-instance vpn1
<PE1>dis ip routing-table vpn-instance vpn1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: vpn1
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.0/30 Direct 0 0 D 2.2.2.2 Tunnel0/0/0
2.2.2.2/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
2.2.2.3/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
11.1.1.0/30 IBGP 255 0 RD 3.3.3.9 GigabitEthernet
0/0/0
21.1.1.0/30 ISIS-L2 15 20 D 2.2.2.1 Tunnel0/0/0
41.1.1.0/30 IBGP 255 20 RD 3.3.3.9 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0查看CE1到PC2间的路由
1
2
3
4
5
6
7
8
9
10display ip routing-table 41.1.1.2
<CE1>display ip routing-table 41.1.1.2
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
41.1.1.0/30 ISIS-L2 15 74 D 2.2.2.2 Tunnel0/0/0