BGP/MPLS ×××实验
实验描述:
上图共有六个路由器,其中P1、P2、PE1、PE2为ISP路由器,CE1、CE2为私网用户的出口路由器,在CE1、CE2上用L0接口来模拟用户私有网络。
PE1连接CE1,在PE1上创建一个×××实例,命名×××,RD为100:1,RT为100:1,PE2连接CE2,在PE2上创建一个×××实例,命名×××,RD为100:1,RT为100:1.
ISP的路由器都在一个AS 100中,CE1和PE1之间运行EBGP协议,CE1所在的AS为1000; CE2和PE2之间运行EBGP协议,CE2所在的AS为2000.
要求:CE1连接的私网用户可以访问CE2下的私网用户。
CE1
#show run
hostname
CE
1
!
no ip domain lookup
!
ip cef
interface Loopback0
ip address 10.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 1.1.1.1 255.255.255.0
duplex half
!
!
router bgp 1000
no synchronization
bgp log-neighbor-changes
redistribute connected
neighbor 1.1.1.2 remote-as 100
no auto-summary
!
ip classless
End
PE1
#show run
!
hostname
PE1
!
no ip domain lookup
!
ip vrf ***
rd 100:1
route-target export 100:1
route-target import 100:1
!
ip cef
!
!
interface Loopback0
ip address
20.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip vrf forwarding ***
ip address 1.1.1.2 255.255.255.0
duplex half
!
interface FastEthernet1/0
ip address 2.1.1.1 255.255.255.0
duplex half
tag-switching ip
!
router ospf 1
log-adjacency-changes
network 2.1.1.0 0.0.0.255 area 0
network 20.1.1.0 0.0.0.255 area 0
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 50.1.1.1 remote-as 100
neighbor 50.1.1.1 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 50.1.1.1 activate
neighbor 50.1.1.1 next-hop-self
neighbor 50.1.1.1 send-community extended
exit-address-family
!
address-family ipv4 vrf ***
redistribute connected
neighbor 1.1.1.1 remote-as 1000
neighbor 1.1.1.1 activate
no auto-summary
no synchronization
exit-address-family
!
ip classles
!
line con 0
exec-timeout 0 0
logging synchronous
End
P1
#show run
hostname
P1
!
no ip domain lookup
!
ip cef
!
interface Loopback0
ip address 30.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 3.1.1.1 255.255.255.0
duplex half
tag-switching ip
!
interface FastEthernet1/0
ip address 2.1.1.2 255.255.255.0
duplex half
tag-switching ip
!
router ospf 1
log-adjacency-changes
network 2.1.1.0 0.0.0.255 area 0
network 3.1.1.0 0.0.0.255 area 0
network 30.1.1.0 0.0.0.255 area 0
!
ip classless
line con 0
exec-timeout 0 0
logging synchronous
!
End
P2
#show run
hostname r4
!
no ip domain lookup
!
ip cef
!
interface Loopback0
ip address 40.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 3.1.1.2 255.255.255.0
duplex half
tag-switching ip
!
interface FastEthernet1/0
ip address 4.1.1.1 255.255.255.0
duplex half
tag-switching ip
!
router ospf 1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
ip classless
!
line con 0
exec-timeout 0 0
logging synchronous
!
End
PE2
#show run
hostname
PE2
no ip domain lookup
!
ip vrf ***
rd 100:1
route-target export 100:1
route-target import 100:1
!
ip cef
!
interface Loopback0
ip address
50.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip vrf forwarding ***
ip address 5.1.1.1 255.255.255.0
duplex half
!
interface FastEthernet1/0
ip address 4.1.1.2 255.255.255.0
duplex half
tag-switching ip
!
router ospf 1
log-adjacency-changes
network 4.1.1.0 0.0.0.255 area 0
network 50.1.1.0 0.0.0.255 area 0
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 20.1.1.1 remote-as 100
neighbor 20.1.1.1 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 20.1.1.1 activate
neighbor 20.1.1.1 next-hop-self
neighbor 20.1.1.1 send-community extended
exit-address-family
!
address-family ipv4 vrf ***
redistribute connected
neighbor 5.1.1.2 remote-as 2000
neighbor 5.1.1.2 activate
no auto-summary
no synchronization
exit-address-family
!
ip classless
!
line con 0
exec-timeout 0 0
logging synchronous
!
End
CE2
#show run
hostname
CE2
!
no ip domain lookup
!
ip cef
!
interface Loopback0
ip address 60.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 5.1.1.2 255.255.255.0
duplex half
!
!
router bgp 2000
bgp log-neighbor-changes
neighbor 5.1.1.1 remote-as 100
redistribute connected
neighbor 5.1.1.1 activate
no auto-summary
no synchronization
!
ip classless
!
!
line con 0
exec-timeout 0 0
logging synchronous
!
end