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 : OSPF
         Destinations : 2        Routes : 2        
OSPF routing table status : <Active>
         Destinations : 2        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    192.168.3.0/24  OSPF    10   2           D   192.168.200.1   GigabitEthernet
0/0/1
    192.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.1
		  Peer 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.2
		  Peer 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.3
		  Peer 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.4
		  Peer 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.5
		  Peer 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.6
		  Peer 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.7
		  Peer 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.8
		  Peer 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.1
 Local AS number : 100
 Total number of peers : 3		  Peers in established state : 3
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  2.2.2.2         4         100       25       26     0 00:23:19 Established    
   0
  10.10.10.2      4         200       16       17     0 00:14:08 Established    
   0
  10.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.2
 Local AS number : 100
 Total number of peers : 3		  Peers in established state : 3
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
  1.1.1.1         4         100       25       25     0 00:23:53 Established    
   0
  10.10.10.10     4         200       16       17     0 00:14:37 Established    
   0
  10.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.5
 Local AS number : 200
 Total number of peers : 5		  Peers in established state : 5
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  6.6.6.6         4         200       11       13     0 00:09:06 Established    
   0
  7.7.7.7         4         200        8       10     0 00:06:25 Established    
   0
  8.8.8.8         4         200        5        7     0 00:03:38 Established    
   0
  10.10.10.1      4         100       16       16     0 00:14:51 Established    
   0
  10.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.6
 Local AS number : 200
 Total number of peers : 5		  Peers in established state : 5
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
  5.5.5.5         4         200       11       11     0 00:09:06 Established    
   0
  7.7.7.7         4         200        8       10     0 00:06:04 Established    
   0
  8.8.8.8         4         200        5        7     0 00:03:56 Established    
   0
  10.10.10.5      4         100       13       13     0 00:11:40 Established    
   0
  10.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.7
 Local AS number : 200
 Total number of peers : 3		  Peers in established state : 3
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
  5.5.5.5         4         200        8        8     0 00:06:27 Established    
   0
  6.6.6.6         4         200        8        8     0 00:06:05 Established    
   0
  8.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.8
 Local AS number : 200
 Total number of peers : 4		  Peers in established state : 4
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
  5.5.5.5         4         200        5        5     0 00:03:40 Established    
   0
  6.6.6.6         4         200        5        5     0 00:03:57 Established    
   0
  7.7.7.7         4         200        6        6     0 00:04:15 Established    
   0
  10.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.9
 Local AS number : 100
 Total number of peers : 1		  Peers in established state : 1
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
  10.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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 4
      Network            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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 4
      Network            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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 2
      Network            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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 8
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   192.168.1.0        10.10.10.1      2                     0      100i
 *                       10.10.10.9      2                     0      100i
   i                     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      100i
   i                     10.10.10.5      2          100        0      100i
   i  192.168.3.0        10.10.10.38     2          100        0      100i
   i  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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 8
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   192.168.1.0        10.10.10.5      2                     0      100i
 *                       10.10.10.13     2                     0      100i
   i                     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      100i
   i                     10.10.10.1      2          100        0      100i
   i  192.168.3.0        10.10.10.38     2          100        0      100i
   i  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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 6
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
   i  192.168.1.0        10.10.10.1      2          100        0      100i
   i                     10.10.10.5      2          100        0      100i
   i  192.168.2.0        10.10.10.1      2          100        0      100i
   i                     10.10.10.5      2          100        0      100i
   i  192.168.3.0        10.10.10.38     2          100        0      100i
   i  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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 6
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
   i  192.168.1.0        10.10.10.1      2          100        0      100i
   i                     10.10.10.5      2          100        0      100i
   i  192.168.2.0        10.10.10.1      2          100        0      100i
   i                     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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 8
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   192.168.1.0        10.10.10.1      2                     0      100i
 *                       10.10.10.9      2                     0      100i
   i                     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      100i
   i                     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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 8
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   192.168.1.0        10.10.10.5      2                     0      100i
 *                       10.10.10.13     2                     0      100i
   i                     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      100i
   i                     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-table
 BGP Local router ID is 7.7.7.7 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 6
      Network            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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 6
      Network            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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 14
      Network            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 100i
   i                     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 100i
   i                     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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 14
      Network            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 100i
   i                     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 100i
   i                     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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 4
      Network            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 : OSPF
         Destinations : 7        Routes : 9        
OSPF routing table status : <Active>
         Destinations : 7        Routes : 9
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        1.1.1.1/32  OSPF    10   1           D   192.168.100.9   GigabitEthernet
0/0/0
        2.2.2.2/32  OSPF    10   1           D   192.168.100.6   GigabitEthernet
0/0/1
    192.168.2.0/24  OSPF    10   2           D   192.168.100.2   GigabitEthernet
0/0/2
    192.168.3.0/24  O_ASE   150  1           D   192.168.100.9   GigabitEthernet
0/0/0
    192.168.4.0/24  O_ASE   150  1           D   192.168.100.9   GigabitEthernet
0/0/0
 192.168.100.12/30  OSPF    10   2           D   192.168.100.2   GigabitEthernet
0/0/2
                    OSPF    10   2           D   192.168.100.6   GigabitEthernet
0/0/1
 192.168.100.16/30  OSPF    10   2           D   192.168.100.9   GigabitEthernet
0/0/0
                    OSPF    10   2           D   192.168.100.2   GigabitEthernet
0/0/2

OSPF 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 : OSPF
         Destinations : 7        Routes : 9        
OSPF routing table status : <Active>
         Destinations : 7        Routes : 9
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        1.1.1.1/32  OSPF    10   1           D   192.168.100.17  GigabitEthernet
0/0/1
        2.2.2.2/32  OSPF    10   1           D   192.168.100.13  GigabitEthernet
0/0/0
    192.168.1.0/24  OSPF    10   2           D   192.168.100.1   GigabitEthernet
0/0/2
    192.168.3.0/24  O_ASE   150  1           D   192.168.100.17  GigabitEthernet
0/0/1
    192.168.4.0/24  O_ASE   150  1           D   192.168.100.17  GigabitEthernet
0/0/1
  192.168.100.4/30  OSPF    10   2           D   192.168.100.1   GigabitEthernet
0/0/2
                    OSPF    10   2           D   192.168.100.13  GigabitEthernet
0/0/0
  192.168.100.8/30  OSPF    10   2           D   192.168.100.1   GigabitEthernet
0/0/2
                    OSPF    10   2           D   192.168.100.17  GigabitEthernet
0/0/1

OSPF 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 : OSPF
         Destinations : 2        Routes : 2        

OSPF routing table status : <Active>
         Destinations : 2        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    192.168.1.0/24  O_ASE   150  1           D   192.168.200.2   GigabitEthernet
0/0/0
    192.168.2.0/24  O_ASE   150  1           D   192.168.200.2   GigabitEthernet
0/0/0

OSPF 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 : BGP
         Destinations : 2        Routes : 2        
BGP routing table status : <Active>
         Destinations : 2        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    192.168.3.0/24  EBGP    140  0           D   10.10.10.2      GigabitEthernet
2/0/0
    192.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 : BGP
         Destinations : 2        Routes : 2        
BGP routing table status : <Active>
         Destinations : 2        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    192.168.3.0/24  EBGP    140  0           D   10.10.10.10     GigabitEthernet
0/0/1
    192.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]

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/55881.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Java中集合容器详解:简单使用与案例分析

目录 一、概览 1.1 Collection 1. Set 2. List 3. Queue 1.2 Map 二、容器中的设计模式 迭代器模式 适配器模式 三、源码分析 ArrayList 1. 概览 2. 扩容 3. 删除元素 4. 序列化 5. Fail-Fast Vector 1. 同步 2. 扩容 3. 与 ArrayList 的比较 4. 替代方案…

C#——多线程之Thread

C#——多线程之Thread 前言一、Thread是什么&#xff1f;二、各应用场景以及实例分析1.前台线程和后台线程&#xff1a;2.异步处理3.线程状态及手动销毁线程4.线程同步/等待线程完成 总结 前言 上次简单讲述了关于多线程中Task的相关应用以及场景。今天我们来看一下多线程中Th…

【LeetCode】27. 移除元素

题目大概意思是剔除nums数组中出现的所有val值。可以用快慢双指针法来做。 快的指针在前面遍历找值不为val的元素的下标&#xff0c;慢的负责接收值不为val的元素&#xff0c;并及时更新数组。 class Solution {public int removeElement(int[] nums, int val) {//快慢指针法in…

单网卡实现 双IP 双网段(内外网)同时运行

前提是内外网是同一网线连接&#xff08;双网线双网卡的具体可以自己搜索下。理论上都设置静态IP后把外网跃点设置小&#xff0c;内网跃点设置大&#xff0c;关闭自动跃点设置同一个接口跃点数&#xff0c;在通过命令提示符添加内网网址走内网网关就可以了&#xff09;。 需要使…

华为OD机试真题 JavaScript 实现【机器人活动区域】【2023Q1 200分】,附详细解题思路

目录 一、题目描述二、输入描述三、输出描述四、解题思路五、JavaScript算法源码六、效果展示1、输入2、输出 华为OD机试 2023B卷题库疯狂收录中&#xff0c;刷题点这里 刷的越多&#xff0c;抽中的概率越大&#xff0c;每一题都有详细的答题思路、详细的代码注释、样例测试&am…

iOS--Runloop

Runloop概述 一般来说&#xff0c;一个线程一次只能执行一个任务&#xff0c;执行完成后线程就会退出。就比如之前学OC时使用的命令行程序&#xff0c;执行完程序就结束了。 而runloop目的就是使线程在执行完一次代码之后不会结束程序&#xff0c;而是使该线程处于一种休眠的状…

【iOS】GCD深入学习

关于GCD和队列的简单介绍请看&#xff1a;【iOS】GCD学习 本篇主要介绍GCD中的方法。 栅栏方法:dispatch_barrier_async 我们有时候需要异步执行两组操作&#xff0c;而且第一组操作执行完之后&#xff0c;才能开始执行第二组操作&#xff0c;当然操作组里也可以包含一个或者…

windows下安装anaconda、pycharm、cuda、cudnn、PyTorch-GPU版本

目录 一、anaconda安装及虚拟环境创建 1.anaconda的下载 2.Anaconda的安装 3.创建虚拟环境 3.1 环境启动 3.2 切换镜像源 3.3环境创建 3.4 激活环境 3.5删除环境 二、pycharm安装 1.pycharm下载 2.pycharm的安装 三、CUDA的安装 1.GPU版本和CUDA版本、cudnn版本、显卡…

Redis 客户端有哪些?

文章目录 JedisLettuceRedisson最佳实践 - 到底用哪个&#xff1f; Redis 最常见的 Java 客户端有两个&#xff0c;Jedis 和 Lettuce&#xff0c;高级客户端有 Redisson&#xff0c;见下图&#xff08;图源 Clients | Redis&#xff09; Jedis Github地址&#xff1a;redis/j…

JavaScript创建,写入,复制,读取文件 只限IE ActiveX控件

最近接到需求&#xff0c;需要纯前端&#xff0c; 操作写入改变文件&#xff0c;一时间头大不已&#xff0c;还好此需求只需要屏幕展示&#xff0c;无需顾及兼容问题&#xff0c;找来找去找到了new ActiveXObject(“Scripting.FileSystemObject”) 强大控件 以下为自己记录的 …

贝锐蒲公英:没有公网IP,多分支企业如何高效远程访问OA系统?

贝锐蒲公英&#xff1a;没有公网IP&#xff0c;多分支企业、移动办公人员如何高效远程访问OA系统&#xff1f; 国内某大型美妆公司&#xff0c;旗下产品覆盖美容护肤品、彩妆、美容仪器、健康食品、SPA美容会所及等多类服务&#xff0c;致力于为客户提供高品质的产品和完善的服…

Vivado进行自定义IP封装

一. 简介 本篇文章将介绍如何使用Vivado来对上篇文章(FPGA驱动SPI屏幕)中的代码进行一个IP封装&#xff0c;Vivado自带的IP核应该都使用过&#xff0c;非常方便。 这里将其封装成IP核的目的主要是为了后续项目的调用&#xff0c;否则当我新建一个项目的时候&#xff0c;我需要将…

Mycat-Balance使用指南

MyCAT Balance是一个Java NIO的高性能负载均衡器&#xff0c;可以替代普通的硬件的交换机或其LVS类似的复杂机制&#xff0c;实现MyCAT集群的负载均衡。 MyCAT Balance的配置文件在conf目录下&#xff0c;frontend-conf.为前端配置&#xff0c;包括绑定的端口等&#xff0c;js…

ODOO16运输费用摊入采购成本,总账和收发表一致?

产品的采购成本准确的计算是怎样的呢&#xff1f;在《会计准则》中有规定&#xff1a; “第三章 计量 ... 第六条 存货的采购成本&#xff0c;包括购买价款、相关税费、运输费、装卸费、保险费以及其他可归属于存货采购成本的费用。” 可见存货的采购成本包含的信息是很多&am…

图解TCP 三次握手和四次挥手的高频面试题(2023最新版)

大家好&#xff0c;最近重新整理了一版 TCP 三次握手和四次挥手的面试题&#xff08;2023最新版&#xff09;。 ----- 任 TCP 虐我千百遍&#xff0c;我仍待 TCP 如初恋。 巨巨巨巨长的提纲&#xff0c;发车&#xff01;发车&#xff01; img TCP 基本认识 TCP 头格式有哪些…

SpringBoot笔记:SpringBoot集成Dataway

文章目录 1、什么是 Dataway?2、主打场景3、技术架构4、整合SpringBoot4.1、maven 依赖4.2、初始化脚本4.3、整合 SpringBoot 5、Dataway 接口管理6、Mybatis 语法支持7、小结 1、什么是 Dataway? 官网地址&#xff1a;https://www.hasor.net/docs/guides/quickstart Da…

TSINGSEE青犀视频汇聚平台EasyCVR多种视频流播放协议介绍

众所周知&#xff0c;TSINGSEE青犀视频汇聚平台EasyCVR可支持多协议方式接入&#xff0c;包括主流标准协议GB28181、RTSP/Onvif、RTMP等&#xff0c;以及厂家私有协议与SDK接入&#xff0c;包括海康Ehome、海大宇等设备的SDK等。今天我们来说一说&#xff0c;EasyCVR平台支持分…

Spark2x原理剖析(一)

一、简介 Spark是基于内存的分布式计算框架。在迭代计算的场景下&#xff0c;数据处理过程中的数据可以存储在内存中&#xff0c;提供了比MapReduce高10到100倍的计算能力。Spark可以使用HDFS作为底层存储&#xff0c;使用户能够快速地从MapReduce切换到Spark计算平台上去。Sp…

契约测试之 - 用Pact-JS编写Message和GraphQL的契约测试

上一篇博客介绍了如何用Pact-JS编写HTTP协议的接口的契约测试&#xff0c;实际&#xff0c;Pact-JS除了能对通过HTTP协议接口交互的服务编写契约测试外&#xff0c;还可以对通过发送Message进行交互的Provider和Consumer编写契约测试&#xff0c;还可以对通过GraphQL进行查询的…

RabbitMQ(二)

二、高级特性、应用问题以及集群搭建 高级特性 1.消息的可靠性投递 在使用RabbitMQ的时候&#xff0c;作为消息发送方希望杜绝任何消息丢失或者投递失败场景。RabbitMQ 为我们提供了两种方式用来控制消息的投递可靠性模式。 rabbitMQ整个消息投递的路径为&#xff1a; produ…