这里写自定义目录标题
在这里插入图片
描述
undo t m
Info: Current terminal monitor is off.
sys
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]user-in con 0
[R1-ui-console0]int loop 0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]quit
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]undo shut
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.1.1.1 24
Info: Interface GigabitEthernet0/0/1 is not shutdown
同理配置好R2R3R4R5IP地址,并且测试一下是否连通接着好OSPF
以R4为例子
[R4]os
[R4]ospf 1 rou
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[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]network 45.1.1.1 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 32.1.1.1 0.0.0.255
R2R3同理可得
再BGP并配置静态路由,接着宣告,以R1R2为例
[R1]bgp 100
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as-number 200
[R1-bgp]peer 2.2.2.2 connect-interface loop0
[R1-bgp]peer 2.2.2.2 ebgp-max-hop 255
[R1-bgp]peer 3.3.3.3 as-number 200
[R1-bgp]peer 3.3.3.3 connect-interface loop0
[R1-bgp]peer 3.3.3.3 ebgp-max-hop 255
[R1-bgp]quit
[R1]ip route-static 2.2.2.2 32 14.1.1.2
[R1]ip route-static 3.3.3.3 32 21.1.1.3
[R1]bgp 100
[R1-bgp]network 1.1.1.1 32
[R1-bgp]network 14.1.1.0 24
[R1-bgp]network 21.1.1.0 24
[R2]bgp 200
[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 loop0
[R2-bgp]peer 1.1.1.1 ebgp-max-hop 255
[R2-bgp]peer 3.3.3.3 as-number 200
[R2-bgp]peer 3.3.3.3 connect-interface loop0
[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 loop0
[R2-bgp]peer 4.4.4.4 next-hop-local
[R2-bgp]quit
[R2]ip route-static 1.1.1.1 32 14.1.1.1
[R2]bgp 200
[R2-bgp]network 2.2.2.2 32
[R2-bgp]network 3.3.3.3 32
[R2-bgp]network 4.4.4.4 32
[R2-bgp]network 1.1.1.1 32
[R2-bgp]network 14.1.1.0 24
[R2-bgp]network 45.1.1.0 24
[R2-bgp]quit
全部宣告结束后,带源ping测试
[R5]ping -a 5.5.5.5 1.1.1.1
接着检查一下 MED
[R5]display bgp rou