找回密码
 注册
搜索
热搜: 回贴

Cisco IOS Cookbook 中文精简版之 MPLS -- ZT

2010-1-31 07:54| 发布者: admin| 查看: 58| 评论: 0|原作者: 千年缘

该 如何配置MPLS核心网络里面的P路由器?
步骤:
Router-P1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router-P1(config)#ip cef
Router-P1(config)#mpls ip
Router-P1(config)#interface FastEthernet0/0
Router-P1(config-if)#description connection to Router-PE2
Router-P1(config-if)#ip address 10.1.2.11 255.255.255.0
Router-P1(config-if)#mpls ip
Router-P1(config-if)#exit
Router-P1(config)#interface Serial0/0
Router-P1(config-if)#description connection to Router-PE1
Router-P1(config-if)#ip address 10.1.1.14 255.255.255.252
Router-P1(config-if)#mpls ip
Router-P1(config-if)#exit
Router-P1(config)#interface Serial0/1
Router-P1(config-if)#description connection to Router-PE3
Router-P1(config-if)#ip address 10.1.1.10 255.255.255.252
Router-P1(config-if)#mpls ip
Router-P1(config-if)#exit
Router-P1(config)#interface Loopback0
Router-P1(config-if)#ip address 10.0.0.11 255.255.255.255
Router-P1(config-if)#exit
Router-P1(config)#router ospf 99
Router-P1(config-router)#router-id 10.0.0.11
Router-P1(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router-P1(config-router)#exit
Router-P1(config)#end
Router-P1#
注释 对于P路由器就是启用CEF和在端口启用MPLS,对于tag-switching ip instead 和mpls ip两个命令都基本一致,对于是否配置ldp或者tdp也不是必要的,路由器会自动适应。有三个验证命令:
Router-P1#show mpls interfaces
Interface IP Tunnel Operational
FastEthernet0/0 Yes (tdp) No Yes
Serial0/0 Yes (tdp) No Yes
Serial0/1 Yes (tdp) No Yes
Router-P1#show mpls ldp neighbor
Peer TDP Ident: 10.0.0.2:0; Local TDP Ident 10.0.0.11:0
TCP connection: 10.0.0.2.711 - 10.0.0.11.28185
State: Oper; PIEs sent/rcvd: 0/82; Downstream
Up time: 01:04:45
TDP discovery sources:
Serial0/0, Src IP addr: 10.1.1.13
Addresses bound to peer TDP Ident:
10.0.0.2 10.1.1.2 10.1.1.13
Router-P1#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 10.0.0.2/32 7697 Se0/0 point2point
17 Pop tag 10.1.1.0/30 0 Se0/0 point2point
18 Pop tag 10.0.0.3/32 6685 Se0/1 point2point
配置基本的MPLS PE路由器
提问 配置MPLS网络的运营商边界路由器来互联用户网络
回答
配置三台PE路由器
Router-PE1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router-PE1(config)#ip cef
Router-PE1(config)#mpls ip
Router-PE1(config)#interface Serial0/0
Router-PE1(config-if)#description Connection to Router-P1
Router-PE1(config-if)#ip address 10.1.1.13 255.255.255.252
Router-PE1(config-if)#mpls ip
Router-PE1(config-if)#exit
Router-PE1(config)#interface Loopback0
Router-PE1(config-if)#ip address 10.0.0.2 255.255.255.255
Router-PE1(config-if)#exit
Router-PE1(config)#router ospf 99
Router-PE1(config-router)#router-id 10.0.0.2
Router-PE1(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router-PE1(config-router)#exit
Router-PE1(config)#ip vrf NetworkA
Router-PE1(config-vrf)#rd 100:1
Router-PE1(config-vrf)#route-target export 100:1
Router-PE1(config-vrf)#route-target import 100:1
Router-PE1(config-vrf)#exit
Router-PE1(config)#ip vrf NetworkB
Router-PE1(config-vrf)#rd 100:2
Router-PE1(config-vrf)#route-target export 100:2
Router-PE1(config-vrf)#route-target import 100:2
Router-PE1(config-vrf)#exit
Router-PE1(config)#interface Ethernet0/0
Router-PE1(config-if)#description connection to customer A, site 1
Router-PE1(config-if)#ip vrf forwarding NetworkA
Router-PE1(config-if)#ip address 192.168.1.1 255.255.255.0
Router-PE1(config-if)#exit
Router-PE1(config)#interface Ethernet0/1
Router-PE1(config-if)#description connection to customer B, site 1
Router-PE1(config-if)#ip vrf forwarding NetworkB
Router-PE1(config-if)#ip address 192.168.11.1 255.255.255.0
Router-PE1(config-if)#exit
Router-PE1(config)#router bgp 100
Router-PE1(config-router)#bgp log-neighbor-changes
Router-PE1(config-router)#neighbor 10.0.0.3 remote-as 100
Router-PE1(config-router)#neighbor 10.0.0.3 update-source Loopback0
Router-PE1(config-router)#neighbor 10.0.0.4 remote-as 100
Router-PE1(config-router)#neighbor 10.0.0.4 update-source Loopback0
Router-PE1(config-router)#address-family ipv4 vrf NetworkA
Router-PE1(config-router-af)#no auto-summary
Router-PE1(config-router-af)#no synchronization
Router-PE1(config-router-af)#redistribute connected
Router-PE1(config-router-af)#exit-address-family
Router-PE1(config-router)#adress-family ipv4 vrf NetworkB
Router-PE1(config-router-af)#no auto-summary
Router-PE1(config-router-af)#no synchronization
Router-PE1(config-router-af)#redistribute connected
Router-PE1(config-router-af)#exit-address-family
Router-PE1(config-router)#address-family vpnv4
Router-PE1(config-router-af)#neighbor 10.0.0.3 activate
Router-PE1(config-router-af)#neighbor 10.0.0.3 send-community extended
Router-PE1(config-router-af)#neighbor 10.0.0.4 activate
Router-PE1(config-router-af)#neighbor 10.0.0.4 send-community extended
Router-PE1(config-router-af)#exit-address-family
Router-PE1(config-router)#exit
Router-PE1(config)#end
Router-PE1#
Router-PE2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router-PE2(config)#ip cef
Router-PE2(config)#mpls ip
Router-PE2(config)#interface FastEthernet0/0
Router-PE2(config-if)#no ip address
Router-PE2(config-if)#exit
Router-PE2(config)#interface FastEthernet0/0.1
Router-PE2(config-if)#description Connection to Router-P1
Router-PE2(config-if)#encapsulation dot1Q 10
Router-PE2(config-if)#ip address 10.1.2.4 255.255.255.0
Router-PE2(config-if)#mpls ip
Router-PE2(config-if)#exit
Router-PE2(config)#interface Loopback0
Router-PE2(config-if)#ip address 10.0.0.3 255.255.255.255
Router-PE2(config-if)#exit
Router-PE2(config)#router ospf 99
Router-PE2(config-router)#router-id 10.0.0.3
Router-PE2(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router-PE2(config-router)#exit
Router-PE2(config)#ip vrf NetworkA
Router-PE2(config-vrf)#rd 100:1
Router-PE2(config-vrf)#route-target export 100:1
Router-PE2(config-vrf)#route-target import 100:1
Router-PE2(config-vrf)#exit
Router-PE2(config)#ip vrf NetworkB
Router-PE2(config-vrf)#rd 100:2
Router-PE2(config-vrf)#route-target export 100:2
Router-PE2(config-vrf)#route-target import 100:2
Router-PE2(config-vrf)#exit
Router-PE2(config)#interface FastEthernet0/0.2
Router-PE2(config-if)#description Connection to customer A, site 2
Router-PE2(config-if)#encapsulation dot1Q 102
Router-PE2(config-if)#ip address 192.168.3.1 255.255.255.0
Router-PE2(config-if)#mpls ip
Router-PE2(config-if)#exit
Router-PE2(config)#router bgp 100
Router-PE2(config-router)#bgp log-neighbor-changes
Router-PE2(config-router)#neighbor 10.0.0.2 remote-as 100
Router-PE2(config-router)#neighbor 10.0.0.2 update-source Loopback0
Router-PE2(config-router)#neighbor 10.0.0.3 remote-as 100
Router-PE2(config-router)#neighbor 10.0.0.3 update-source Loopback0
Router-PE2(config-router)#address-family ipv4 vrf NetworkA
Router-PE2(config-router-af)#no auto-summary
Router-PE2(config-router-af)#no synchronization
Router-PE2(config-router-af)#redistribute connected
Router-PE2(config-router-af)#exit-address-family
Router-PE2(config-router)#address-family vpnv4
Router-PE2(config-router-af)#neighbor 10.0.0.2 activate
Router-PE2(config-router-af)#neighbor 10.0.0.2 send-community extended
Router-PE2(config-router-af)#neighbor 10.0.0.4 activate
Router-PE2(config-router-af)#neighbor 10.0.0.4 send-community extended
Router-PE2(config-router-af)#exit-address-family
Router-PE2(config-router)#exit
Router-PE2(config)#end
Router-PE2#
Router-PE3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router-PE3(config)#ip cef
Router-PE3(config)#mpls ip
Router-PE3(config)#interface Serial0/0
Router-PE3(config-if)#description Connection to Router-P1
Router-PE3(config-if)#ip address 10.1.1.9 255.255.255.252
Router-PE3(config-if)#mpls ip
Router-PE3(config-if)#exit
Router-PE3(config)#interface Loopback0
Router-PE3(config-if)#ip address 10.0.0.3 255.255.255.255
Router-PE3(config-if)#exit
Router-PE3(config)#router ospf 99
Router-PE3(config-router)#router-id 10.0.0.3
Router-PE3(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router-PE3(config-router)#exit
Router-PE3(config)#ip vrf NetworkA
Router-PE3(config-vrf)#rd 100:1
Router-PE3(config-vrf)#route-target export 100:1
Router-PE3(config-vrf)#route-target import 100:1
Router-PE3(config-vrf)#exit
Router-PE3(config)#ip vrf NetworkB
Router-PE3(config-vrf)#rd 100:2
Router-PE3(config-vrf)#route-target export 100:2
Router-PE3(config-vrf)#route-target import 100:2
Router-PE3(config-vrf)#exit
Router-PE3(config)#interface Ethernet0/0
Router-PE3(config-if)#description connection to customer A, site 3
Router-PE3(config-if)#ip vrf forwarding NetworkA
Router-PE3(config-if)#ip address 192.168.2.1 255.255.255.0
Router-PE3(config-if)#exit
Router-PE3(config)#interface Ethernet0/1
Router-PE3(config-if)#description connection to customer B, site 2
Router-PE3(config-if)#ip vrf forwarding NetworkB
Router-PE3(config-if)#ip address 192.168.10.1 255.255.255.0
Router-PE3(config-if)#exit
Router-PE3(config)#router bgp 100
Router-PE3(config-router)#bgp log-neighbor-changes
Router-PE3(config-router)#neighbor 10.0.0.2 remote-as 100
Router-PE3(config-router)#neighbor 10.0.0.2 update-source Loopback0
Router-PE3(config-router)#neighbor 10.0.0.4 remote-as 100
Router-PE3(config-router)#neighbor 10.0.0.4 update-source Loopback0
Router-PE3(config-router)#address-family ipv4 vrf NetworkA
Router-PE3(config-router-af)#no auto-summary
Router-PE3(config-router-af)#no synchronization
Router-PE3(config-router-af)#redistribute connected
Router-PE3(config-router-af)#exit-address-family
Router-PE3(config-router)#adress-family ipv4 vrf NetworkB
Router-PE3(config-router-af)#no auto-summary
Router-PE3(config-router-af)#no synchronization
Router-PE3(config-router-af)#redistribute connected
Router-PE3(config-router-af)#exit-address-family
Router-PE3(config-router)#address-family vpnv4
Router-PE3(config-router-af)#neighbor 10.0.0.2 activate
Router-PE3(config-router-af)#neighbor 10.0.0.2 send-community extended
Router-PE3(config-router-af)#neighbor 10.0.0.4 activate
Router-PE3(config-router-af)#neighbor 10.0.0.4 send-community extended
Router-PE3(config-router-af)#exit-address-family
Router-PE3(config-router)#exit
Router-PE3(config)#end
Router-PE3#
注释 对于PE路由器首先是类似P路由器的基本MPLS配置,然后是配置了两个客户网络的VRF,其中rd用来作为MP BGP发布此VRF路由的标签,route target用来告诉MP BGP那个rd与之共享路由。在关联接口和VRF的时候要先配置ip vrf forwarding命令然后配置IP地址,通过show ip vrf来验证。然后就是MP-BGP的配置,这里和平常BGP配置最大的不同就是必须有send-community extended的配置,因为VRF的信息是通过这个值来宣告的,两个验证命令show ip route vrf NetworkA和ping vrf NetworkA 192.168.2.9 source 192.168.1.1
后略,详见 :http://www.net130.com/CMS/Pub/Tech/tech_zh/2007_04_09_13769_2.htm

最新评论

相关分类

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 07:25 , Processed in 0.121435 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部