目的:PC1与PC2互通
首先配置每台设备的IP地址
PC1配置IP地址
PC2配置IP地址
配置各路由IP地址(在过程中有点烦躁,如果会配就可以略过此过程)
R1配置端口IP地址:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 100.1.1.254 24
Mar 17 2024 15:31:55-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 12.1.1.1 30
Mar 17 2024 15:32:23-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 13.1.1.1 30
R2配置端口IP地址:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 12.1.1.2 30
Mar 17 2024 15:38:29-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip add 23.1.1.1 30
[R2-GigabitEthernet0/0/2]
Mar 17 2024 15:38:57-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R2-GigabitEthernet0/0/2]
R3配置端口IP地址:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 23.1.1.2 30
Mar 17 2024 15:41:00-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R3-GigabitEthernet0/0/2]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 13.1.1.2 30
Mar 17 2024 15:41:25-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 34.1.1.1 30
[R3-GigabitEthernet0/0/0]
Mar 17 2024 15:41:45-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]
R4配置端口IP地址:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 34.1.1.2 30
[R4-GigabitEthernet0/0/0]
Mar 17 2024 15:43:11-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 45.1.1.1 30
Mar 17 2024 15:43:32-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R4-GigabitEthernet0/0/1]
R5配置端口IP地址:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 45.1.1.2 30
Mar 17 2024 15:44:08-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R5-GigabitEthernet0/0/1]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 200.1.1.254 24
Mar 17 2024 15:44:25-08:00 R5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]
由于配置路由器IP地址较多,一定要检查清楚是否配对,可以使用命令dis int brief检查各端口IP地址是否正确,防止后面找BUG或者使用Ping直连路由是否通两种方法。
分别在R1 R2 R3运行RIP协议
[R1]rip 1
[R1-rip-1]version 2 //版本2
[R1-rip-1]network 100.0.0.0 //宣告路由
[R1-rip-1]network 12.0.0.0
[R1-rip-1]network 13.0.0.0
[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 23.0.0.0
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]net 23.0.0.0
[R3-rip-1]net 13.0.0.0
查看路由表:dis ip router-tabel
配置R3 R4 R5 BGP
[R3]bgp 100 //R3在BGP 100里面
[R3-bgp]peer 34.1.1.2 as-number 2000 // 对端IP 对端AS:2000
[R4]bgp 2000
[R4-bgp]peer 34.1.1.1 as-number 100
[R4-bgp]peer 45.1.1.2 as-number 2000 //iBGP
[R5]bgp 2000
[R5-bgp]peer 45.1.1.1 as-number 2000
查看BGP邻居关系可以使用dis bgp peer (Established相当于ospf full)
此时路由器路由表未学到PC1和PC2网段,需要宣告BGP到路由表里面
[R5]bgp 2000
[R5-bgp]ipv4
[R5-bgp]ipv4-family unicast
[R5-bgp-af-ipv4]network 200.1.1.0 24
已经成功把BGP路由宣告进去
[R3]rip
[R3-rip-1]import-route bgp //引入200的路由
[R3]bgp 100
[R3-bgp]import-route rip 1
[R5]ip route-static 34.1.1.0 30 45.1.1.1 //把100.1.1.0加入到路由表中