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

以实现以下模式全网可达为目的(软件:eNSP)静态路由配置实现全网可达_第1张图片

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

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

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

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. 

静态路由配置实现全网可达_第2张图片

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

PC1pingPC2

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

静态路由配置实现全网可达_第3张图片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

静态路由配置实现全网可达_第4张图片

 静态路由配置实现全网可达_第5张图片

 静态路由配置实现全网可达_第6张图片

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

验证pc3ping pc1

静态路由配置实现全网可达_第7张图片

 全网可达

你可能感兴趣的:(计算机网络基础,网络,网络协议)