BGP综合实验

实验拓扑

实验思路

  1. 按照IP地址规划配置IP地址
  2. 使用ospf协议让建邻条件满足
  3. 使用环回口起bgp建邻
  4. 宣告业务网段
  5. 优化
  6. 测试并排错

实验过程

1.IP地址配置图


<R1>dis ip int b
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.1/24          up         up        
LoopBack0                         1.1.1.1/32           up         up(s)     
LoopBack1                         192.168.1.1/24       up         up(s)     
 
 
​	
[R2]dis ip int brief 
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.2/24          up         up        
GigabitEthernet0/0/1              172.16.1.1/30        up         up        
GigabitEthernet0/0/2              172.16.1.21/30       up         up        
LoopBack0                         2.2.2.2/32           up         up(s)     
  
<R3>dis ip int brief 
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.2/30        up         up        
GigabitEthernet0/0/1              172.16.1.5/30        up         up           
LoopBack0                         3.3.3.3/32           up         up(s)     
LoopBack1                         172.16.3.1/24        up         up(s)     
 
 
[R4]dis ip int b
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.6/30        up         up        
GigabitEthernet0/0/1              172.16.1.9/30        up         up           
LoopBack0                         4.4.4.4/32           up         up(s)     
LoopBack1                         172.16.4.1/24        up         up(s)     
 
 
[R5]dis ip int b
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.22/30       up         up        
GigabitEthernet0/0/1              172.16.1.17/30       up         up              
LoopBack0                         5.5.5.5/32           up         up(s)     
LoopBack1                         172.16.5.1/24        up         up(s)     
 
 
[R6]dis ip int b
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.18/30       up         up        
GigabitEthernet0/0/1              172.16.1.13/30       up         up            
LoopBack0                         6.6.6.6/32           up         up(s)     
LoopBack1                         172.16.6.1/24        up         up(s)     
 
 
[R7]dis ip int b
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.14/30       up         up        
GigabitEthernet0/0/1              34.1.1.1/24          up         up        
GigabitEthernet0/0/2              172.16.1.10/30       up         up        
LoopBack0                         7.7.7.7/32           up         up(s)     
LoopBack1                         172.16.7.1/24        up         up(s)     
 
 
[R8]dis ip int b
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              34.1.1.2/24          up         up         
LoopBack0                         8.8.8.8/32           up         up(s)     
LoopBack1                         192.168.2.1/24       up         up(s)

2.设置ospf 


[R2-ospf-1-area-0.0.0.0]dis th
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 172.16.1.1 0.0.0.0 
  network 172.16.1.21 0.0.0.0 
 
[R3-ospf-1]dis th
 area 0.0.0.0 
  network 0.0.0.0 255.255.255.255 
  network 3.3.3.3 0.0.0.0 
 
 
[R4-ospf-1-area-0.0.0.0]dis th
 area 0.0.0.0 
  network 0.0.0.0 255.255.255.255 
 
 
[R5-ospf-1-area-0.0.0.0]dis th
 area 0.0.0.0 
  network 0.0.0.0 255.255.255.255 
 
[R6-ospf-1-area-0.0.0.0]dis th
 area 0.0.0.0 
  network 0.0.0.0 255.255.255.255 
 
[R7-ospf-1-area-0.0.0.0]dis th
 area 0.0.0.0 
  network 7.7.7.7 0.0.0.0 
  network 172.16.1.9 0.0.0.0 
  network 172.16.1.14 0.0.0.0 
  network 172.16.7.0 0.0.0.255 
 
[R2-ospf-1-area-0.0.0.0]dis ospf peer brief 
 
 Area Id          Interface                        Neighbor id      State   
 0.0.0.0          GigabitEthernet0/0/1             3.3.3.3          Full        
 0.0.0.0          GigabitEthernet0/0/2             5.5.5.5          Full 
 
 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief 
 
 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             4.4.4.4          Full        
 
 
R4-ospf-1-area-0.0.0.0]dis ospf peer brief 
 
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          Full   
 
[R5-ospf-1-area-0.0.0.0]dis ospf peer brief 
 
 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             6.6.6.6          Full 
 
[R6-ospf-1-area-0.0.0.0]dis ospf peer brief 
 
 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             7.7.7.7          Full    
 
[R7-ospf-1-area-0.0.0.0]dis ospf peer brief 
 
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             6.6.6.6          Full  

3.起bgp建邻 


[R1]bgp 1	
[R1-bgp]peer 12.1.1.2 as-number 2
 
R2]bgp 64512	
[R2-bgp]confederation id 2
[R2-bgp]confederation peer-as 64513	
[R2-bgp]peer 12.1.1.1 as-number 1		
[R2-bgp]peer 3.3.3.3 as-number 64512
[R2-bgp]peer 3.3.3.3 connect-interface  l0 
[R2-bgp]peer 3.3.3.3 next-hop-local 	
[R2-bgp]peer 5.5.5.5 as-number 64513	
[R2-bgp]peer 5.5.5.5 connect-interface  l0
[R2-bgp]peer 5.5.5.5 next-hop-local 
[R2-bgp]peer 5.5.5.5 ebgp-max-hop 
 
R3]bgp 64512	
[R3-bgp]confederation id 2	
[R3-bgp]peer 2.2.2.2 as-number 64512
[R3-bgp]peer 2.2.2.2 connect-interface l0	
[R3-bgp]peer 4.4.4.4 as-number 64512	
[R3-bgp]peer 4.4.4.4 connect-interface l0
 
R4]bgp 64512
[R4-bgp]con	
[R4-bgp]confederation id 2	
[R4-bgp]peer 3.3.3.3 as-number 64512	
[R4-bgp]peer 3.3.3.3 connect-interface  l0
 
[R5]bgp 64513
[R5-bgp]confederation id  2
[R5-bgp]confederation peer-as 64512	
[R5-bgp]peer 2.2.2.2 as-number 64512
[R5-bgp]peer 2.2.2.2 connect-interface  l0	
[R5-bgp]peer 2.2.2.2 next-hop-local	
[R5-bgp]peer 2.2.2.2 ebgp-max-hop 	
[R5-bgp]peer 6.6.6.6 as-number 64513
[R5-bgp]peer 6.6.6.6 connect-interface  l0		
[R5-bgp]peer 6.6.6.6 next-hop-local 
 
R6]bgp 64513	
[R6-bgp]peer 5.5.5.5 as-number 64513	
[R6-bgp]peer 5.5.5.5 connect-interface l0	
[R6-bgp]confederation id 2	
[R6-bgp]peer 7.7.7.7 as-number 64513	
[R6-bgp]peer 7.7.7.7 connect-interface  l0
 
[R7]bgp 64513
[R7-bgp]confederation id 2	
[R7-bgp]peer 6.6.6.6 as-number 64513	
[R7-bgp]peer 6.6.6.6 connect-interface l0
[R7-bgp]peer 6.6.6.6 next-hop-local	
[R7-bgp]peer 34.1.1.2 as-number 3
 
[R8]bgp 3
[R8-bgp]peer 34.1.1.1 as-number 2
 
[R2]dis bgp peer 
 
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
 
  3.3.3.3         4       64512       13       15     0 00:11:24 Established    
   0
  5.5.5.5         4       64513       14       15     0 00:12:25 Established    
   0
  12.1.1.1        4           1       17       17     0 00:15:39 Established
 
[R3]dis bgp peer
 
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
 
  2.2.2.2         4       64512       13       13     0 00:11:33 Established    
   0
  4.4.4.4         4       64512       12       13     0 00:10:20 Established   
 
 
[R4]dis bgp peer
 
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
 
  3.3.3.3         4       64512       12       12     0 00:10:32 Established   
 
<R5>dis bgp peer
 
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
 
  2.2.2.2         4       64512       15       14     0 00:12:59 Established    
   0
  6.6.6.6         4       64513       10       12     0 00:08:58 Established    
 
[R6]dis bgp peer
 
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
 
  5.5.5.5         4       64513       11       11     0 00:09:06 Established    
   0
  7.7.7.7         4       64513        9       11     0 00:07:42 Established 
 
 
[R7]dis bgp pee
 
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
 
  6.6.6.6         4       64513        9        9     0 00:07:52 Established    
   0
  34.1.1.2        4           3        9       10     0 00:07:20 Established 
 

4.宣告R1和R8环回0,测试bgp 


[R1-bgp]net 1.1.1.1 32
 
[R8-bgp]net 8.8.8.8 32

5.在R3和R6上设置反射器 


[R3-bgp]peer 4.4.4.4 reflect-client 
 
[R6-bgp]peer 7.7.7.7 reflect-client 

6.查看bgp表并测试 


[R1-bgp]dis bgp routing-table 
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 
 *>   1.1.1.1/32         0.0.0.0         0                     0      i
 *>   8.8.8.8/32         12.1.1.2                              0      2 3i
 
[R4-bgp]dis bgp routing-table 
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 
 *>i  1.1.1.1/32         2.2.2.2         0          100        0      1i
 *>i  8.8.8.8/32         7.7.7.7         0          100        0      (64513) 3i
 
[R6-bgp]dis bgp routing-table
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 
 *>i  1.1.1.1/32         2.2.2.2         0          100        0      (64512) 1i
 *>i  8.8.8.8/32         7.7.7.7         0          100        0      3i
 
[R8-bgp]dis bgp routing-table 
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 
 *>   1.1.1.1/32         34.1.1.1                              0      2 1i
 *>   8.8.8.8/32         0.0.0.0         0                     0      i
 
 
 
[R8-bgp]ping -a 8.8.8.8 1.1.1.1
  PING 1.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=251 time=100 ms
    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=251 time=60 ms
    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=251 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=251 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=251 time=50 ms

7.对R3-R7业务网段进行宣告 


[R3-bgp]net 172.16.3.0 24
 
[R4-bgp]net 172.16.4.0 24
 
[R5-bgp]net 172.16.5.0 24
 
[R6-bgp]net 172.16.6.0 24
 
[R7-bgp]net 172.16.7.0 24

8.手动聚合链路 


[R3-bgp]aggregate 172.16.0.0 16 detail-suppressed 
 
[R4-bgp]aggregate 172.16.0.0 16 detail-suppressed
 
[R5-bgp]aggregate 172.16.0.0 16 detail-suppressed 
 
[R6-bgp]aggregate 172.16.0.0 16 detail-suppressed 
 
[R7-bgp]aggregate 172.16.0.0 16 detail-suppressed

9.防环 


[R3]ip route-static 172.16.0.0 16 NULL 0
 
[R4]ip route-static 172.16.0.0 16 NULL 0
 
[R5]ip route-static 172.16.0.0 16 NULL 0
 
[R6]ip route-static 172.16.0.0 16 NULL 0
 
[R7]ip route-static 172.16.0.0 16 NULL 0
<R1>ping -a 1.1.1.1 172.16.6.1
  PING 172.16.6.1: 56  data bytes, press CTRL_C to break
    Reply from 172.16.6.1: bytes=56 Sequence=1 ttl=253 time=40 ms
    Reply from 172.16.6.1: bytes=56 Sequence=2 ttl=253 time=30 ms
    Reply from 172.16.6.1: bytes=56 Sequence=3 ttl=253 time=40 ms
    Reply from 172.16.6.1: bytes=56 Sequence=4 ttl=253 time=40 ms
    Reply from 172.16.6.1: bytes=56 Sequence=5 ttl=253 time=30 ms

 10.按照题目要求可以使用隧道使AS1和AS3环回的业务网段ping通


[R1]int t	
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre 	
[R1-Tunnel0/0/0]source 1.1.1.1
[R1-Tunnel0/0/0]destination 8.8.8.8
 
[R8]int Tunnel 0/0/0
[R8-Tunnel0/0/0]ip add 10.1.1.2 24
[R8-Tunnel0/0/0]tunnel-protocol gre 	
[R8-Tunnel0/0/0]source 8.8.8.8
[R8-Tunnel0/0/0]destination 1.1.1.1
 
[R1]ip route-static 192.168.2.0 24 10.1.1.2
[R8]ip route-static 192.168.1.0 24 10.1.1.1

11.测试 


[R1]ping -a 192.168.1.1 192.168.2.1
  PING 192.168.2.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=255 time=60 ms
    Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=255 time=60 ms
    Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 192.168.2.1: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 192.168.2.1: bytes=56 Sequence=5 ttl=255 time=50 ms

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值