实验要求:
实验拓扑:
一、配置IP地址
二、给AS 2配置OSPF
1、R2-R7配置相同:
查看路由表:
可以看到,业务网段学的是32位的
修改:在R2-R7上都修改
[R2]int loo1
[R2-LoopBack1]ospf network-type broadcast
修改完成:
三、配置MPLS
给R2、R5、R7均配置
MPLS域不包含与R1、R8相连的接口
[R2]mpls lsr-id 172.16.1.2
[R2]mpls
[R2-mpls]mpls ldp
[R2-mpls-ldp]q
[R2]int g0/0/1 ----进入接口配置,MPLS区域里每个接口都要配置
[R2-GigabitEthernet0/0/1]mpls
[R2-GigabitEthernet0/0/1]mpls ldp
[R2]int g0/0/2
[R2-GigabitEthernet0/0/2]mpls
[R2-GigabitEthernet0/0/2]mpls ldp
[R2-GigabitEthernet0/0/2]q
查看MPLS邻居:
四、配置BGP
只给R2、R5、R7配置BGP
在R1上:
[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.1.1.2 as-number 2
[R1-bgp]peer 15.1.1.5 as-number 2
在R2上:
[R2]bgp 2
[R2-bgp]router-id 172.16.1.2
[R2-bgp]peer 12.1.1.1 as-number 1 ---与R1建邻
[R2-bgp]peer 172.16.1.7 as-number 2 ---与R7建邻
[R2-bgp]peer 172.16.1.7 connect-interface LoopBack 0 ----因为是用环回建邻,所以要用环回发包,路由器默认用接口发包,要修改更新源
[R2-bgp]peer 172.16.1.5 as-number 2
[R2-bgp]peer 172.16.1.5 connect-interface LoopBack 0
在R5上:
[R5]bgp 2
[R5-bgp]router-id 172.16.1.5
[R5-bgp]peer 15.1.1.1 as-number 1
[R5-bgp]peer 172.16.1.2 as-number 2
[R5-bgp]peer 172.16.1.2 connect-interface LoopBack 0
[R5-bgp]peer 172.16.1.7 as-number 2
[R5-bgp]peer 172.16.1.7 connect-interface LoopBack 0
在R7上:
[R7]bgp 2
[R7-bgp]router-id 172.16.1.7
[R7-bgp]peer 78.1.1.8 as-number 3
[R7-bgp]peer 172.16.1.5 as-number 2
[R7-bgp]peer 172.16.1.5 connect-interface LoopBack 0
[R7-bgp]peer 172.16.1.2 as-number 2
[R7-bgp]peer 172.16.1.2 connect-interface LoopBack 0
在R8上:
[R8]bgp 3
[R8-bgp]peer 78.1.1.7 as-number 2
查看BGP邻居表:
五、宣告
1、给R3、R4、R6配置缺省路由,指向最近的配置了BGP的设备
[R3]ip route-static 0.0.0.0 0 172.16.0.1
[R4]ip route-static 0.0.0.0 0 172.16.0.26
[R6]ip route-static 0.0.0.0 0 172.16.0.13
2、宣告业务网段:
在R1上:
[R1]bgp 1
[R1-bgp]network 10.1.1.0 24
在R2上:
[R2]bgp 2
[R2-bgp]network 172.16.2.0 24
[R2-bgp]peer 172.16.1.5 next-hop-local ---修改下一跳为本地,因为在一个AS之内传递,属性不变
[R2-bgp]peer 172.16.1.7 next-hop-local
在R5上:
[R5]bgp 2
[R5-bgp]network 172.16.5.0 24
[R5-bgp]peer 172.16.1.2 next-hop-local
[R5-bgp]peer 172.16.1.7 next-hop-local
在R7上:
[R7]bgp 2
[R7-bgp]network 172.16.7.0 24
[R7-bgp]peer 172.16.1.2 next-hop-local
[R7-bgp]peer 172.16.1.5 next-hop-local
在R8上:
[R8]bgp 3
[R8-bgp]network 10.1.2.0 24
此时R1和R8业务网段还是不能通信
解决:
[R2]route recursive-lookup tunnel
[R5]route recursive-lookup tunnel
[R7]route recursive-lookup tunnel
宣告AS2:
在R2上:
[R2]ip route-static 172.16.0.0 21 NULL 0
[R2]bgp 2
[R2-bgp]network 172.16.0.0 21
在R5上:
[R5]ip route-static 172.16.0.0 21 null 0
[R5]bgp 2
[R5-bgp]network 172.16.0.0 21
在R7上:
[R7]ip route-static 172.16.0.0 21 NULL 0
[R7]bgp 2
[R7-bgp]network 172.16.0.0 21
查看:
此时已经全网可达
测试:
六、实现选路问题
1、在R2上宣告R2、R3、R4的业务网段:
此时R1去往R2下一跳仍是R2,
解决:只修改R2的cost值就可以
[R2]ip ip-prefix a
[R2]ip ip-prefix a permit 172.16.2.0 24
[R2]route-policy a permit node 10
[R2-route-policy]if-match ip-prefix a
[R2-route-policy]apply cost 1
[R2]route-policy a permit 20
[R2]bgp 2
[R2-bgp]peer 12.1.1.1 route-policy a export
2、在R5上宣告R5、R6、R7
手机扫一扫
移动阅读更方便
你可能感兴趣的文章