当前位置: 首页 > news >正文

HCIP——前期综合实验

前期综合实验

  • 一、实验拓扑
  • 二、实验要求
  • 三、实验思路
  • 四、实验步骤
    • 1、配置接口IP地址
    • 2、交换机配置划分vlan10以及vlan20
    • 3、总部分部,骨干网配置OSPF
      • 分部
      • 总部
      • 骨干网
    • 4、配置BGP建立邻居关系
      • 总部
      • 骨干网
      • 分部
    • 5、发布用户网段
    • 6、将下一跳改为本地
    • 7、允许AS重复
    • 8、重发布
    • 9、修改BGP优先级
    • 10、优化
      • (1)修改cost值
      • (2)修改MED值
      • (3)修改为type1

一、实验拓扑

在这里插入图片描述

二、实验要求

1、该拓扑为公司网络,其中包括公司总部、公司分部以及公司骨干网,不包含运营商公网部分。
2、设备名称均使用拓扑上名称改名,并且区分大小写。
3、整张拓扑均使用私网地址进行配置。
4、整张网络中,运行OSPF协议或者BGP协议的设备,其Router-id值为设备名数字号,例如R1的Router-id为1.1.1.1、
5、OSPF路由宣告部分选择接口宣告方式,例如192.168.100.1 0.0.0.0;BGP仅宣告用户网段。
6、IBGP部分使用环回建立邻居,EBGP部分使用直连链路建立邻居,所有运行BGP的设备都需要建立邻居。
7、R1、R2、R5、R6、R7、R8、R9、R10需要配置环回接口,环回接口IP为设备名数字号,掩码为32,例如R2的环回接口为2.2.2.2/32
8、所有PC的IP地址均手工配置。
公司分部:
1、PC5和PC6属于不同VLAN
3、SW3是一个三层交换机
4、R9是分部出口路由器
5、分部使用OSPF进程200达到分部网络全网可达
6、公司分部出口设备运行BGP协议连接骨干网络,AS号为100
7、因AS-PATH属性原因,总部与分部路由会学习不到,使用命令如(peer 10.10.10.10 allow-as-loop,仅在总部与分部设备上配置即可),将允许AS号重复。
公司总部:
1、交换机为二层交换机
2、PC1和PC2属于一个网段,PC3和PC4是一个网段
3、R3和R4分别是下方PC的网关路由器
4、为保障公司总部到骨干网络的连通性,公司总部使用双路由器双出口的方式接入骨干网
5、为保障公司总部网络内部具备负载,R1、R2、R3、R4设备均作为设备冗余,并使用全连接的方式进行路由选路
6、总部内网使用OSPF进程100达到全网可达,OSPF需要宣告环回。
7、公司总部双出口设备运行BGP协议连接骨干网络,AS号为100
8、因为R1和R2重发布时会出现次优路径,需要修改BGP路由优先级,使用命令(preference 140 255 255,仅在总部设备上配置即可),配置位置在iPv4-family unicast中。
公司骨干网:
1、为保障公司网络连通性,骨干网络考虑设备冗余操作,连接总部使用双路由器,骨干网络部分路由器之间使用双链路路方式
2、骨干网设备运行OSPF协议达到骨干网全网可达,进程号为10。
3、骨干网设备运行BGP协议,AS号为200。使用全连接方式建邻。
优化:
1、为达到分流互备效果,公司总部业务部访问分部流量走R1,R2做备份;公司总部工程部访问分部流量走R2,R1做备份,并要求来回路径一致。
2、公司总部双出口流量均流向R5,R6做备份。来回路径一致。
3、OSPF重发布时,更改类型为Type-1
4、所有策略名称为policy-1
5、更改开销时,全部更改为10
在这里插入图片描述
在这里插入图片描述

三、实验思路

在这里插入图片描述

四、实验步骤

1、配置接口IP地址

R1:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]user-interface console 0
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.100.9 30
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.100.41 30
[R1-GigabitEthernet0/0/1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip address 192.168.100.17 30
[R1-GigabitEthernet0/0/2]int g2/0/0
[R1-GigabitEthernet2/0/0]ip address 10.10.10.1 30
[R1-GigabitEthernet2/0/0]int g3/0/0
[R1-GigabitEthernet3/0/0]ip address 10.10.10.5 30
[R1-GigabitEthernet3/0/0]q
[R1]int l0
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]q
[R1]

R2:

[Huawei]sys R2
[R2]user-interface console 0
[R2-ui-console0]idle-timeout 0 0
[R2-ui-console0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 10.10.10.13 30
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 10.10.10.9 30
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip address 10.10.10.42 30 
[R2-GigabitEthernet0/0/2]int g3/0/0
[R2-GigabitEthernet3/0/0]ip address 192.168.100.6 30
[R2-GigabitEthernet3/0/0]int g4/0/0
[R2-GigabitEthernet4/0/0]ip address 192.168.100.13 30
[R2-GigabitEthernet4/0/0]q
[R2]int l0
[R2-LoopBack0]ip address 2.2.2.2 32
[R2-LoopBack0]q
[R2]

R3:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]user-interface console 0
[R3-ui-console0]idle-timeout 0 0
[R3-ui-console0]quit
[R3]
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.100.10 30
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.100.5 30
[R3-GigabitEthernet0/0/1]int g0/0/2
[R3-GigabitEthernet0/0/2]ip address 192.168.100.1 30
[R3-GigabitEthernet0/0/2]int g3/0/0
[R3-GigabitEthernet3/0/0]ip address 192.168.1.254 30
[R3-GigabitEthernet3/0/0]q
[R3]int g3/0/0
[R3-GigabitEthernet3/0/0]ip address 192.168.1.254 24
[R3-GigabitEthernet3/0/0]q
[R3]

R4:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]user-interface console 0
[R4-ui-console0]idle-timeout 0 0
[R4-ui-console0]quit
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.100.14 30
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.100.18 30
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]ip address 192.168.100.2 30
[R4-GigabitEthernet0/0/2]int g3/0/0
[R4-GigabitEthernet3/0/0]ip address 192.168.2.254 24
[R4-GigabitEthernet3/0/0]q
[R4]

R5:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]user-interface console 0
[R5-ui-console0]idle-timeout 0 0
[R5-ui-console0]quit
[R5]
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip address 10.10.10.2 30
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip address 10.10.10.10 30
[R5-GigabitEthernet0/0/1]int g0/0/2
[R5-GigabitEthernet0/0/2]ip address 10.10.10.21 30
[R5-GigabitEthernet0/0/2]int g2/0/0
[R5-GigabitEthernet2/0/0]ip address 10.10.10.17 30
[R5-GigabitEthernet2/0/0]q
[R5]int l0
[R5-LoopBack0]ip address 5.5.5.5 32
[R5-LoopBack0]q
[R5]

R6:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R6
[R6]user-interface console 0
[R6-ui-console0]idle-timeout 0 0
[R6-ui-console0]quit
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip address 10.10.10.14 30
[R6-GigabitEthernet0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip address 10.10.10.6 30
[R6-GigabitEthernet0/0/1]int g3/0/0
[R6-GigabitEthernet3/0/0]ip address 10.10.10.18 30
[R6-GigabitEthernet3/0/0]int g0/0/2
[R6-GigabitEthernet0/0/2]ip address 10.10.10.25 30
[R6-GigabitEthernet0/0/2]q
[R6]int l0
[R6-LoopBack0]ip address 6.6.6.6 32
[R6-LoopBack0]q
[R6]

R7:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R7
[R7]user-interface console 0
[R7-ui-console0]idle-timeout 0 0
[R7-ui-console0]quit
[R7]
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip address 10.10.10.22 30 
[R7-GigabitEthernet0/0/0]int g0/0/1
[R7-GigabitEthernet0/0/1]ip address 10.10.10.26 30
[R7-GigabitEthernet0/0/1]int g0/0/2
[R7-GigabitEthernet0/0/2]ip address 10.10.10.33 30
[R7-GigabitEthernet0/0/2]int g4/0/0
[R7-GigabitEthernet4/0/0]ip address 10.10.10.29 30
[R7-GigabitEthernet4/0/0]q
[R7]int l0
[R7-LoopBack0]ip ad	
[R7-LoopBack0]ip address 7.7.7.7 32
[R7-LoopBack0]q
[R7]

R8:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R8
[R8]user-interface console 0
[R8-ui-console0]idle-timeout 0 0
[R8-ui-console0]quit
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]int g0/0/0
[R8-GigabitEthernet0/0/0]ip address 10.10.10.34 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip address 10.10.10.30 30
[R8-GigabitEthernet0/0/1]int g0/0/2
[R8-GigabitEthernet0/0/2]ip address 10.10.10.37 30
[R8-GigabitEthernet0/0/2]int l0
[R8-LoopBack0]ip ad	
[R8-LoopBack0]ip address 8.8.8.8 32
[R8-LoopBack0]q

R9:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R9
[R9]user-interface console 0
[R9-ui-console0]idle-timeout 0 0
[R9-ui-console0]quit
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip address 192.168.200.2 30
[R9-GigabitEthernet0/0/1]int g0/0/2
[R9-GigabitEthernet0/0/2]ip address 10.10.10.38 30
[R9-GigabitEthernet0/0/2]int l0
[R9-LoopBack0]ip address 9.9.9.9 32
[R9-LoopBack0]q
[R9]

R10:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R10
[R10]user-interface console 0
[R10-ui-console0]idle-timeout 0 0
[R10-ui-console0]quit
[R10-GigabitEthernet0/0/0]int g0/0/1.1
[R10-GigabitEthernet0/0/1.1]ip address 192.168.3.254 24
[R10-GigabitEthernet0/0/1.1]int g0/0/1.2
[R10-GigabitEthernet0/0/1.2]ip address 192.168.4.254 24
[R10-GigabitEthernet0/0/1.2]q
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip ad	
[R10-GigabitEthernet0/0/0]ip address 192.168.200.1 30
[R10-GigabitEthernet0/0/0]q
[R10]

检查接口状态以及配置:
R1:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.100.9/30     up         up        
GigabitEthernet0/0/1              192.168.100.41/30    up         up        
GigabitEthernet0/0/2              192.168.100.17/30    up         up        
GigabitEthernet2/0/0              10.10.10.1/30        up         up        
GigabitEthernet3/0/0              10.10.10.5/30        up         up        
GigabitEthernet4/0/0              unassigned           down       down      
LoopBack0                         1.1.1.1/32           up         up(s)     
NULL0                             unassigned           up         up(s) 

R2:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.10.10.13/30       up         up        
GigabitEthernet0/0/1              10.10.10.9/30        up         up        
GigabitEthernet0/0/2              10.10.10.42/30       up         up        
GigabitEthernet3/0/0              192.168.100.6/30     up         up        
GigabitEthernet4/0/0              192.168.100.13/30    up         up        
LoopBack0                         2.2.2.2/32           up         up(s)     
NULL0                             unassigned           up         up(s) 

R3:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.100.10/30    up         up        
GigabitEthernet0/0/1              192.168.100.5/30     up         up        
GigabitEthernet0/0/2              192.168.100.1/30     up         up        
GigabitEthernet3/0/0              192.168.1.254/24     up         up        
GigabitEthernet4/0/0              unassigned           down       down      
NULL0                             unassigned           up         up(s)     

R4:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.100.14/30    up         up        
GigabitEthernet0/0/1              192.168.100.18/30    up         up        
GigabitEthernet0/0/2              192.168.100.2/30     up         up        
GigabitEthernet3/0/0              192.168.2.254/24     up         up        
GigabitEthernet4/0/0              unassigned           down       down      
NULL0                             unassigned           up         up(s)  

R5:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.10.10.2/30        up         up        
GigabitEthernet0/0/1              10.10.10.10/30       up         up        
GigabitEthernet0/0/2              10.10.10.21/30       up         up        
GigabitEthernet2/0/0              10.10.10.17/30       up         up        
GigabitEthernet3/0/0              unassigned           down       down      
GigabitEthernet4/0/0              unassigned           down       down      
LoopBack0                         5.5.5.5/32           up         up(s)     
NULL0                             unassigned           up         up(s)  

R6:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.10.10.14/30       up         up        
GigabitEthernet0/0/1              10.10.10.6/30        up         up        
GigabitEthernet0/0/2              10.10.10.25/30       up         up        
GigabitEthernet3/0/0              10.10.10.18/30       up         up        
GigabitEthernet4/0/0              unassigned           down       down      
LoopBack0                         6.6.6.6/32           up         up(s)     
NULL0                             unassigned           up         up(s)   

R7:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.10.10.22/30       up         up        
GigabitEthernet0/0/1              10.10.10.26/30       up         up        
GigabitEthernet0/0/2              10.10.10.33/30       up         up        
GigabitEthernet4/0/0              10.10.10.29/30       up         up        
LoopBack0                         7.7.7.7/32           up         up(s)     
NULL0                             unassigned           up         up(s)   

R8:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.10.10.34/30       up         up        
GigabitEthernet0/0/1              10.10.10.30/30       up         up        
GigabitEthernet0/0/2              10.10.10.37/30       up         up        
LoopBack0                         8.8.8.8/32           up         up(s)     
NULL0                             unassigned           up         up(s) 

R9:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              192.168.200.2/30     up         up        
GigabitEthernet0/0/2              10.10.10.38/30       up         up        
LoopBack0                         9.9.9.9/32           up         up(s)     
NULL0                             unassigned           up         up(s)  

R10:

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.200.1/30     up         up        
GigabitEthernet0/0/1              unassigned           up         down      
GigabitEthernet0/0/1.1            192.168.3.254/24     up         down      
GigabitEthernet0/0/1.2            192.168.4.254/24     up         down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)   

2、交换机配置划分vlan10以及vlan20

LSW3:

[SW3]vlan b	
[SW3]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk 
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[SW3-GigabitEthernet0/0/1]int g0/0/2
[SW3-GigabitEthernet0/0/2]port link-type access 
[SW3-GigabitEthernet0/0/2]port default vlan 10
[SW3-GigabitEthernet0/0/2]int g0/0/3
[SW3-GigabitEthernet0/0/3]port link-type access 
[SW3-GigabitEthernet0/0/3]port default vlan 20
[SW3-GigabitEthernet0/0/3]q
[SW3]

R10:

[R10]int g0/0/1.1
[R10-GigabitEthernet0/0/1.1]dot1q termination vid 10
[R10-GigabitEthernet0/0/2.1]int g0/0/1.2
[R10-GigabitEthernet0/0/1.2]dot1q termination vid 20
[R10]int g0/0/1.1
[R10-GigabitEthernet0/0/1.1]arp broadcast 
[R10-GigabitEthernet0/0/1.1]arp broadcast enable 
[R10-GigabitEthernet0/0/1.1]int g0/0/1.2
[R10-GigabitEthernet0/0/1.2]arp broadcast enable 
[R10-GigabitEthernet0/0/1.2]q
[R10]

结果测试:
在这里插入图片描述

3、总部分部,骨干网配置OSPF

分部

R9:

[R9]ospf 200 router-id 9.9.9.9
[R9-ospf-200]area 0
[R9-ospf-200-area-0.0.0.0]network 192.168.200.2 0.0.0.0
[R9-ospf-200-area-0.0.0.0]q
[R9-ospf-200]q
[R9]

R10:

[R10]ospf 200 router-id 10.10.10.10
[R10-ospf-200]area 0
[R10-ospf-200-area-0.0.0.0]network 192.168.200.1 0.0.0.0
[R10-ospf-200-area-0.0.0.0]network 192.168.3.254 0.0.0.0
[R10-ospf-200-area-0.0.0.0]network 192.168.4.254 0.0.0.0
[R10-ospf-200-area-0.0.0.0]q
[R10-ospf-200]q
[R10]

测试:
在这里插入图片描述
查看OSPF路由表:
R9:

[R9]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPFDestinations : 2        Routes : 2        
OSPF routing table status : <Active>Destinations : 2        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface192.168.3.0/24  OSPF    10   2           D   192.168.200.1   GigabitEthernet
0/0/1192.168.4.0/24  OSPF    10   2           D   192.168.200.1   GigabitEthernet
0/0/1
OSPF routing table status : <Inactive>Destinations : 0        Routes : 0
[R9]

总部

R1:

[R1]OSPF 100 router-id 1.1.1.1
[R1-ospf-100]area 0
[R1-ospf-100-area-0.0.0.0]network 192.168.100.9 0.0.0.0
[R1-ospf-100-area-0.0.0.0]network 192.168.100.17 0.0.0.0
[R1-ospf-100-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-100-area-0.0.0.0]q
[R1-ospf-100]q
[R1]

R2:

[R2]ospf 100 router-id 2.2.2.2
[R2-ospf-100]area 0
[R2-ospf-100-area-0.0.0.0]network 192.168.100.13 0.0.0.0
[R2-ospf-100-area-0.0.0.0]network 192.168.100.6 0.0.0.0
[R2-ospf-100-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-100-area-0.0.0.0]q
[R2-ospf-100]q
[R2]

R3:

[R3]ospf 100 router-id 3.3.3.3
[R3-ospf-100]area 0
[R3-ospf-100-area-0.0.0.0]network 192.168.100.10 0.0.0.0
[R3-ospf-100-area-0.0.0.0]network 192.168.1.254 0.0.0.0
[R3-ospf-100-area-0.0.0.0]network 192.168.100.1 0.0.0.0
[R3-ospf-100-area-0.0.0.0]network 192.168.100.5 0.0.0.0
[R3-ospf-100-area-0.0.0.0]q
[R3-ospf-100]q
[R3]

R4:

[R4]ospf 100 router-id 4.4.4.4
[R4-ospf-100]area 0
[R4-ospf-100-area-0.0.0.0]network 192.168.100.14 0.0.0.0
[R4-ospf-100-area-0.0.0.0]network 192.168.2.254 0.0.0.0
[R4-ospf-100-area-0.0.0.0]network 192.168.100.2 0.0.0.0
[R4-ospf-100-area-0.0.0.0]network 192.168.100.18 0.0.0.0
[R4-ospf-100-area-0.0.0.0]q
[R4-ospf-100]q
[R4]

查看邻居关系:
R1:

[R1]display ospf peer brief OSPF Process 100 with Router ID 1.1.1.1Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          Full        0.0.0.0          GigabitEthernet0/0/2             4.4.4.4          Full        ----------------------------------------------------------------------------
[R1]

R2:

[R2]display ospf peer brief OSPF Process 100 with Router ID 2.2.2.2Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet3/0/0             3.3.3.3          Full        0.0.0.0          GigabitEthernet4/0/0             4.4.4.4          Full        ----------------------------------------------------------------------------
[R2]

R3:

[R3]display ospf peer brief OSPF Process 100 with Router ID 3.3.3.3Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full        0.0.0.0          GigabitEthernet0/0/1             2.2.2.2          Full        0.0.0.0          GigabitEthernet0/0/2             4.4.4.4          Full        ----------------------------------------------------------------------------
[R3]

R4:

[R4]display ospf peer brief OSPF Process 100 with Router ID 4.4.4.4Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        0.0.0.0          GigabitEthernet0/0/1             1.1.1.1          Full        0.0.0.0          GigabitEthernet0/0/2             3.3.3.3          Full        ----------------------------------------------------------------------------
[R4]

骨干网

R5:

[R5]ospf 10 router-id 5.5.5.5
[R5-ospf-10]area 0
[R5-ospf-10-area-0.0.0.0]network 10.10.10.21 0.0.0.0
[R5-ospf-10-area-0.0.0.0]network 10.10.10.17 0.0.0.0
[R5-ospf-10-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R5-ospf-10-area-0.0.0.0]q
[R5-ospf-10]q
[R5]

R6:

[R6]ospf 10 router-id 6.6.6.6
[R6-ospf-10]area 0
[R6-ospf-10-area-0.0.0.0]network 10.10.10.25 0.0.0.0
[R6-ospf-10-area-0.0.0.0]network 10.10.10.18 0.0.0.0
[R6-ospf-10-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[R6-ospf-10-area-0.0.0.0]q
[R6-ospf-10]q
[R6]

R7:

[R7]ospf 10 router-id 7.7.7.7
[R7-ospf-10]area 0
[R7-ospf-10-area-0.0.0.0]network 10.10.10.22 0.0.0.0
[R7-ospf-10-area-0.0.0.0]network 10.10.10.26 0.0.0.0
[R7-ospf-10-area-0.0.0.0]network 10.10.10.29 0.0.0.0
[R7-ospf-10-area-0.0.0.0]network 10.10.10.33 0.0.0.0
[R7-ospf-10-area-0.0.0.0]network 7.7.7.7 0.0.0.0
[R7-ospf-10-area-0.0.0.0]q
[R7-ospf-10]q
[R7]q

R8:

[R8]ospf 10 router-id 8.8.8.8
[R8-ospf-10]area 0	
[R8-ospf-10-area-0.0.0.0]network 10.10.10.30 0.0.0.0
[R8-ospf-10-area-0.0.0.0]network 10.10.10.34 0.0.0.0
[R8-ospf-10-area-0.0.0.0]network 8.8.8.8 0.0.0.0
[R8-ospf-10-area-0.0.0.0]q
[R8-ospf-10]q
[R8]

查看邻居表:
R5:

[R5]display ospf peer brief OSPF Process 10 with Router ID 5.5.5.5Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/2             7.7.7.7          Full        0.0.0.0          GigabitEthernet2/0/0             6.6.6.6          Full        ----------------------------------------------------------------------------
[R5]

R6:

[R6]display ospf peer brief OSPF Process 10 with Router ID 6.6.6.6Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet3/0/0             5.5.5.5          Full        0.0.0.0          GigabitEthernet0/0/2             7.7.7.7          Full        ----------------------------------------------------------------------------
[R6]

R7:

[R7]display ospf peer brief OSPF Process 10 with Router ID 7.7.7.7Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             5.5.5.5          Full        0.0.0.0          GigabitEthernet0/0/1             6.6.6.6          Full        0.0.0.0          GigabitEthernet0/0/2             8.8.8.8          Full        0.0.0.0          GigabitEthernet4/0/0             8.8.8.8          Full        ----------------------------------------------------------------------------
[R7]

R8:

[R8]display ospf peer brief OSPF Process 10 with Router ID 8.8.8.8Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             7.7.7.7          Full        0.0.0.0          GigabitEthernet0/0/1             7.7.7.7          Full        ----------------------------------------------------------------------------
[R8]

4、配置BGP建立邻居关系

总部

R1:

[R1]bgp 100
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as-number 100	
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]peer 10.10.10.2 as-number 200
[R1-bgp]peer 10.10.10.6 as-number 200
[R1-bgp]q
[R1]

R2:

[R2]bgp 100
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 1.1.1.1 as-number 100
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 10.10.10.10 as-number 200
[R2-bgp]peer 10.10.10.14 as-number 200
[R2-bgp]q
[R2]

查看你对等体关系建立:
R1:

[R1]display bgp peer BGP local router ID : 1.1.1.1Local AS number : 100Total number of peers : 3		  Peers in established state : 3Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv2.2.2.2         4         100       25       26     0 00:23:19 Established    010.10.10.2      4         200       16       17     0 00:14:08 Established    010.10.10.6      4         200       12       13     0 00:10:56 Established    0
[R1]

R2:

[R2]display bgp peer BGP local router ID : 2.2.2.2Local AS number : 100Total number of peers : 3		  Peers in established state : 3Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv1.1.1.1         4         100       25       25     0 00:23:53 Established    010.10.10.10     4         200       16       17     0 00:14:37 Established    010.10.10.14     4         200       11       12     0 00:09:23 Established    0
[R2]

骨干网

R5:

[R5]bgp 200
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 10.10.10.1 as-number 100
[R5-bgp]peer 10.10.10.9 as-number 100
[R5-bgp]peer 6.6.6.6 as-number 200
[R5-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R5-bgp]peer 7.7.7.7 as-number 200
[R5-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R5-bgp]peer 8.8.8.8 as-number 200
[R5-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R5-bgp]q
[R5]

R6:

[R6]bgp 200
[R6-bgp]router-id 6.6.6.6
[R6-bgp]peer 10.10.10.5 as-number 100
[R6-bgp]peer 10.10.10.13 as-number 100
[R6-bgp]peer 5.5.5.5 as-number 200
[R6-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R6-bgp]peer 7.7.7.7 as-number 200
[R6-bgp]peer 7.7.7.7 connect-interface LoopBack 
[R6-bgp]peer 8.8.8.8 as-number 200
[R6-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R6-bgp]q
[R6]

R7:

[R7]bgp 200
[R7-bgp]router-id 7.7.7.7
[R7-bgp]peer 5.5.5.5 as-number 200	
[R7-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R7-bgp]peer 6.6.6.6 as-number 200
[R7-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R7-bgp]peer 8.8.8.8 as-number 200	
[R7-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R7-bgp]q
[R7]

R8:

[R8]bgp 200
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 7.7.7.7 as-number 200
[R8-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R8-bgp]peer 6.6.6.6 as	
[R8-bgp]peer 6.6.6.6 as-number 200	
[R8-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R8-bgp]peer 5.5.5.5 as-number 200
[R8-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R8-bgp]peer 10.10.10.38 as-number 100
[R8-bgp]q
[R8]

查看对等体关系建立:
R5:

[R5]display bgp peer BGP local router ID : 5.5.5.5Local AS number : 200Total number of peers : 5		  Peers in established state : 5Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv6.6.6.6         4         200       11       13     0 00:09:06 Established    07.7.7.7         4         200        8       10     0 00:06:25 Established    08.8.8.8         4         200        5        7     0 00:03:38 Established    010.10.10.1      4         100       16       16     0 00:14:51 Established    010.10.10.9      4         100       16       16     0 00:14:46 Established    0
[R5]

R6:

[R6]display bgp peer BGP local router ID : 6.6.6.6Local AS number : 200Total number of peers : 5		  Peers in established state : 5Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv5.5.5.5         4         200       11       11     0 00:09:06 Established    07.7.7.7         4         200        8       10     0 00:06:04 Established    08.8.8.8         4         200        5        7     0 00:03:56 Established    010.10.10.5      4         100       13       13     0 00:11:40 Established    010.10.10.13     4         100       11       11     0 00:09:33 Established    0
[R6]

R7:

[R7]display bgp peer BGP local router ID : 7.7.7.7Local AS number : 200Total number of peers : 3		  Peers in established state : 3Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv5.5.5.5         4         200        8        8     0 00:06:27 Established    06.6.6.6         4         200        8        8     0 00:06:05 Established    08.8.8.8         4         200        6        7     0 00:04:15 Established    0
[R7]

R8:

[R8]display bgp peer BGP local router ID : 8.8.8.8Local AS number : 200Total number of peers : 4		  Peers in established state : 4Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv5.5.5.5         4         200        5        5     0 00:03:40 Established    06.6.6.6         4         200        5        5     0 00:03:57 Established    07.7.7.7         4         200        6        6     0 00:04:15 Established    010.10.10.38     4         100        3        5     0 00:01:26 Established    0
[R8]

分部

R9:

[R9]bgp 100
[R9-bgp]router-id 9.9.9.9
[R9-bgp]peer 10.10.10.37 as-number 200
[R9-bgp]q
[R9]

查看对等体关系建立:

[R9]display bgp peer BGP local router ID : 9.9.9.9Local AS number : 100Total number of peers : 1		  Peers in established state : 1Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv10.10.10.37     4         200        3        3     0 00:01:27 Established    0
[R9]

5、发布用户网段

R1:

[R1]bgp 100
[R1-bgp]network 192.168.1.0 24
[R1-bgp]network 192.168.2.0 24
[R1-bgp]q
[R1]

R2:

[R2]bgp 100
[R2-bgp]network 192.168.1.0 24
[R2-bgp]network 192.168.2.0 24
[R2-bgp]q
[R2]

R9:

[R9]bgp 100
[R9-bgp]network 192.168.3.0 24
[R9-bgp]network 192.168.4.0 24
[R9-bgp]q
[R9]

查看发布接收情况:
R1:

[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, ? - incompleteTotal Number of Routes: 4Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        0.0.0.0         2                     0      i* i                     2.2.2.2         2          100        0      i*>   192.168.2.0        0.0.0.0         2                     0      i* i                     2.2.2.2         2          100        0      i
[R1]

R2:

[R2]display bgp routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        0.0.0.0         2                     0      i* i                     1.1.1.1         2          100        0      i*>   192.168.2.0        0.0.0.0         2                     0      i* i                     1.1.1.1         2          100        0      i
[R2]

R9:

[R9]display bgp routing-table BGP Local router ID is 9.9.9.9 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.3.0        0.0.0.0         2                     0      i*>   192.168.4.0        0.0.0.0         2                     0      i
[R9]

R5:

[R5]display bgp routing-table BGP Local router ID is 5.5.5.5 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 8Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        10.10.10.1      2                     0      100i*                       10.10.10.9      2                     0      100ii                     10.10.10.5      2          100        0      100i*>   192.168.2.0        10.10.10.1      2                     0      100i*                       10.10.10.9      2                     0      100ii                     10.10.10.5      2          100        0      100ii  192.168.3.0        10.10.10.38     2          100        0      100ii  192.168.4.0        10.10.10.38     2          100        0      100i
[R5]

R6:

[R6]display bgp routing-table BGP Local router ID is 6.6.6.6 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 8Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        10.10.10.5      2                     0      100i*                       10.10.10.13     2                     0      100ii                     10.10.10.1      2          100        0      100i*>   192.168.2.0        10.10.10.5      2                     0      100i*                       10.10.10.13     2                     0      100ii                     10.10.10.1      2          100        0      100ii  192.168.3.0        10.10.10.38     2          100        0      100ii  192.168.4.0        10.10.10.38     2          100        0      100i
[R6]

R7:

[R7]display bgp routing-table BGP Local router ID is 7.7.7.7 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 6Network            NextHop        MED        LocPrf    PrefVal Path/Ogni  192.168.1.0        10.10.10.1      2          100        0      100ii                     10.10.10.5      2          100        0      100ii  192.168.2.0        10.10.10.1      2          100        0      100ii                     10.10.10.5      2          100        0      100ii  192.168.3.0        10.10.10.38     2          100        0      100ii  192.168.4.0        10.10.10.38     2          100        0      100i
[R7]

R8:

[R8]display bgp routing-table BGP Local router ID is 8.8.8.8 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 6Network            NextHop        MED        LocPrf    PrefVal Path/Ogni  192.168.1.0        10.10.10.1      2          100        0      100ii                     10.10.10.5      2          100        0      100ii  192.168.2.0        10.10.10.1      2          100        0      100ii                     10.10.10.5      2          100        0      100i*>   192.168.3.0        10.10.10.38     2                     0      100i*>   192.168.4.0        10.10.10.38     2                     0      100i
[R8]

6、将下一跳改为本地

R5:

[R5]bgp 200
[R5-bgp]peer 7.7.7.7 next-hop-local
[R5-bgp]peer 8.8.8.8 next-hop-local
[R5-bgp]q
[R5]

R6:

[R6]bgp 200
[R6-bgp]peer 7.7.7.7 next-hop-local
[R6-bgp]peer 8.8.8.8 next-hop-local
[R6-bgp]q
[R6]

R8:

[R8]bgp 200
[R8-bgp]peer 5.5.5.5 next-hop-local
[R8-bgp]peer 6.6.6.6 next-hop-local
[R8-bgp]peer 7.7.7.7 next-hop-local
[R8-bgp]q
[R8]

查看接收情况:
R5:

[R5]display bgp routing-table BGP Local router ID is 5.5.5.5 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 8Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        10.10.10.1      2                     0      100i*                       10.10.10.9      2                     0      100ii                     10.10.10.5      2          100        0      100i*>   192.168.2.0        10.10.10.1      2                     0      100i*                       10.10.10.9      2                     0      100ii                     10.10.10.5      2          100        0      100i*>i  192.168.3.0        8.8.8.8         2          100        0      100i*>i  192.168.4.0        8.8.8.8         2          100        0      100i
[R5]

R6:

[R6]display bgp routing-table BGP Local router ID is 6.6.6.6 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 8Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        10.10.10.5      2                     0      100i*                       10.10.10.13     2                     0      100ii                     10.10.10.1      2          100        0      100i*>   192.168.2.0        10.10.10.5      2                     0      100i*                       10.10.10.13     2                     0      100ii                     10.10.10.1      2          100        0      100i*>i  192.168.3.0        8.8.8.8         2          100        0      100i*>i  192.168.4.0        8.8.8.8         2          100        0      100i
[R6]

R7:

[R7]display bgp routing-tableBGP Local router ID is 7.7.7.7 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 6Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>i  192.168.1.0        5.5.5.5         2          100        0      100i* i                     6.6.6.6         2          100        0      100i*>i  192.168.2.0        5.5.5.5         2          100        0      100i* i                     6.6.6.6         2          100        0      100i*>i  192.168.3.0        8.8.8.8         2          100        0      100i*>i  192.168.4.0        8.8.8.8         2          100        0      100i
[R7]

R8:

[R8]display bgp routing-table BGP Local router ID is 8.8.8.8 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 6Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>i  192.168.1.0        5.5.5.5         2          100        0      100i* i                     6.6.6.6         2          100        0      100i*>i  192.168.2.0        5.5.5.5         2          100        0      100i* i                     6.6.6.6         2          100        0      100i*>   192.168.3.0        10.10.10.38     2                     0      100i*>   192.168.4.0        10.10.10.38     2                     0      100i
[R8]

7、允许AS重复

R1:

[R1]bgp 100
[R1-bgp]peer 10.10.10.2 allow-as-loop 
[R1-bgp]peer 10.10.10.6 allow-as-loop 
[R1-bgp]q
[R1]

R2:

[R2]bgp 100
[R2-bgp]peer 10.10.10.10 allow-as-loop
[R2-bgp]peer 10.10.10.14 allow-as-loop 
[R2-bgp]q
[R2]

R9:

[R9]bgp 100
[R9-bgp]peer 10.10.10.37 allow-as-loop 
[R9-bgp]q
[R9]

查看接收情况:
R1:

[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, ? - incompleteTotal Number of Routes: 14Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        0.0.0.0         2                     0      i* i                     2.2.2.2         2          100        0      i*                       10.10.10.2                            0      200 100i*                       10.10.10.6                            0      200 100i*>   192.168.2.0        0.0.0.0         2                     0      i* i                     2.2.2.2         2          100        0      i*                       10.10.10.2                            0      200 100i*                       10.10.10.6                            0      200 100i*>   192.168.3.0        10.10.10.2                            0      200 100i*                       10.10.10.6                            0      200 100ii                     10.10.10.10                100        0      200 100i*>   192.168.4.0        10.10.10.2                            0      200 100i*                       10.10.10.6                            0      200 100ii                     10.10.10.10                100        0      200 100i
[R1]

R2:

[R2]display bgp routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 14Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        0.0.0.0         2                     0      i* i                     1.1.1.1         2          100        0      i*                       10.10.10.10                           0      200 100i*                       10.10.10.14                           0      200 100i*>   192.168.2.0        0.0.0.0         2                     0      i* i                     1.1.1.1         2          100        0      i*                       10.10.10.10                           0      200 100i*                       10.10.10.14                           0      200 100i*>   192.168.3.0        10.10.10.10                           0      200 100i*                       10.10.10.14                           0      200 100ii                     10.10.10.2                 100        0      200 100i*>   192.168.4.0        10.10.10.10                           0      200 100i*                       10.10.10.14                           0      200 100ii                     10.10.10.2                 100        0      200 100i
[R2]

R9:

[R9]display bgp routing-table BGP Local router ID is 9.9.9.9 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   192.168.1.0        10.10.10.37                           0      200 100i*>   192.168.2.0        10.10.10.37                           0      200 100i*>   192.168.3.0        0.0.0.0         2                     0      i*>   192.168.4.0        0.0.0.0         2                     0      i
[R9]

8、重发布

R1:

[R1]ospf 100
[R1-ospf-100]import-route bgp 
[R1-ospf-100]q
[R1]

R2:

[R2]ospf 100	
[R2-ospf-100]import-route bgp 
[R2-ospf-100]q
[R2

R9:

[R9]ospf 200
[R9-ospf-200]import-route bgp 
[R9-ospf-200]q
[R9]

查看R3,R4以及R10的路由表:
R3:

[R3]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPFDestinations : 7        Routes : 9        
OSPF routing table status : <Active>Destinations : 7        Routes : 9
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface1.1.1.1/32  OSPF    10   1           D   192.168.100.9   GigabitEthernet
0/0/02.2.2.2/32  OSPF    10   1           D   192.168.100.6   GigabitEthernet
0/0/1192.168.2.0/24  OSPF    10   2           D   192.168.100.2   GigabitEthernet
0/0/2192.168.3.0/24  O_ASE   150  1           D   192.168.100.9   GigabitEthernet
0/0/0192.168.4.0/24  O_ASE   150  1           D   192.168.100.9   GigabitEthernet
0/0/0192.168.100.12/30  OSPF    10   2           D   192.168.100.2   GigabitEthernet
0/0/2OSPF    10   2           D   192.168.100.6   GigabitEthernet
0/0/1192.168.100.16/30  OSPF    10   2           D   192.168.100.9   GigabitEthernet
0/0/0OSPF    10   2           D   192.168.100.2   GigabitEthernet
0/0/2OSPF routing table status : <Inactive>Destinations : 0        Routes : 0[R3]

R4:

[R4]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPFDestinations : 7        Routes : 9        
OSPF routing table status : <Active>Destinations : 7        Routes : 9
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface1.1.1.1/32  OSPF    10   1           D   192.168.100.17  GigabitEthernet
0/0/12.2.2.2/32  OSPF    10   1           D   192.168.100.13  GigabitEthernet
0/0/0192.168.1.0/24  OSPF    10   2           D   192.168.100.1   GigabitEthernet
0/0/2192.168.3.0/24  O_ASE   150  1           D   192.168.100.17  GigabitEthernet
0/0/1192.168.4.0/24  O_ASE   150  1           D   192.168.100.17  GigabitEthernet
0/0/1192.168.100.4/30  OSPF    10   2           D   192.168.100.1   GigabitEthernet
0/0/2OSPF    10   2           D   192.168.100.13  GigabitEthernet
0/0/0192.168.100.8/30  OSPF    10   2           D   192.168.100.1   GigabitEthernet
0/0/2OSPF    10   2           D   192.168.100.17  GigabitEthernet
0/0/1OSPF routing table status : <Inactive>Destinations : 0        Routes : 0[R4]

R10:

[R10]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPFDestinations : 2        Routes : 2        OSPF routing table status : <Active>Destinations : 2        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface192.168.1.0/24  O_ASE   150  1           D   192.168.200.2   GigabitEthernet
0/0/0192.168.2.0/24  O_ASE   150  1           D   192.168.200.2   GigabitEthernet
0/0/0OSPF routing table status : <Inactive>Destinations : 0        Routes : 0
[R10]

测试:
在这里插入图片描述

9、修改BGP优先级

R1:

[R1]bgp 100
[R1-bgp]ipv4-family unicas
[R1-bgp-af-ipv4]preference 140 255 255
[R1-bgp-af-ipv4]q
[R1-bgp]q
[R1]

R2:

[R2]bgp 100
[R2-bgp]ipv4-family unicast 
[R2-bgp-af-ipv4]preference 140 255 255
[R2-bgp-af-ipv4]q
[R2-bgp]q
[R2]

查看路由表:
R1:

[R1]display ip routing-table protocol bgp 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : BGPDestinations : 2        Routes : 2        
BGP routing table status : <Active>Destinations : 2        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface192.168.3.0/24  EBGP    140  0           D   10.10.10.2      GigabitEthernet
2/0/0192.168.4.0/24  EBGP    140  0           D   10.10.10.2      GigabitEthernet
2/0/0
BGP routing table status : <Inactive>Destinations : 0        Routes : 0[R1]

R2:

[R2]display ip routing-table protocol bgp 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : BGPDestinations : 2        Routes : 2        
BGP routing table status : <Active>Destinations : 2        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface192.168.3.0/24  EBGP    140  0           D   10.10.10.10     GigabitEthernet
0/0/1192.168.4.0/24  EBGP    140  0           D   10.10.10.10     GigabitEthernet
0/0/1
BGP routing table status : <Inactive>Destinations : 0        Routes : 0[R2]

10、优化

(1)修改cost值

R1:

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf cost 10

R2:

[R2]int g3/0/0
[R2-GigabitEthernet3/0/0]ospf cost 10

R3:

[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ospf cost 10

R4:

[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ospf cost 10

(2)修改MED值

R1:

[R1]ip ip-prefix 1 permit 192.168.2.0 24
[R1]route-policy 1 permit node 10
[R1-route-policy]if-match ip-prefix 1
[R1-route-policy]apply cost 10
[R1-route-policy]q
[R1]route-policy 1 permit node 20
[R1-route-policy]q
[R1]bgp 100
[R1-bgp]peer 10.10.10.2 route-policy 1 export 
[R1-bgp]peer 10.10.10.6 route-policy 1 export

R2:

[R2]ip ip-prefix 1 permit 192.168.1.0 24
[R2]route-policy 1 permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix 1
[R2-route-policy]apply cost 10
[R2-route-policy]q
[R2]route-policy 1 permit node 20
Info: New Sequence of this List.
[R2-route-policy]q
[R2]bgp 100
[R2-bgp]peer 10.10.10.10 route-policy 1 export 
[R2-bgp]peer 10.10.10.14 route-policy 1 export

R6:

[R6]route-policy 1 permit node 10
Info: New Sequence of this List.
[R6-route-policy]apply cost 10
[R6-route-policy]q
[R6]route-policy policy permit node 20
Info: New Sequence of this List.
[R6-route-policy]q
[R6]bgp 200
[R6-bgp]peer 10.10.10.5 route-policy 1 export 
[R6-bgp]peer 10.10.10.13 route-policy 1 export

(3)修改为type1

R1:

[R1]ospf 100
[R1-ospf-100]import-route bgp type 1
[R1-ospf-100]q
[R1]

R2:

[R2]ospf 100
[R2-ospf-100]import-route bgp type 1
[R2-ospf-100]q
[R2]

R9:

[R9]ospf 200	
[R9-ospf-200]import-route bgp type 1
[R9-ospf-200]q
[R9]

在这里插入图片描述
在这里插入图片描述

相关文章:

HCIP——前期综合实验

前期综合实验 一、实验拓扑二、实验要求三、实验思路四、实验步骤1、配置接口IP地址2、交换机配置划分vlan10以及vlan203、总部分部&#xff0c;骨干网配置OSPF分部总部骨干网 4、配置BGP建立邻居关系总部骨干网分部 5、发布用户网段6、将下一跳改为本地7、允许AS重复8、重发布…...

【2023年电赛】运动目标控制与自动追踪系统(E 题)最简单实现

本方案的思路是最简单的不涉及复杂算法&#xff1a;识别矩形框&#xff0c;标记矩形框&#xff0c;输出坐标和中心点&#xff0c;计算长度&#xff0c;控制舵机移动固定长度&#xff01;仅供完成基础功能参考&#xff0c;不喜勿喷&#xff01; # 实现运动目标控制与自动追踪系…...

【IMX6ULL驱动开发学习】22.IMX6ULL开发板读取ADC(以MQ-135为例)

IMX6ULL一共有两个ADC&#xff0c;每个ADC都有八个通道&#xff0c;但他们共用一个ADC控制器 1.设备树 在imx6ull.dtsi文件中已经帮我们定义好了adc1的节点部分信息 adc1: adc02198000 {compatible "fsl,imx6ul-adc", "fsl,vf610-adc";reg <0x0219…...

宝塔安装ModStart,快速开启高效开发之旅!

宝塔面板是一款强大的服务器管理工具&#xff0c;而ModStart则是基于Laravel的模块化快速开发框架&#xff0c;二者的结合将为您的项目开发带来前所未有的便利和高效。在这篇文章中&#xff0c;我们将为您详细介绍如何在宝塔面板上安装ModStart&#xff0c;让您快速搭建功能丰富…...

第六章 HL7 架构和可用工具 - 定义新的消息类型和结构类型

文章目录 第六章 HL7 架构和可用工具 - 定义新的消息类型和结构类型编辑数据结构和代码表 第六章 HL7 架构和可用工具 - 定义新的消息类型和结构类型 消息类型标识消息并与 HL7 MSH:9 字段中的值匹配。定义消息类型时&#xff0c;指定发送消息结构类型&#xff08;可能与消息类…...

通向架构师的道路之Tomcat性能调优

一、总结前一天的学习 从“第三天”的性能测试一节中&#xff0c;我们得知了决定性能测试的几个重要指标&#xff0c;它们是&#xff1a; 吞吐量 Responsetime Cpuload MemoryUsage 我 们也在第三天的学习中对Apache做过了一定的优化&#xff0c;使其最优化上…...

vue03 es6中对数组的操作,vue对数据监控的原理(分别对对象和数组的监控)

在js中&#xff0c;对数组的操作一般都是固定的模式&#xff1a;常用的函数&#xff0c;具体的方法在这个文章中去看&#xff1a; http://t.csdn.cn/Fn1Ik 一般会用到的函数有&#xff1a; pop&#xff08;&#xff09; 这个函数是表示把数组中的元素&#xff08;数组&#xff…...

微信小程序 - 解析富文本插件版们

一、html2wxml 插件版 https://gitee.com/qwqoffice/html2wxml 申请使用注意事项 插件版本解析服务是由 QwqOffice 完成&#xff0c;存在不稳定因素&#xff0c;如对稳定性有很高的要求&#xff0c;请自行搭建解析服务&#xff0c;或在自家服务器上直接完成解析。对于有关插…...

工厂方法模式(Factory Method)

工厂方法模式就是定义一个用于创建对象的接口&#xff0c;让子类决定实例化哪一个类。工厂方法模式将类的实例化&#xff08;具体产品的创建&#xff09;延迟到工厂类的子类&#xff08;具体工厂&#xff09;中完成&#xff0c;即由子工厂类来决定该实例化哪一个类。 Define a…...

js如何将图片转成BASE64编码,网页跟uniapp开发的app的区别?

Base64是一种用64个字符来表示任意二进制数据的方法&#xff0c;这篇文章主要为大家介绍了如何实现将图片转为base64格式&#xff0c;感兴趣的小伙伴可以学习一下 前言 前段时间在写我的VUE全栈项目的时候&#xff0c;遇到要把前端的照片上传到后端&#xff0c;再由后端存到数…...

1400*C. Computer Game

Example input 6 15 5 3 2 15 5 4 3 15 5 2 1 15 5 5 1 16 7 5 2 20 5 7 3 output 4 -1 5 2 0 1 解析&#xff1a; k个电&#xff0c; 第一种为 k>a 时&#xff0c;只玩游戏 k-a; 第二种&#xff0c;k>b,一边玩一边充电 k-b 问完成n轮游戏的情况下&#xff0c;优先第…...

windows10访问Ubuntu 18.04共享目录(已验证)

1、Ubuntu 18.04安装samba sudo apt-get install samba 2、创建一个共享目录文件夹&#xff0c;并设置777权限 ubt1804是用户名 mkdir/home/ubt1804/lsk sudo chmod 777 /home/ubt1804/lsk 3、添加用户及密码 sudo smbpasswd -a [用户名] 比如用户名为test sudo sm…...

Linux安装redis执行make命令报错:gcc not found和*** [adlist.o] Error 1

目录 第一章、问题分析与解决1.1&#xff09;报错11.2&#xff09;报错2 友情提醒 先看文章目录&#xff0c;大致了解文章知识点结构&#xff0c;点击文章目录可直接跳转到文章指定位置。 第一章、问题分析与解决 1.1&#xff09;报错1 报错问题1&#xff1a;gcc: Command n…...

R语言glmnet包详解:横截面数据建模

R语言glmnet包详解:横截面数据建模 glmnet适用的模型glmnet建模补充glmnet适用的模型 glmnet程序包即适用于线性模型,也适用于添加惩罚项项的线性模型。如果数据中的变量个数大于样本量并且想用线性模型解决问题,那么glmnet再合适不过了! 根据glmnet函数中参数family的指定…...

LeetCode257. 二叉树的所有路径

257. 二叉树的所有路径 文章目录 257. 二叉树的所有路径一、题目二、题解方法一&#xff1a;深度优先搜索递归方法二&#xff1a;迭代 一、题目 给你一个二叉树的根节点 root &#xff0c;按 任意顺序 &#xff0c;返回所有从根节点到叶子节点的路径。 叶子节点 是指没有子节点…...

ajax、axios、fetch的区别

ajax、axios、fetch 的区别 参考答案&#xff1a; ajax 是指一种创建交互式网页应用的网页开发技术&#xff0c;并且可以做到无需重新加载整个网页的情况下&#xff0c;能够更新部分网页&#xff0c;也叫作局部更新。 使用 ajax 发送请求是依靠于一个对象&#xff0c;叫 XmlHtt…...

Liunx开发工具

Liunx开发工具 1.Linux编辑器-vim使用1.1vim的基本概念1.2vim的基本操作1.3命令模式命令集1.3.1光标定位1.3.2光标移动1.3.3文本复制1.3.4文本操作 1.4插入模式命令集1.5底行模式命令集 2.vim配置3.sudo配置4.Linux编辑器-gcc/g使用4.1背景知识4.2gcc如何操作 5.函数库5.1函数库…...

Docker入门之运行Nginx案例

运行镜像 如果你直接安装会比较慢, 建议参照附录内容配置镜像之后再执行 # 执行命令过程一&#xff1a;下载容器镜像 docker run -d nginx:latest 命令解释 docker run 启动一个容器 -d 把容器镜像中需要执行的命令以daemon&#xff08;守护进程&#xff09;的方式运行 nginx…...

【深度学习环境】安装anaconda、tensorflow、pycharm

目录 1.安装anaconda 2.安装tensorflow-gpu 3.安装pycharm 4.VNC操作 5.安装Pytorch PS: linux下常见的操作&#xff1a; 1.Linux下强制关闭程序&#xff1a; 2.导出环境 2.1.pip导出 2.2.conda导出 2.3.其他 3.windows下的环境安装 & pycharm远程配置 4.bash…...

mockery 模拟

composer地址&#xff1a;mockery/mockery - Packagist github地址&#xff1a;地址 文档地址&#xff1a;Mockery — Mockery Docs 1.0-alpha documentation 根据文档介绍&#xff0c;mockery是php mock对象框架。根据js的mock框架的作用&#xff0c;估计mockery也是通过创…...

汽车后视镜反射率检测系统

随着社会的快速发展和物质生活的提供&#xff0c;机动车越来越普及&#xff0c;道路行车安全日益重要。为了保障机动车辆和行人的安全&#xff0c;在行车时不断观察后方和两侧的图像尤为重要。机动车后视镜通过反射镜面可以提供在规定视野内后方和两侧的图像&#xff0c;从而提…...

uni-app引用外部图标库(阿里矢量图)

uni-app引用外部图标库&#xff08;阿里矢量图&#xff09; 作为前端程序员&#xff0c;nui-app是必备的&#xff0c;但是有时候内置的图标&#xff0c;组件又不完全满足&#xff0c;这里就可以引进外部图标&#xff0c;这里引用的是阿里矢量图标 第一步&#xff0c;在项目目…...

day49-Todo List(待办事项列表)

50 天学习 50 个项目 - HTMLCSS and JavaScript day49-Todo List&#xff08;待办事项列表&#xff09; 效果 index.html <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8" /><meta name"viewport" co…...

寻找丢失数字:数学与位运算的解密之旅

本篇博客会讲解力扣“268. 丢失的数字”的解题思路&#xff0c;这是题目链接。 注意进阶中的描述&#xff1a;你能否实现线性时间复杂度、仅使用额外常数空间的算法解决此问题&#xff1f;这里我会讲解两种思路&#xff0c;它们的时间复杂度是O(N)&#xff0c;空间复杂度是O(1)…...

数论分块学习笔记

准备开始复习莫比乌斯反演&#xff0c;杜教筛这一部分&#xff0c;先复习一下数论分块 0.随便说说 数论分块可以计算如下形式的式子 ∑ i 1 n f ( i ) g ( ⌊ n i ⌋ ) \sum_{i1}^{n}f(i)g(\lfloor\frac{n}{i}\rfloor) ∑i1n​f(i)g(⌊in​⌋)。 利用的原理是 ⌊ n i ⌋ \lf…...

【基础理论】了解点过程

Maximum tsunami wave height generated by the 16 Sept. 2015 Chile earthquake, from the International Tsunami Information Center. Posted by Austin Elliott 一、说明 在这个世界上&#xff0c;会发生许多事件&#xff0c;其趋势可能遵循一种模式。在这篇博客中&#…...

深入理解Spring MVC中的@ResponseBody注解

引言 在现代的Web应用开发中&#xff0c;数据的传递和交互是不可或缺的一部分。Spring MVC作为一个强大的框架&#xff0c;在处理客户端请求和响应时&#xff0c;提供了许多注解来简化开发过程。其中&#xff0c;ResponseBody注解在处理方法的返回值时起到了关键作用&#xff0…...

大数据学习教程:Linux高级教程(下)

四、大数据集群服务器搭建 1. 新增Linux服务器 1.1、克隆虚拟机 学习环境中&#xff0c;一般使用VMware虚拟机克隆Linux系统&#xff0c;用来进行集群服务器的搭建。 VMware支持两种类型的克隆&#xff1a;完整克隆、链接克隆 完整克隆是和原始虚拟机完全独立的一个复制&…...

1.Oracle建表及使用

1.概述 1. 表&#xff1a;用于 存储数据 -- 是我们最常见的数据库对象 2. 表设计注意事项 (1) 表设计时&#xff0c;尽量遵从 第三范式&#xff08;3NF&#xff09; (2) 名称不能超过 30 个字符 -- 超过会报错 (3) 名称只能以 字母 大头&#xff0c;可由数字、 _、 $…...

《网络是怎样连接的》(二.2)

(6条消息) 《网络是怎样连接的》&#xff08;二.1&#xff09;_qq_38480311的博客-CSDN博客 本文主要取材于 《网络是怎样连接的》 第二章 2.5 2.6章节。 目录 简述&#xff1a; 本文的主要内容是 以太网的收发操作 和 UDP协议的收发操作。 IP与以太网的包收发操作 包是什…...