华为ensp_BGP最最基础实验(必会)

实验1:

配置BGP命令

先在OSPF中的AS配置
[R7]ospf 1
 [R7-ospf-1]area 0
 [R7-ospf-1-area-0.0.0.0]network 10.0.24.0 0.0.0.255
 [R7-ospf-1-area-0.0.0.0]network 7.7.7.7 0.0.0.0
 配置BGP:
 [R1]bgp 100 ——#创建bgp编号为100 (也就是AS100)
 [R1-bgp]router-id 1.1.1.1 ——#配置BGP的Router ID
 [R1-bgpl peer 2.2.2.2 as-number 100 ——#指定对等体的回环网口IP地址及其所属的AS编号
 [R1-bgp]peer 2.2.2.2 connect-interface LoopBack0 ——#更新发送bgp报文的接口为Loopback0接口
 [R1-bgp] peer 3.3.3.3 as-number 100
 [R1-bgp]peer 3.3.3.3 connect-interface LoopBack0
 [R3-bgp]peer 2.2.2.2 next-hop-local——#ASBR从ebgp邻居学习到的路由传递给ibgp邻居时,修改该命令
 [R3-bgp]peer 7.7.7.7 ebgp-max-hop 2——#两个AS之间用回环网口建的邻居要将它们的邻居的最大跳数改为2,默认的是1 (因为不是直连而是用Loopbacko接口,需要经过2个路由,而默认EBGP传递时TTL值为1)
 [R3-bgp]network 1.1.1.1 255.255.255.255 ——#宣告指定的IGP、静态、默认路由进BGP进程

在这里插入图片描述
中间区域AS200:OSPF
左边区域AS100:动态路由RIP
右边区域AS300:动态路由RIP

**R1:**
<Huawei>u t m 
Info: Current terminal monitor is off.
<Huawei>sys 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys 
[Huawei]sysname R1
[R1]us 
[R1]user-int 
[R1]user-interface co 
[R1]user-interface console 0
[R1-ui-console0]id 
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 11.0.0.1 24
[R1-GigabitEthernet0/0/1]int loop 0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1]bgp 100
[R1-bgp]peer 6.6.6.6 as-number 100
[R1-bgp]peer 6.6.6.6 connect-interface LoopBack 0
R1-bgp]peer 6.6.6.6 next-hop-local
[R1-bgp]peer 2.2.2.2 as-number 200
R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]peer 2.2.2.2 ebgp-max-hop 2
[R1-bgp]q
[R1]ip route-static 2.2.2.2 32 12.0.0.2 
[R1]rip 1
[R1-rip-1]version 2 
[R1-rip-1]undo summary 
[R1-rip-1]network 11.0.0.0
[R1-rip-1]network 1.0.0.0
[R1-rip-1]q
[R1]bgp 100
[R1-bgp]network 1.1.1.1 32
[R1-bgp]network 6.6.6.6 32
[R1-bgp]network 2.2.2.2 32
[R1-bgp]q
**R2:**
<Huawei>u t m 
Info: Current terminal monitor is off.
<Huawei>sys 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys 
[Huawei]sysname R2
[R2]us 
[R2]user-int 
[R2]user-interface co 
[R2]user-interface console 0
[R2-ui-console0]id 
[R2-ui-console0]idle-timeout 0 0
[R2-ui-console0]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 23.0.0.2 24
[R2-GigabitEthernet0/0/1]int loop 0
[R2-LoopBack0]ip add 2.2.2.2 32
[R2-LoopBack0]q
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]q
[R2]bgp 200
[R2-bgp]peer 1.1.1.1 as-number 100
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 1.1.1.1 ebgp-max-hop 2
[R2-bgp]peer 3.3.3.3 as-number 200
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R2-bgp]peer 3.3.3.3 next-hop-local
[R2-bgp]peer 4.4.4.4 as-number 200
[R2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R2-bgp]peer 4.4.4.4 next-hop-local
[R2-bgp]q
[R2]ip route-static 1.1.1.1 32 12.0.0.1
[R2]bgp 200
[R2-bgp]network 1.1.1.1 32
[R2-bgp]network 2.2.2.2 32
[R2-bgp]network 3.3.3.3 32
[R2-bgp]network 4.4.4.4 32
**R3:**
<Huawei>u t m 
Info: Current terminal monitor is off.
<Huawei>sys 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys 
[Huawei]sysname R3
[R3]us 
[R3]user-int 
[R3]user-interface c 
[R3]user-interface consol 
[R3]user-interface console 0
[R3-ui-console0]id 
[R3-ui-console0]idle-timeout 0 0
[R3-ui-console0]q
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 23.0.0.3 24
[R3-GigabitEthernet0/0/1]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 34.0.0.3 24
[R3-GigabitEthernet0/0/0]int loop 0
[R3-LoopBack0]ip add 3.3.3.3 32
[R3-LoopBack0]q
[R3]ospf 1
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]q
[R3]bgp 200
[R3-bgp]peer 2.2.2.2 as-number 200
R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3-bgp]peer 4.4.4.4 as-number 200
R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
**R4;**
<Huawei>u t m 
Info: Current terminal monitor is off.
<Huawei>sys 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys 
[Huawei]sysname R4
[R4]us 
[R4]user-int 
[R4]user-interface co 
[R4]user-interface console 0
[R4-ui-console0]id 
[R4-ui-console0]idle-timeout 0 0
[R4-ui-console0]q
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 34.0.0.4 24
[R4-GigabitEthernet0/0/0]int g0/0/1 
[R4-GigabitEthernet0/0/1]ip add 45.0.0.4 24
[R4-GigabitEthernet0/0/1]int loop 0
[R4-LoopBack0]ip add 4.4.4.4 32
[R4-LoopBack0]q
[R4]os 
[R4]ospf 1
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]q
[R4-ospf-1]q
[R4]bgp 200
[R4-bgp]peer 2.2.2.2 as-number 200
[R4-bgp]peer 2.2.2.2 co 
[R4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R4-bgp]peer 2.2.2.2 next-hop-local
[R4-bgp]peer 3.3.3.3 as-number 200
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R4-bgp]peer 3.3.3.3 next-hop-local
[R4-bgp]peer 5.5.5.5 as-number 300
[R4-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R4-bgp]peer 5.5.5.5 ebgp-max-hop 2
[R4-bgp]q
[R4]ip route-static 5.5.5.5 32 45.0.0.5
[R4]bgp 200
[R4-bgp]network 2.2.2.2 32
[R4-bgp]network 3.3.3.3 32
[R4-bgp]network 4.4.4.4 32
[R4-bgp]network 5.5.5.5 32
**R5:**
<Huawei>u t m 
Info: Current terminal monitor is off.
<Huawei>sys 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys 
[Huawei]sysname R5
[R5]us 
[R5]user-int 
[R5]user-interface co 
[R5]user-interface console 0
[R5-ui-console0]id 
[R5-ui-console0]idle-timeout 0 0
[R5-ui-console0]q
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 45.0.0.5 24
[R5-GigabitEthernet0/0/1]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 56.0.0.5 24
[R5-GigabitEthernet0/0/0]int loop 0
[R5-LoopBack0]ip add 5.5.5.5 32
[R5-LoopBack0]q
[R5]bgp 300
[R5-bgp]peer 4.4.4.4 as-number 200
[R5-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R5-bgp]peer 4.4.4.4 ebgp-max-hop 2
[R5-bgp]peer 7.7.7.7 as-number 300
R5-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R5-bgp]peer 7.7.7.7 next-hop-local
R5]ip route-static 4.4.4.4 32 45.0.0.4
[R5]rip 1
[R5-rip-1]vers 
[R5-rip-1]version 2
[R5-rip-1]undo summary 
[R5-rip-1]network 56.0.0.0
[R5-rip-1]network 5.0.0.0
[R5-rip-1]bgp 300
[R5-bgp]network 5.5.5.5 32
[R5-bgp]network 4.4.4.4 32
[R5-bgp]network 7.7.7.7 32
**R6:**
<Huawei>u t m 
Info: Current terminal monitor is off.
<Huawei>sys 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys 
[Huawei]sysname R6
[R6]us 
[R6]user-int 
[R6]user-interface co 
[R6]user-interface console 0
[R6-ui-console0]id 
[R6-ui-console0]idle-timeout 0 0
[R6-ui-console0]q
[R6]interface g0/0/0
[R6-GigabitEthernet0/0/0]ip add 11.0.0.6 24
[R6-GigabitEthernet0/0/0]int loop 0
[R6-LoopBack0]ip add 6.6.6.6 32
[R6-LoopBack0]q
[R6]bgp 100
[R6-bgp]peer 1.1.1.1 as-number 100
[R6-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R6-bgp]peer 1.1.1.1 next-hop-local
[R6-bgp]q
[R6]rip 1
[R6-rip-1]version 2
[R6-rip-1]undo summary 
[R6-rip-1]network 6.0.0.0
[R6-rip-1]network 11.0.0.0
[R6-rip-1]bgp 100
[R6-bgp]network 6.6.6.6 
**R7:**
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys 
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys 
[Huawei]sysname R7
[R7]us 
[R7]user-int 
[R7]user-interface co 
[R7]user-interface console 0
[R7-ui-console0]id 
[R7-ui-console0]idle-timeout 0 0
[R7-ui-console0]q
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 56.0.0.7 24
[R7-GigabitEthernet0/0/0]int loop 0
[R7-LoopBack0]ip add 7.7.7.7 32
[R7-LoopBack0]q
[R7]bgp 300
[R7-bgp]peer 5.5.5.5 as-number 300
[R7-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R7-bgp]peer 5.5.5.5 next-hop-local
[R7-bgp]q
[R7]rip 1
[R7-rip-1]version 2
[R7-rip-1]undo summary 
[R7-rip-1]network 56.0.0.0
[R7-rip-1]network 7.0.0.0
[R7-rip-1]bgp 300
[R7-bgp]network 7.7.7.7 32
[R7-bgp]network 5.5.5.5 32
[R7-bgp]q

结束后在各个中查看<dis ip routing-table
在这里插入图片描述最后再ping 从R6 pingR 7:

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Wsxyi/article/details/112630519
今日推荐