前言
小实验练练手走起来
一、需求
需求老样子,全网互通
二、命令
1、基础配置走起来(端口+回环口IP,RIP及OSPF)
R1
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 16.0.0.1 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 12.0.0.1 24
[Huawei-GigabitEthernet0/0/1]int loop 0
[Huawei-LoopBack0]ip add 1.1.1.1 32
[Huawei-LoopBack0]q
[Huawei]rip
[Huawei-rip-1]v 2
[Huawei-rip-1]und sum
[Huawei-rip-1]net 1.0.0.0
[Huawei-rip-1]net 16.0.0.0
[Huawei-rip-1]q
[Huawei]ip route-s 2.2.2.2 32 12.0.0.2
R2
[Huawei]int g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 12.0.0.2 24
[Huawei-GigabitEthernet0/0/1]int g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 23.0.0.2 24
[Huawei-GigabitEthernet0/0/0]int loop 0
[Huawei-LoopBack0]ip add 2.2.2.2 32
[Huawei-LoopBack0]q
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]net 23.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei]ip route-s 1.1.1.1 32 12.0.0.1
R3
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 23.0.0.3 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 34.0.0.3 24
[Huawei-GigabitEthernet0/0/1]int loop0
[Huawei-LoopBack0]ip add 3.3.3.3 32
[Huawei-LoopBack0]q
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net 3.3.3.3 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]net 23.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 34.0.0.0 0.0.0.255
R4
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 34.0.0.4 24
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 45.0.0.4 24
[Huawei-GigabitEthernet0/0/0]int loop0
[Huawei-LoopBack0]ip add 4.4.4.4 32
[Huawei-LoopBack0]q
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net 34.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 4.4.4.4 0.0.0.0
R5
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 45.0.0.5 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 57.0.0.5 24
[Huawei-GigabitEthernet0/0/1]int loop0
[Huawei-LoopBack0]ip add 5.5.5.5 32
[Huawei-LoopBack0]q
[Huawei]rip
[Huawei-rip-1]v 2
[Huawei-rip-1]undo sum
[Huawei-rip-1]net 5.0.0.0
[Huawei-rip-1]net 57.0.0.0
[Huawei-rip-1]q
[Huawei]ip route-s 4.4.4.4 32 45.0.0.4
R6
[Huawei]int g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 16.0.0.6 24
[Huawei-GigabitEthernet0/0/0]int loop 0
[Huawei-LoopBack0]ip add 6.6.6.6 32
[Huawei-LoopBack0]q
[Huawei]rip
[Huawei-rip-1]v 2
[Huawei-rip-1]undo sum
[Huawei-rip-1]net 6.0.0.0
[Huawei-rip-1]net 16.0.0.0
R7
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 57.0.0.7 24
[Huawei-GigabitEthernet0/0/1]int loop0
[Huawei-LoopBack0]ip add 7.7.7.7 32
[Huawei-LoopBack0]q
[Huawei]rip
[Huawei-rip-1]v 2
[Huawei-rip-1]undo sum
[Huawei-rip-1]net 7.0.0.0
[Huawei-rip-1]net 57.0.0.0
2、BGP走起来
R1
[Huawei]bgp 100
[Huawei-bgp]router-id 1.1.1.1
[Huawei-bgp]peer 2.2.2.2 as-number 200
[Huawei-bgp]peer 2.2.2.2 connect-interface LoopBack0
[Huawei-bgp]peer 2.2.2.2 ebgp-max-hop 2
[Huawei-bgp]peer 6.6.6.6 as-number 100
[Huawei-bgp]peer 6.6.6.6 connect-interface LoopBack0
[Huawei-bgp]peer 6.6.6.6 next-hop-local
[Huawei-bgp]net 1.1.1.1 255.255.255.255
[Huawei-bgp]net 2.2.2.2 255.255.255.255
[Huawei-bgp]net 6.6.6.6 255.255.255.255
R2
[Huawei]bgp 200
[Huawei-bgp]router-id 2.2.2.2
[Huawei-bgp]peer 1.1.1.1 as-number 100
[Huawei-bgp]peer 1.1.1.1 connect-interface LoopBack0
[Huawei-bgp]peer 1.1.1.1 ebgp-max-hop 2
[Huawei-bgp]peer 3.3.3.3 as-number 200
[Huawei-bgp]peer 3.3.3.3 connect-interface LoopBack0
[Huawei-bgp]peer 4.4.4.4 as-number 200
[Huawei-bgp]peer 4.4.4.4 connect-interface LoopBack0
[Huawei-bgp]peer 3.3.3.3 next-hop-local
[Huawei-bgp]peer 4.4.4.4 next-hop-local
[Huawei-bgp]net 2.2.2.2 255.255.255.255
[Huawei-bgp]net 3.3.3.3 255.255.255.255
[Huawei-bgp]net 4.4.4.4 255.255.255.255
[Huawei-bgp]net 1.1.1.1 255.255.255.255
R3
[Huawei]bgp 200
[Huawei-bgp]router-id 3.3.3.3
[Huawei-bgp]peer 2.2.2.2 as-n 200
[Huawei-bgp]peer 2.2.2.2 connect-interface loop 0
[Huawei-bgp]peer 4.4.4.4 as-n 200
[Huawei-bgp]peer 4.4.4.4 connect-interface loop 0
[Huawei-bgp]peer 2.2.2.2 next-hop-local
[Huawei-bgp]peer 4.4.4.4 next-hop-local
[Huawei-bgp]net 2.2.2.2 255.255.255.255
[Huawei-bgp]net 3.3.3.3 255.255.255.255
[Huawei-bgp]net 4.4.4.4 255.255.255.255
R4
[Huawei]bgp 200
[Huawei-bgp]router-id 4.4.4.4
[Huawei-bgp]peer 2.2.2.2 as-number 200
[Huawei-bgp]peer 2.2.2.2 connect-interface LoopBack0
[Huawei-bgp]peer 3.3.3.3 as-number 200
[Huawei-bgp]peer 3.3.3.3 connect-interface LoopBack0
[Huawei-bgp]peer 5.5.5.5 as-number 300
[Huawei-bgp]peer 5.5.5.5 connect-interface LoopBack0
[Huawei-bgp]peer 5.5.5.5 ebgp-max-hop 2
[Huawei-bgp]peer 2.2.2.2 next-hop-local
[Huawei-bgp]peer 3.3.3.3 next-hop-local
[Huawei-bgp]net 2.2.2.2 255.255.255.255
[Huawei-bgp]net 3.3.3.3 255.255.255.255
[Huawei-bgp]net 5.5.5.5 255.255.255.255
[Huawei-bgp]net 4.4.4.4 255.255.255.255
R5
[Huawei]bgp 300
[Huawei-bgp]router-id 5.5.5.5
[Huawei-bgp]peer 4.4.4.4 as-number 200
[Huawei-bgp]peer 4.4.4.4 connect-interface LoopBack0
[Huawei-bgp]peer 4.4.4.4 ebgp-max-hop 2
[Huawei-bgp]peer 7.7.7.7 as-number 300
[Huawei-bgp]peer 7.7.7.7 connect-interface LoopBack0
[Huawei-bgp]peer 7.7.7.7 next-hop-local
[Huawei-bgp]net 4.4.4.4 255.255.255.255
[Huawei-bgp]net 5.5.5.5 255.255.255.255
[Huawei-bgp]net 7.7.7.7 255.255.255.255
R6
[Huawei]bgp 100
[Huawei-bgp]router-id 6.6.6.6
[Huawei-bgp]peer 1.1.1.1 as-number 100
[Huawei-bgp]peer 1.1.1.1 next-hop-local
[Huawei-bgp]peer 1.1.1.1 connect-interface LoopBack0
[Huawei-bgp]net 6.6.6.6 255.255.255.255
[Huawei-bgp]net 1.1.1.1 255.255.255.255
R7
[Huawei]bgp 300
[Huawei-bgp]router-id 7.7.7.7
[Huawei-bgp]peer 5.5.5.5 as-number 300
[Huawei-bgp]peer 5.5.5.5 connect-interface LoopBack0
[Huawei-bgp]peer 5.5.5.5 next-hop-local
[Huawei-bgp]net 5.5.5.5 255.255.255.255
[Huawei-bgp]net 7.7.7.7 255.255.255.255
总结
小小实验,做一做玩,防止忘记咯