BGP实验

实验拓扑图

BGP实验_第1张图片

实验配置

r1

sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]q 
[r1]int LoopBack 0
[r1-LoopBack0]ip add 1.1.1.1 24
[r1-LoopBack0]

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255

[r1]bgp 64512 
[r1-bgp]route-select
[r1-bgp]router-id 1.1.1.1
[r1-bgp]confederation id 100
[r1-bgp]peer 2.2.2.2 as-number 64512
[r1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
 

ping 8.8.8.8
  PING 8.8.8.8: 56  data bytes, press CTRL_C to break
    Reply from 8.8.8.8: bytes=56 Sequence=1 ttl=249 time=90 ms
    Reply from 8.8.8.8: bytes=56 Sequence=2 ttl=249 time=60 ms
    Reply from 8.8.8.8: bytes=56 Sequence=3 ttl=249 time=80 ms
    Reply from 8.8.8.8: bytes=56 Sequence=4 ttl=249 time=50 ms
    Reply from 8.8.8.8: bytes=56 Sequence=5 ttl=249 time=60 ms

  --- 8.8.8.8 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/68/90 ms

r2

sys
[Huawei]sys r2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 24
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.2.1 24
[r2-GigabitEthernet0/0/1]q
[r2]int LoopBack 0
[r2-LoopBack0]ip add 2.2.2.2 24
 
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net    
[r2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]

[r2]bgp 64512  
[r2-bgp]router-id 2.2.2.2   
[r2-bgp]confederation id 100
[r2-bgp]peer 1.1.1.1 as-number 64512
[r2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[r2-bgp]peer 3.3.3.3 as-number 64512  
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack  0
[r2-bgp]peer 1.1.1.1 reflect-client (反射)
[r2-bgp]peer 3.3.3.3 reflect-client(反射)

r3

sys
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.2.2 24
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.3.1 24
[r3-GigabitEthernet0/0/1]q
[r3]int LoopBack 0
[r3-LoopBack0]ip add 3.3.3.3 24

[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255

[r3]bgp 64512
[r3-bgp]route-select
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 100
[r3-bgp]peer 2.2.2.2 as-number 64512
[r3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r3-bgp]confederation peer-as 64513
[r3-bgp]peer 4.4.4.4 as-number 64513
[r3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r3-bgp]peer 4.4.4.4 ebgp-max-hop (多跳)
[r3-bgp]peer 2.2.2.2 next-hop-local(下一跳为本地)
 

r4
 

 [Huawei]sys r4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.3.2 24
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.4.1 24
[r4-GigabitEthernet0/0/1]q
[r4]int LoopBack 0
[r4-LoopBack0]ip add 4.4.4.4 24


[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0    
[r4-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255

[r4]bgp 64513
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 100
[r4-bgp]confederation peer-as 64512
[r4-bgp]peer 5.5.5.5 as-number 64513
[r4-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r4-bgp]peer 3.3.3.3 ebgp-max-hop

r5

[Huawei]sys r5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.4.2 24
[r5-GigabitEthernet0/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.5.1 24
[r5-GigabitEthernet0/0/1]q  
[r5]int LoopBack 0
[r5-LoopBack0]ip add 5.5.5.5 24

[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]net    
[r5-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 5.5.5.0 0.0.0.255


[r5]bgp 64513 
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 100
[r5-bgp]peer 4.4.4.4 as-number 64513
[r5-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r5-bgp]peer 192.168.5.2 as-number 101
[r5-bgp]import-route ospf 1(bgp协议学习ospf协议)
[r5-bgp]peer 4.4.4.4 next-hop-local
 

r6

[Huawei]sys r6
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 192.168.5.2 24
[r6-GigabitEthernet0/0/0]int g0/0/01
[r6-GigabitEthernet0/0/1]ip add 192.168.6.1 24
[r6-GigabitEthernet0/0/1]q
[r6]int LoopBack 0
[r6-LoopBack0]ip add 6.6.6.6 24
[r6-LoopBack0]


[r6]rip 1
[r6-rip-1]version 2
[r6-rip-1]network 192.168.6.0 


[r6]bgp 101
[r6-bgp]router-id 6.6.6.6
[r6-bgp]peer 192.168.5.1 as-number 100
[r6-bgp]peer 7.7.7.7 as-number 101
[r6-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[r6-bgp]import-route rip 1(bgp协议学习rip协议)
[r6-bgp]peer 7.7.7.7 next-hop-local

r7

[Huawei]sys r7
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 192.168.6.2 24
[r7-GigabitEthernet0/0/0]int g0/0/1
[r7-GigabitEthernet0/0/1]ip add 192.168.7.1 24
[r7]int LoopBack 0
[r7-LoopBack0]ip add 7.7.7.7 24

[r7]rip 1
[r7-rip-1]version 2
[r7-rip-1]network 192.168.6.0
[r7-rip-1]network 192.168.7.0
[r7-rip-1]network 7.0.0.0


[r7]bgp 101
[r7-bgp]router-id 7.7.7.7
[r7-bgp]peer 6.6.6.6 as-number 101
[r7-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[r7-bgp]peer 8.8.8.8 as-number 101
[r7-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[r7-bgp]peer 6.6.6.6 reflect-client (反射)

 

r8

[Huawei]sys r7
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 192.168.7.2 24
[r7-GigabitEthernet0/0/0]q
[r7]int LoopBack 0
[r7-LoopBack0]ip add 8.8.8.8 24


[r7]rip 1
[r7-rip-1]version 2
[r7-rip-1]network 192.168.7.0 
[r7-rip-1]network 8.0.0.0

[r8]bgp 101
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 7.7.7.7 as-number 101
[r8-bgp]peer 7.7.7.7 connect-interface LoopBack 0

实验结果:全网可达

BGP实验_第2张图片 

你可能感兴趣的:(网络,服务器,linux)