BGP选路实验

简介

BGP选路实验_第1张图片
R1和R2属于AS1,R3和R4属于AS2,R5、R6和R7属于AS3 ,要求R2通过R1学到AS2的路由,R4通过R3学到AS1的路由,AS1内路由器通过R5学到AS3的路由,AS2内的路由器通过R6学到AS3 的路由,AS3 内的路由器通过R5学到AS1 的路由,通过R6学到AS2 的路由
方法
通过修改BGP的选路规则达到选择需要走的路径的效果。
R1路由表
BGP选路实验_第2张图片
在R1将来自R3的AS2路由weight值增加,优选R1
R2路由表

BGP选路实验_第3张图片
将来自R6的路由metric值增加,优选R5
R4路由表

BGP选路实验_第4张图片
通过增加来自R6路由器的local值,优选R6
R5路由表

BGP选路实验_第5张图片
通过增加来自R4路由的AS-path,优选R6到达AS2
R6路由表
BGP选路实验_第6张图片
通过将来自R2的路由origin改为?,优选来自R5的路由到达AS1
R1:
interface Loopback0
ip address 10.1.1.1 255.255.255.255
interface Ethernet0/0
ip address 10.1.12.1 255.255.255.0
interface Ethernet0/1
ip address 10.1.13.1 255.255.255.0
router eigrp 100
network 10.0.0.0
network 10.1.1.1 0.0.0.0
network 10.12.1.0 0.0.0.255
router bgp 1
bgp router-id 10.1.1.1
bgp log-neighbor-changes
network 10.1.1.1 mask 255.255.255.255
neighbor 10.1.13.3 remote-as 2
neighbor 10.2.2.2 remote-as 1
neighbor 10.2.2.2 update-source Loopback0 neighbor 10.2.2.2 next-hop-self

R2
interface Loopback0
ip address 10.2.2.2 255.255.255.255
interface Ethernet0/0
ip address 10.1.12.2 255.255.255.0
interface Ethernet0/1
ip address 10.1.24.2 255.255.255.0
interface Ethernet0/2
ip address 10.1.25.2 255.255.255.0
interface Ethernet1/0
ip address 10.1.26.2 255.255.255.0
router eigrp 100
network 10.1.12.0 0.0.0.255
network 10.2.2.2 0.0.0.0
router bgp 1
bgp router-id 10.2.2.2
bgp log-neighbor-changes
network 10.2.2.2 mask 255.255.255.255
neighbor 10.1.1.1 remote-as 1
neighbor 10.1.1.1 update-source Loopback0 neighbor 10.1.1.1 next-hop-self
neighbor 10.1.24.4 remote-as 2
neighbor 10.1.24.4 route-map AS2 in
neighbor 10.1.25.5 remote-as 3
neighbor 10.1.26.6 remote-as 3
ip prefix-list AS2 seq 5 permit 10.3.3.3/32
ip prefix-list AS2 seq 10 permit 10.4.4.4/32
ip prefix-list AS3 seq 5 permit 10.6.6.6/32
ip prefix-list AS3 seq 10 permit 10.7.7.7/32
ip prefix-list AS3 seq 15 permit 10.8.8.8/32
route-map AS2 permit 10
match ip address prefix-list AS2
set metric 1
route-map AS2 permit 20
route-map AS3 permit 10
match ip address prefix-list AS3
set as-path prepend 2
route-map AS3 permit 20

R3
interface Loopback0
ip address 10.3.3.3 255.255.255.255
interface Ethernet0/0
ip address 10.1.34.3 255.255.255.0
interface Ethernet0/1
ip address 10.1.13.3 255.255.255.0
router eigrp 101
network 10.1.34.0 0.0.0.255
network 10.3.3.3 0.0.0.0
router bgp 2
bgp router-id 10.3.3.3
bgp log-neighbor-changes
network 10.3.3.3 mask 255.255.255.255
neighbor 10.1.13.1 remote-as 1
neighbor 10.1.13.1 route-map AS1 in
neighbor 10.4.4.4 remote-as 2
neighbor 10.4.4.4 update-source Loopback0
neighbor 10.4.4.4 next-hop-self
ip prefix-list AS1 seq 5 permit 10.1.1.1/32
ip prefix-list AS1 seq 10 permit 10.2.2.2/32
route-map AS1 permit 10
match ip address prefix-list AS1
set origin incomplete
route-map AS1 permit 20

R4
interface Loopback0
ip address 10.4.4.4 255.255.255.255
interface Ethernet0/0
ip address 10.1.34.4 255.255.255.0
interface Ethernet0/1
ip address 10.1.24.4 255.255.255.0
interface Ethernet0/2
ip address 10.1.46.4 255.255.255.0
interface Ethernet1/0
ip address 10.1.45.4 255.255.255.0
router eigrp 101 n
etwork 10.1.34.0 0.0.0.255
network 10.4.4.4 0.0.0.0
router bgp 2
bgp router-id 10.4.4.4
bgp log-neighbor-changes
network 10.4.4.4 mask 255.255.255.255
neighbor 10.1.24.2 remote-as 1
neighbor 10.1.45.5 remote-as 3
neighbor 10.1.46.6 remote-as 3
neighbor 10.1.46.6 route-map AS3 in
neighbor 10.3.3.3 remote-as 2
neighbor 10.3.3.3 update-source Loopback0
neighbor 10.3.3.3 next-hop-self
ip prefix-list AS3 seq 5 permit 10.5.5.5/32
route-map AS3 permit 10
match ip address prefix-list AS3
set local-preference 200
route-map AS3 permit 20

R5:
interface Loopback0
ip address 10.5.5.5 255.255.255.255
interface Ethernet0/0
ip address 10.1.56.5 255.255.255.0
interface Ethernet0/1
ip address 10.1.57.5 255.255.255.0
interface Ethernet0/2
ip address 10.1.25.5 255.255.255.0
interface Ethernet1/0
ip address 10.1.45.5 255.255.255.0
router eigrp 102
network 10.1.56.0 0.0.0.255
network 10.1.57.0 0.0.0.255
network 10.5.5.5 0.0.0.0
router eigrp 103
network 10.0.0.0
router bgp 3
bgp router-id 10.5.5.5
bgp log-neighbor-changes
network 10.5.5.5 mask 255.255.255.255
neighbor 10.1.25.2 remote-as 1
neighbor 10.1.25.2 route-map AS1 in
neighbor 10.1.45.4 remote-as 2
neighbor 10.6.6.6 remote-as 3
neighbor 10.6.6.6 update-source Loopback0
neighbor 10.6.6.6 next-hop-self
neighbor 10.7.7.7 remote-as 3
neighbor 10.7.7.7 update-source Loopback0
neighbor 10.7.7.7 next-hop-self
ip prefix-list AS1 seq 5 permit 10.6.6.6/32
ip prefix-list AS1 seq 10 permit 10.7.7.7/32
route-map AS1 permit 10
match ip address prefix-list AS1
set weight 100
route-map AS1 permit 20

R6:
interface Loopback0
ip address 10.6.6.6 255.255.255.255
interface Ethernet0/0
ip address 10.1.56.6 255.255.255.0
interface Ethernet0/1
ip address 10.1.67.6 255.255.255.0
interface Ethernet0/2
ip address 10.1.46.6 255.255.255.0
interface Ethernet1/0
ip address 10.1.26.6 255.255.255.0
router eigrp 102
network 10.1.56.0 0.0.0.255
network 10.1.67.0 0.0.0.255
network 10.6.6.6 0 0.0.0.0
router bgp 3
bgp router-id 10.6.6.6
bgp log-neighbor-changes
network 10.6.6.6 mask 255.255.255.255
neighbor 10.1.26.2 remote-as 1
neighbor 10.1.46.4 remote-as 2
neighbor 10.5.5.5 remote-as 3
neighbor 10.5.5.5 update-source Loopback0
neighbor 10.5.5.5 next-hop-self
neighbor 10.7.7.7 remote-as 3
neighbor 10.7.7.7 update-source Loopback0
neighbor 10.7.7.7 next-hop-self

R7
interface Loopback0
ip address 10.7.7.7 255.255.255.255
interface Ethernet0/0
ip address 10.1.67.7 255.255.255.0
interface Ethernet0/1
ip address 10.1.57.5 255.255.255.0
router eigrp 102
network 10.1.57.0 0.0.0.255
network 10.1.67.0 0.0.0.255
network 10.7.7.7 0.0.0.0
router bgp 3
bgp router-id 10.7.7.7
bgp log-neighbor-changes
network 10.7.7.7 mask 255.255.255.255
neighbor 10.5.5.5 remote-as 3
neighbor 10.5.5.5 update-source Loopback0
neighbor 10.6.6.6 remote-as 3
neighbor 10.6.6.6 update-source Loopback0

你可能感兴趣的:(BGP选路实验)