华为OSPF、BGP路由反射器配置详解(华为路由器ospf配置实例)

网友投稿 456 2022-09-26


华为OSPF、BGP路由反射器配置详解(华为路由器ospf配置实例)

对于网络工程师而言,OSPF、BGP的重要性不言而喻,本篇文章我们就来回顾下OSPF、BGP的配置技巧,重点如下1.熟悉DHCP配置;2.熟悉OSFP配置;3.BGP路由反射器配置 入下图所示,要求如下:1.网络拓扑规划如图所示;2.PC1、PC2、PC3全部自动获取ip地址;3.R1、R2、R3之间运行osfp保证网络的联通性;4.PC1、PC2、PC3之间网络互通

第一步 配置OSPF保证路由器直接网络连通性R1配置如下:[R1]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done.[R1]interface g0/0/2[R1-GigabitEthernet0/0/2]ip address 192.168.1.254 24[R1-GigabitEthernet0/0/2]dhcp select interface [R1]interface g0/0/0[R1-GigabitEthernet0/0/0]ip address 192.168.12.1 24[R1-GigabitEthernet0/0/0]q[R1]interface LoopBack 0[R1-LoopBack0]ip address 10.10.1.1 24[R1-LoopBack0]q [R1-ospf-1]area 0[R1-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255[R1-ospf-1-area-0.0.0.0]network 10.10.1.1 255.255.255.255R2配置如下:[R2]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done.[R2]interface g0/0/2[R2-GigabitEthernet0/0/2]ip address 192.168.2.254 24[R2-GigabitEthernet0/0/2]dhcp select interface [R2]interface g0/0/1[R2-GigabitEthernet0/0/1]ip address 192.168.12.2 24. [R2-GigabitEthernet0/0/1]q[R2]interface g0/0/0[R2-GigabitEthernet0/0/0]ip address 192.168.23.2 24. [R2-GigabitEthernet0/0/0]q[R2]interface LoopBack 0[R2-LoopBack0]ip address 10.10.2.2 24[R2-LoopBack0]q [R2-ospf-1]area 0[R2-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255[R2-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255[R2-ospf-1-area-0.0.0.0]network 10.10.2.2 255.255.255.255R3配置如下:[R2]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done.[R3]interface g0/0/2[R3-GigabitEthernet0/0/2]ip address 192.168.3.254 24[R3-GigabitEthernet0/0/2]dhcp select interface [R3]interface g0/0/1[R3-GigabitEthernet0/0/1]ip address 192.168.23.3 24[R3]interface LoopBack 0[R3-LoopBack0]ip address 10.10.3.3 24[R3-LoopBack0]q [R3-ospf-1]area 0[R3-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255[R3-ospf-1-area-0.0.0.0]network 10.10.3.3 255.255.255.255测试路由器直接连通性:在R1上ping路由器R3,网络互通[R1]ping 10.10.3.3PING 10.10.3.3: 56 data bytes, press CTRL_C to breakReply from 10.10.3.3: bytes=56 Sequence=1 ttl=254 time=40 msReply from 10.10.3.3: bytes=56 Sequence=2 ttl=254 time=20 msReply from 10.10.3.3: bytes=56 Sequence=3 ttl=254 time=30 msReply from 10.10.3.3: bytes=56 Sequence=4 ttl=254 time=30 msReply from 10.10.3.3: bytes=56 Sequence=5 ttl=254 time=50 ms --- 10.10.3.3 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 20/34/50 ms 第二步 配置bgpR1配置如下[R1]bgp [R1]bgp 64512[R1-bgp]peer 10.10.2.2 as-number 64512[R1-bgp]peer 10.10.2.2 connect-interface LoopBack 0[R1-bgp]import-route direct [R1-bgp]router-id 1.1.1.1R2配置如下[R2]bgp 64512[R2-bgp]router-id 2.2.2.2[R2-bgp]peer 10.10.1.1 as-number 64512[R2-bgp]peer 10.10.1.1 connect-interface LoopBack 0[R2-bgp]peer 10.10.3.3 as-number 64512 [R2-bgp]peer 10.10.3.3 connect-interface LoopBack 0[R2-bgp]import-route direct R3配置如下[R3]bgp [R3]bgp 64512[R3-bgp]peer 10.10.2.2 as-number 64512[R3-bgp]peer 10.10.2.2 connect-interface LoopBack 0[R3-bgp]import-route direct [R3-bgp]router-id 3.3.3.3 此时查看R1bgp路由表和R3的路由表如下;bgp路由表[R1]display bgp routing-table BGP Local router ID is 1.1.1.1 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 12Network NextHop MED LocPrf PrefVal Path/Ogn > 10.10.1.0/24 0.0.0.0 0 0 ?> 10.10.1.1/32 0.0.0.0 0 0 ?>i 10.10.2.0/24 10.10.2.2 0 100 0 ?> 127.0.0.0 0.0.0.0 0 0 ?> 127.0.0.1/32 0.0.0.0 0 0 ?> 192.168.1.0 0.0.0.0 0 0 ?> 192.168.1.254/32 0.0.0.0 0 0 ?>i 192.168.2.0 10.10.2.2 0 100 0 ?*> 192.168.12.0 0.0.0.0 0 0 ? i 10.10.2.2 0 100 0 ?> 192.168.12.1/32 0.0.0.0 0 0 ?>i 192.168.23.0 10.10.2.2 0 100 0 ?[R3]dis ip routing-table Route Flags: R - relay, D - download to fibRouting Tables: PublicDestinations : 18 Routes : 18

Destination/Mask Proto Pre Cost Flags NextHop Interface

10.10.1.1/32 OSPF 10 2 D 192.168.23.2 GigabitEthernet

0/0/110.10.2.0/24 IBGP 255 0 RD 10.10.2.2 GigabitEthernet0/0/110.10.2.2/32 OSPF 10 1 D 192.168.23.2 GigabitEthernet0/0/110.10.3.0/24 Direct 0 0 D 10.10.3.3 LoopBack010.10.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack010.10.3.255/32 Direct 0 0 D 127.0.0.1 LoopBack0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0192.168.2.0/24 IBGP 255 0 RD 10.10.2.2 GigabitEthernet0/0/1192.168.3.0/24 Direct 0 0 D 192.168.3.254 GigabitEthernet0/0/2192.168.3.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2192.168.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2192.168.12.0/24 OSPF 10 2 D 192.168.23.2 GigabitEthernet0/0/1192.168.23.0/24 Direct 0 0 D 192.168.23.3 GigabitEthernet0/0/1192.168.23.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1192.168.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

可以总结如下,可以看到,由于IBGP 遵守水平分割规则,R2不能将学习到的路由互相转发,造成R1与R3不能学习到对方的路由。PC1与PC2不能ping通。 在R2上配置路由反射器,使R1和R3成为了R2路由反射器配置如下[R2]bgp 64512 [R2-bgp]peer 10.10.1.1 reflect-client [R2-bgp]peer 10.10.3.3 reflect-client

R1的路由表和bgp路由表如下:[R1]display bgp routing-table

BGP Local router ID is 1.1.1.1 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incomplete

Total Number of Routes: 14Network NextHop MED LocPrf PrefVal Path/Ogn

> 10.10.1.0/24 0.0.0.0 0 0 ?> 10.10.1.1/32 0.0.0.0 0 0 ?>i 10.10.2.0/24 10.10.2.2 0 100 0 ?>i 10.10.3.0/24 10.10.3.3 0 100 0 ?> 127.0.0.0 0.0.0.0 0 0 ?> 127.0.0.1/32 0.0.0.0 0 0 ?> 192.168.1.0 0.0.0.0 0 0 ?> 192.168.1.254/32 0.0.0.0 0 0 ?>i 192.168.2.0 10.10.2.2 0 100 0 ?>i 192.168.3.0 10.10.3.3 0 100 0 ?*> 192.168.12.0 0.0.0.0 0 0 ?

i 10.10.2.2 0 100 0 ?> 192.168.12.1/32 0.0.0.0 0 0 ?>i 192.168.23.0 10.10.2.2 0 100 0 ?[R1]dis ip ro [R1]dis ip routing-table Route Flags: R - relay, D - download to fibRouting Tables: PublicDestinations : 20 Routes : 20

Destination/Mask Proto Pre Cost Flags NextHop Interface

10.10.1.0/24 Direct 0 0 D 10.10.1.1 LoopBack0 10.10.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 10.10.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0 10.10.2.0/24 IBGP 255 0 RD 10.10.2.2 GigabitEthernet

0/0/010.10.2.2/32 OSPF 10 1 D 192.168.12.2 GigabitEthernet0/0/010.10.3.0/24 IBGP 255 0 RD 10.10.3.3 GigabitEthernet0/0/010.10.3.3/32 OSPF 10 2 D 192.168.12.2 GigabitEthernet0/0/0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0192.168.1.0/24 Direct 0 0 D 192.168.1.254 GigabitEthernet0/0/2192.168.1.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2192.168.2.0/24 IBGP 255 0 RD 10.10.2.2 GigabitEthernet0/0/0192.168.3.0/24 IBGP 255 0 RD 10.10.3.3 GigabitEthernet0/0/0192.168.12.0/24 Direct 0 0 D 192.168.12.1 GigabitEthernet0/0/0192.168.12.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0192.168.12.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0192.168.23.0/24 OSPF 10 2 D 192.168.12.2 GigabitEthernet0/0/0255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

可以总结看到,路由反射器将从客户处学到的路由转发给除此客户外的所有的客户,R1与R3可以学习到对方的路由。PC1与PC3可以ping通。 测试PC1、PC2、PC3网络互通PC>ping 192.168.3.253

Ping 192.168.3.253: 32 data bytes, Press Ctrl_C to breakFrom 192.168.3.253: bytes=32 seq=1 ttl=125 time=31 msFrom 192.168.3.253: bytes=32 seq=2 ttl=125 time=32 msFrom 192.168.3.253: bytes=32 seq=3 ttl=125 time=31 msFrom 192.168.3.253: bytes=32 seq=4 ttl=125 time=15 msFrom 192.168.3.253: bytes=32 seq=5 ttl=125 time=32 ms

配置成功!!!!


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:路由交换之MUX VLAN(华为)(路由交换之静态路由)
下一篇:Java中关于字典树的算法实现
相关文章

 发表评论

暂时没有评论,来抢沙发吧~