(1)IP配置情况
(2)解决路由问题
R2、R3、R4之间运行ospf动态路由协议;R7缺省指向R4 ,因为R7属于客户端,故需要将R4对应的接口修改为沉默接口
R2
R3
R4
R7
[r7]ip route-static 0.0.0.0 0 47.1.1.1
测试:
R2
[r2]mpls lsr-id 2.2.2.2
[r2]mpls
Info: Mpls starting, please wait... OK!
[r2-mpls]mpls ldp
[r2]int g 0/0/1
[r2-GigabitEthernet0/0/1]mpls
[r2-GigabitEthernet0/0/1]mpls ldp
R3
[r3]mpls lsr-id 3.3.3.3
[r3]mpls
[r3-mpls]mpls ldp
[r3-mpls-ldp]int g 0/0/0
[r3-GigabitEthernet0/0/0] mpls
[r3-GigabitEthernet0/0/0] mpls ldp
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1] mpls
[r3-GigabitEthernet0/0/1] mpls ldp
R4
[r4]mpls lsr-id 4.4.4.4
[r4] mpls
[r4-mpls] mpls ldp
[r4-mpls-ldp]int g 0/0/0
[r4-GigabitEthernet0/0/0] mpls
[r4-GigabitEthernet0/0/0] mpls ldp
测试:
R2
[r2]ip -instance a1
[r2--instance-a1]ipv4-family
[r2--instance-a1-af-ipv4]route-distinguisher 1:1
[r2--instance-a1-af-ipv4]-target 1:1
[r2--instance-a1-af-ipv4]q
[r2--instance-a1]q
[r2]ip -instance b1
[r2--instance-b1]ipv4-family
[r2--instance-b1-af-ipv4]route-distinguisher 2:2
[r2--instance-b1-af-ipv4]-target 2:2
[r2-GigabitEthernet0/0/0]ip binding -instance b1
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r2-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[r2-GigabitEthernet0/0/0]int g 0/0/2
[r2-GigabitEthernet0/0/2]ip binding -instance a1
[r2-GigabitEthernet0/0/2]ip add 192.168.2.1 24
R4
[r4]ip -instance a2
[r4--instance-a2]ipv4-family
[r4--instance-a2-af-ipv4]route-distinguisher 1:1
[r4--instance-a2-af-ipv4]-target 1:1
[r4--instance-a2-af-ipv4]q
[r4--instance-a2]q
[r4]ip -instance b2
[r4--instance-b2]ipv4-family
[r4--instance-b2-af-ipv4]route-distinguisher 2:2
[r4--instance-b2-af-ipv4]-target 2:2
[r4-GigabitEthernet0/0/1]ip binding -instance b2
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r4-GigabitEthernet0/0/1]ip add 192.168.3.1 24
[r4-GigabitEthernet0/0/1]int g 0/0/2
[r4-GigabitEthernet0/0/2]ip binding -instance a2
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r4-GigabitEthernet0/0/2]ip add 192.168.3.1 24
(1)R1、R5、R6、R7配置IP地址
(2)R2、R4运行BGP,简历EBGP邻居关系
R2
[r2]bgp 1
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 4.4.4.4 as-number 1
[r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
R4
[r4]bgp 1
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 2.2.2.2 as-number 1
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
(3) R2、R6运行rip;R4、R7运行ospf;R1、R2、R4、R5手写静态路由
R6
[r6]rip 1
[r6-rip-1]ver 2
[r6-rip-1]net
[r6-rip-1]network 192.168.1.0
[r6-rip-1]network 192.168.2.0
R2
[r2]rip 1 -instance a1
[r2-rip-1]version 2
[r2-rip-1]network 192.168.2.0
R7
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 192.168.4.2 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 192.168.3.2 0.0.0.0
R4
[r4]ospf 2 -instance a2
[r4-ospf-2]area 0
[r4-ospf-2-area-0.0.0.0]network 192.168.3.1 0.0.0.0
R1:[r1]ip route-static 192.168.3.0 24 192.168.2.1
[r1]ip route-static 192.168.4.0 24 192.168.2.1
R2:[r2]ip route-static -instance b1 192.168.1.0 24 192.168.2.2
R5:[r5]ip route-static 192.168.1.0 24 192.168.3.1
[r5]ip route-static 192.168.2.0 24 192.168.3.1
R4:[r4]ip route-static -instance b2 192.168.4.0 24 192.168.3.2
(4)进行双向重发布
R2
[r2]bgp 1
[r2-bgp]ipv4-family -instance a1
[r2-bgp-a1]import-route rip 1
[r2-bgp-a1]q
[r2-bgp]ipv4 -instance b1
[r2-bgp-b1]import-route static
[r2-bgp-b1]import-route direct
[r2]rip 1 -instance a1
[r2-rip-1]import-route bgp
R4
[r4]ospf 2 -instance a2
[r4-ospf-2]import-route bgp
[r4-ospf-2]q
[r4]bgp 1
[r4-bgp]ipv4-family -instance a2
[r4-bgp-a2]import-route ospf 2
[r4-bgp-a2]q
[r4-bgp]ipv4-family -instance b2
[r4-bgp-b2]import-route static
[r4-bgp-b2]import-route direct
(5)测试
查看bgp的空间中的路由表
测试R1是否能够ping通R5
查看R6的路由表是否完整
尝试pingR7