BGP与ospf

您所在的位置:网站首页 ospf协议是外部网关协议吗 BGP与ospf

BGP与ospf

2024-07-12 11:12:34| 来源: 网络整理| 查看: 265

BGP是一种外部网关协议,是一种动态路由协议,实际上它不产生路由,不发现路由,不计算路由其主要功能是完成最佳路由的选择并在BGP邻居之间进行最佳路由的传递,BGP选择了TCP作为其传输协议。

BGP支持无类域间路由CIDR,提供了丰富的路由属性,能够非常容易的实现路由策略,支持VPN,IPV6等特性。

BGP的邻居关系分为两种,EBGP(两台路由器属于不同的AS)IBGP(两台路由器属于同一AS)

BGP的local preference属性可以用来选择流量离开AS时的最佳路由,也就是控制流量从哪个出口离开AS,当BGP路与其通过不同的IBGP路由器对等体接收到目标网络相同但下一跳不同的多条路由时,将优先选择local preference值较高的路由。

上述拓扑图需要实现的功能如下:1.r4访问A时将r2作为出口,

2.访问服务器B时将r3作为出口

3.AS200内使用ospf通信

实验步骤如下:

1.各个设备的ip基础配置

2.ospf与bgp协议的基础配置

3.观察bgp路与信息的local preference属性

4.修改local preference默认值

5.使用route-policy 修改local preference值

6.测试

#R1: system-view [Huawei]un in en #关闭提示信息 [Huawei]sysname r1 [r1]interface g0/0/1 [r1-GigabitEthernet0/0/1]ip add 10.0.13.1 24 [r1-GigabitEthernet0/0/1]quit [r1]interface g0/0/0 [r1-GigabitEthernet0/0/0]ip add 10.0.12.1 24 [r1-GigabitEthernet0/0/0]quit [r1]interface g0/0/0 [r1-GigabitEthernet0/0/0]quit [r1]interface LoopBack 0 [r1-LoopBack0]ip add 10.0.1.1 32 [r1-LoopBack0]quit [r1]interface loopback 1 [r1-LoopBack1]ip add 10.0.100.2 32 [r1-LoopBack1] ping 10.0.12.2 0.00% packet loss #配置bgp [r1]bgp 100 [r1-bgp]router-id 10.0.1.1 [r1-bgp]peer 10.0.12.2 as-number 200 [r1-bgp]peer 10.0.13.3 as-number 200 [r1-bgp]network 10.0.1.1 32 #通告 [r1-bgp]network 10.0.100.2 32 [r1]display bgp peer [r1]display bgp routing-table R2: system-view [Huawei]sysname r2 [r2]un in en [r2]interface g0/0/0 [r2-GigabitEthernet0/0/0]ip add 10.0.12.2 24 [r2-GigabitEthernet0/0/0]quit [r2]interface g0/0/1 [r2-GigabitEthernet0/0/1]ip add 10.0.24.2 24 [r2-GigabitEthernet0/0/1]interface loopback0 [r2-LoopBack0]ip add 10.0.2.2 32 [r2]ospf 1 router-id 10.0.2.2 [r2-ospf-1]area 0 [r2-ospf-1-area-0.0.0.0]network 10.0.24.2 0.0.0.255 [r2-ospf-1-area-0.0.0.0]network 10.0.2.2 0.0.0.0 [r2]bgp 200 [r2-bgp]router-id 10.0.2.2 [r2-bgp]peer 10.0.12.1 as-number 100 [r2-bgp]peer 10.0.3.3 as-number 200 [r2-bgp]peer 10.0.3.3 connect-interface LoopBack 0 #ip绑定接口 [r2-bgp]peer 10.0.3.3 next-hop-local [r2-bgp]peer 10.0.4.4 as-number 200 [r2-bgp]peer 10.0.4.4 connect-interface loopback 0 [r2-bgp]peer 10.0.4.4 next-hop-local [r2]display bgp routing-table system-view [r2]ip ip-prefix 1 permit 10.0.1.1 32 #创建ip前缀列表规则 [r2]route-policy 1 permit node 10 #创建路由策略10 [r2-route-policy]if-match ip-prefix 1 #创建if-match规则 [r2-route-policy]apply local-preference 500 #创建apply [r2-route-policy]quit [r2]route-policy 1 permit node 20 Info: New Sequence of this List. [r2-route-policy]quit [r2]bgp 200 [r2-bgp]peer 10.0.12.1 route-policy 1 import #引入路由策略 [r2-bgp]quit [r2]display bgp routing-table R3: system-view [Huawei]un in en [Huawei]sysname r3 [r3]interface g0/0/1 [r3-GigabitEthernet0/0/1]ip add 10.0.13.3 24 [r3-GigabitEthernet0/0/1]interface g0/0/0 [r3-GigabitEthernet0/0/0]ip add 10.0.34.3 24 [r3-GigabitEthernet0/0/0]quit [r3]interface loopback0 [r3-LoopBack0]ip add 10.0.3.3 32. [r3]ospf 1 router-id 10.0.2.2 [r3-ospf-1]area 0 [r3-ospf-1-area-0.0.0.0]network 10.0.34.0 0.0.0.255 [r3-ospf-1-area-0.0.0.0]network 10.0.3.3 0.0.0.0 [r3-ospf-1-area-0.0.0.0]quit [r3-ospf-1]quit reset ospf 1 process [r3]bgp 200 [r3-bgp]router-id 10.0.3.3 [r3-bgp]peer 10.0.13.1 as-number 100 [r3-bgp]peer 10.0.2.2 as-number 200 [r3-bgp]peer 10.0.2.2 connect-interface loopback 0 [r3-bgp]peer 10.0.2.2 next-hop-local [r3-bgp]peer 10.0.4.4 as-number 200 [r3-bgp]peer 10.0.4.4 connect-interface loopback 0 [r3-bgp]peer 10.0.4.4 next-hop-local [r3]display default-parameter bgp #查看bgp属性 BGP version : 4 EBGP preference : 255 IBGP preference : 255 Local preference : 255 BGP connect-retry : 32s BGP holdtime : 180s BGP keepAlive : 60s EBGP route-update-interval: 30s IBGP route-update-interval: 15s Default local-preference : 100 Default MED : 0 IPv4-family unicast : enable EBGP-interface-sensitive : enable Reflect between-clients : enable Check-first-as : enable Synchronization : disable Nexthop-resolved rules : IPv4-family : unicast(ip) label-route(ip) multicast(ip) vpn-instance(tunnel) vpnv4(ip) IPv6-family : unicast(ip) vpn-instance(tunnel) [r3]bgp 200 r3-bgp]default local-preference 200 #修改优先级 R4: system-view [Huawei]un in en [Huawei]sysname r4 [r4]interface g0/0/01 [r4-GigabitEthernet0/0/1]ip add 10.0.24.4 24 [r4-GigabitEthernet0/0/1]quit [r4]interface g0/0/0 [r4-GigabitEthernet0/0/0]ip add 10.0.34.4 24 [r4-GigabitEthernet0/0/0]quit [r4]interface loopback0 [r4-LoopBack0]ip add 10.0.4.4 32 [r4-LoopBack0]quit [r4]interface loopback1 [r4-LoopBack1]ip add 10.0.100.4 32 [r4-LoopBack1] [r4]ospf 1 router-id 10.0.4.4 [r4-ospf-1]area 0 [r4-ospf-1-area-0.0.0.0]network 10.0.24.0 0.0.0.255 [r4-ospf-1-area-0.0.0.0]network 10.0.34.0 0.0.0.255 [r4-ospf-1-area-0.0.0.0]network 10.0.4.4 0.0.0.0 [r4-ospf-1-area-0.0.0.0]quit [r4-ospf-1]quit [r4]display ospf peer brief OSPF Process 1 with Router ID 10.0.4.4 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/1 10.0.2.2 Full 0.0.0.0 GigabitEthernet0/0/0 10.0.13.3 Full ---------------------------------------------------------------------------- [r4]display ospf peer brief OSPF Process 1 with Router ID 10.0.4.4 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/1 10.0.2.2 Full 0.0.0.0 GigabitEthernet0/0/0 10.0.3.3 Full ---------------------------------------------------------------------------- [r4]display ospf peer OSPF Process 1 with Router ID 10.0.4.4 Neighbors Area 0.0.0.0 interface 10.0.24.4(GigabitEthernet0/0/1)'s neighbors Router ID: 10.0.2.2 Address: 10.0.24.2 State: Full Mode:Nbr is Slave Priority: 1 DR: 10.0.24.2 BDR: 10.0.24.4 MTU: 0 Dead timer due in 38 sec Retrans timer interval: 5 Neighbor is up for 00:04:24 Authentication Sequence: [ 0 ] Neighbors Area 0.0.0.0 interface 10.0.34.4(GigabitEthernet0/0/0)'s neighbors Router ID: 10.0.3.3 Address: 10.0.34.3 State: Full Mode:Nbr is Slave Priority: 1 DR: 10.0.34.4 BDR: 10.0.34.3 MTU: 0 Dead timer due in 37 sec Retrans timer interval: 5 Neighbor is up for 00:00:29 Authentication Sequence: [ 0 ] [r4] [r4]bgp 200 [r4-bgp]router-id 10.0.4.4 [r4-bgp]peer 10.0.2.2 as-number 200 [r4-bgp]peer 10.0.2.2 connect-interface loopback 0 [r4-bgp]peer 10.0.3.3 as-number 200 [r4-bgp]peer 10.0.3.3 connect-interface loopback 0 [r4-bgp]network 10.0.100.4 32 [r4-bgp]quit [r4]display bgp routing-table [r4]display bgp routing-table tracert -a 10.0.100.4 10.0.1.1 traceroute to 10.0.1.1(10.0.1.1), max hops: 30 ,packet length: 40,press CTRL_C to break 1 10.0.34.3 20 ms 20 ms 20 ms 2 10.0.13.1 20 ms 10 ms 30 ms [r4]display bgp routing-table BGP Local router ID is 10.0.4.4 Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 3 Network NextHop MED LocPrf PrefVal Path/Ogn *>i 10.0.1.1/32 10.0.2.2 0 500 0 100i *>i 10.0.100.2/32 10.0.3.3 0 200 0 100i *> 10.0.100.4/32 0.0.0.0 0 0 i ping -a 10.0.100.4 10.0.1.1 PING 10.0.1.1: 56 data bytes, press CTRL_C to break Reply from 10.0.1.1: bytes=56 Sequence=1 ttl=254 time=30 ms Reply from 10.0.1.1: bytes=56 Sequence=2 ttl=254 time=40 ms Reply from 10.0.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms Reply from 10.0.1.1: bytes=56 Sequence=4 ttl=254 time=30 ms Reply from 10.0.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms --- 10.0.1.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 30/32/40 ms

 



【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭