静态路由配置实现全网可达

本文档详细介绍了如何通过华为路由器(r1、r2、r3)配置IP地址和命名来划分广播域,以实现全网可达。配置过程中涉及接口设置、静态路由的添加,确保了不同网络段的PC能够互相通信。通过在路由器上添加静态路由条目,解决了不同子网间通信的问题,最终验证了PC之间的ping通性,实现了全网可达的目标。
摘要由CSDN通过智能技术生成

以实现以下模式全网可达为目的(软件:eNSP)

 首先划分广播域并配置ip(由路由器是广播域边界可知图中有5个广播域)

在配置路由器过程中可给每个路由器更换名字避免失误

<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r1
[r1]
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r2
[r2]

<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r3
[r3]

以下是路由器r1 ip配置

interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
Jul  8 2022 17:38:35-08:00 r1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r1-GigabitEthernet0/0/0]q
[r1]interface 	
[r1]interface g	
[r1]interface GigabitEthernet  0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.2.1 24
Jul  8 2022 17:39:51-08:00 r1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

路由器r2的ip配置


[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.2.2 24
Jul  8 2022 22:42:14-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
 IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r2-GigabitEthernet0/0/0]q
[r2]interface g	
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.3.1 24
[r2-GigabitEthernet0/0/1]
Jul  8 2022 22:42:52-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
 IP on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r2-GigabitEthernet0/0/1]q
[r2]interface g	
[r2]interface GigabitEthernet 0/0/2

[r2-GigabitEthernet0/0/2]ip address 192.168.4.1 24
[r2-GigabitEthernet0/0/2]
Jul  8 2022 22:43:37-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol
 IP on the interface GigabitEthernet0/0/2 has entered the UP state. 
[r2-GigabitEthernet0/0/2]

路由器r3的IP配置

[r3]interface g	
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.4.2
                                                    ^
Error:Incomplete command found at '^' position.
[r3-GigabitEthernet0/0/0]ip address 192.168.4.2 24
Jul  8 2022 22:47:36-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
 IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r3-GigabitEthernet0/0/0]q
[r3]interface g	
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.5.1 24
Jul  8 2022 22:48:04-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
 IP on the interface GigabitEthernet0/0/1 has entered the UP state. 

ip配置好之后要保证全网可达从实现三个PC端互通

PC1pingPC2

[r1]display ip routing-table
查看路由表

PC2在3.0/24段需要手动添加

 代码如下

[r1]ip route-static 192.168.3.0 24 192.168.2.2

[r2]ip route-static 192.168.1.0 24 192.168.2.1

PC1pingPC3

[r1]ip route-static 192.168.5.0 24 192.168.4.2
[r3]ip route-static 192.168.1.0 24 192.168.2.1

PC2pingPC3

[r2]ip route-static 192.168.5.0 24 192.168.4.2
[r3]ip route-static 192.168.3.0 24 192.168.4.1

通过查询发现r1没有4.0/24 r3没有2.0/24端则

[r1]ip route-static 192.168.4.0 24 192.168.2.2
[r3]ip route-static 192.168.2.0 24 192.168.4.1

 

 

 R1R2R3包含所有广播域则全网可达

验证pc3ping pc1

 全网可达

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值