MPLS ××× 基本实验测试
实验拓扑如下图所示
这次我们我测试的是3层的mpls *** R1和R5模拟同一公司的总部和分部,R6和R7模拟另一公司的总部和分部,中间的R2,R3和R4模拟运营商的mpls域 ,作为基本的mpls ***框架 R2和R4作为PE端,R3作为P端,其余的都作为客户端,为了实验的简单性,R2和R1,R6跑rip,R4和R5,R7也跑rip。在R2和R4上开两个vrf a和b,在R1,R6,R5和R7都开一个环回口分别为1.1.1.1/32 6.6.6.6/32 5.5.5.5/32 7.7.7.7/32最终的实验效果是R1和R5能互通,R6和R7能互通,R1和R6,R1和R7不通,R5和R,R6和R7不通。
这里我们解释几个比较关键的知识点
VRF:就是在R2上虚拟出路由器出来,VRF表和R2的全局路由表互相隔离,当把R2上的接口划到VRF中时,该接 口会在R2的全局路由表中消失。划分的方法为进入到该接口下 ip vrf forwarding a a是指新创建的vrf,R2和R1,R2和R6跑的Rip都是相互独立的,互不影响,因在R2划分了两个vrf a和b ,同理R4和R5及R7的情况也是一样。
RD:用来区分当R1和R6中出现相同的路由时,其他的路由器怎么区分出来,就是在普通的路由条目前面加入RD字段,由此构成了***v4的路由。这种路由我们用扩展的BGP协议来进行传递。
RT:他的本质是VRF自己的路由取舍及喜好的方式,在BGP的扩展团体属性中携带
我们贴出R1到R7的配置
R1#sh run
Building configuration...
Current configuration : 936 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Serial0/0
ip address 12.1.1.1 255.255.255.0
serial restart-delay 0
!
interface Serial0/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
router rip
version 2
network 1.0.0.0
network 12.0.0.0
no auto-summary
!
ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
exec-timeout 0 0
logging synchronous
login
!
!
end
R2#sh ru
*Mar 1 00:47:54.871: %SYS-5-CONFIG_I: Configured from console by console
R2#sh run
Building configuration...
Current configuration : 2071 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
ip vrf a
rd 1:1
route-target export 1:1
route-target import 1:1
!
ip vrf b
rd 2:2
route-target export 2:2
route-target import 2:2
!
!
mpls label protocol ldp
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Serial0/0
ip address 23.1.1.2 255.255.255.0
mpls ip
serial restart-delay 0
!
interface Serial0/1
ip vrf forwarding a
ip address 12.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
ip vrf forwarding b
ip address 26.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 23.1.1.0 0.0.0.255 area 0
!
router rip
version 2
no auto-summary
!
address-family ipv4 vrf b
redistribute bgp 1 metric 5
network 26.0.0.0
no auto-summary
version 2
exit-address-family
!
address-family ipv4 vrf a
redistribute bgp 1 metric 5
network 12.0.0.0
no auto-summary
exit-address-family
!
router bgp 1
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 1
neighbor 4.4.4.4 update-source Loopback0
!
address-family ipv4
no neighbor 4.4.4.4 activate
no auto-summary
no synchronization
exit-address-family
!
address-family ***v4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community both
exit-address-family
!
address-family ipv4 vrf b
redistribute rip metric 5
no synchronization
exit-address-family
!
address-family ipv4 vrf a
redistribute rip metric 5
no synchronization
exit-address-family
!
ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
exec-timeout 0 0
logging synchronous
login
!
!
end
R3#sh run
Building configuration...
Current configuration : 1104 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
mpls label protocol ldp
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Serial0/0
ip address 34.1.1.3 255.255.255.0
mpls ip
serial restart-delay 0
!
interface Serial0/1
ip address 23.1.1.3 255.255.255.0
mpls ip
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 4.4.4.4 0.0.0.0 area 0
network 23.1.1.0 0.0.0.255 area 0
network 34.1.1.0 0.0.0.255 area 0
!
ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
exec-timeout 0 0
logging synchronous
login
!
!
end
R4#sh run
Building configuration...
Current configuration : 2063 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
ip vrf a
rd 1:1
route-target export 1:1
route-target import 1:1
!
ip vrf b
rd 2:2
route-target export 2:2
route-target import 2:2
!
!
mpls label protocol ldp
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Serial0/0
ip vrf forwarding a
ip address 45.1.1.4 255.255.255.0
serial restart-delay 0
!
interface Serial0/1
ip address 34.1.1.4 255.255.255.0
mpls ip
serial restart-delay 0
!
interface Serial0/2
ip vrf forwarding b
ip address 47.1.1.4 255.255.255.0
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 0
network 34.1.1.0 0.0.0.255 area 0
!
router rip
version 2
no auto-summary
!
address-family ipv4 vrf b
redistribute bgp 1 metric 5
network 47.0.0.0
no auto-summary
exit-address-family
!
address-family ipv4 vrf a
redistribute bgp 1 metric 5
network 45.0.0.0
no auto-summary
exit-address-family
!
router bgp 1
bgp router-id 4.4.4.4
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 1
neighbor 2.2.2.2 update-source Loopback0
!
address-family ipv4
no neighbor 2.2.2.2 activate
no auto-summary
no synchronization
exit-address-family
!
address-family ***v4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
exit-address-family
!
address-family ipv4 vrf b
redistribute rip metric 5
no synchronization
exit-address-family
!
address-family ipv4 vrf a
redistribute rip metric 5
no synchronization
exit-address-family
!
ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
exec-timeout 0 0
logging synchronous
login
!
!
end
R5#sh run
Building configuration...
Current configuration : 951 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R5
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Serial0/0
no ip address
shutdown
serial restart-delay 0
no fair-queue
!
interface Serial0/1
ip address 45.1.1.5 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
router rip
version 2
network 5.0.0.0
network 45.0.0.0
no auto-summary
!
ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
exec-timeout 0 0
logging synchronous
login
!
!
end
R6#sh run
Building configuration...
Current configuration : 951 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R6
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface Serial0/0
no ip address
shutdown
serial restart-delay 0
no fair-queue
!
interface Serial0/1
ip address 26.1.1.6 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
router rip
version 2
network 6.0.0.0
network 26.0.0.0
no auto-summary
!
ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
exec-timeout 0 0
logging synchronous
login
!
!
end
R7#sh run
Building configuration...
Current configuration : 951 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R7
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface Serial0/0
no ip address
shutdown
serial restart-delay 0
no fair-queue
!
interface Serial0/1
ip address 47.1.1.7 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
router rip
version 2
network 7.0.0.0
network 47.0.0.0
no auto-summary
!
ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
exec-timeout 0 0
logging synchronous
login
!
!
end
我们测试下结果
OK 实验结果跟我们预测的一样