静态路由的原理及配置

一、拓扑图搭建

静态路由的原理及配置_第1张图片

PC1:IP如下图所示:

静态路由的原理及配置_第2张图片

PC2:IP如下图所示:

静态路由的原理及配置_第3张图片

二、IP地址的配置

配置R1的IP地址:

u t  m       //在用户视图关闭提示信息
Info: Current terminal monitor is off.
sys          //进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]u in e       //在系统视图关闭提示信息
Info: Information center is disabled.
[Huawei]sys R1       // 将名字改为R1
[R1]int g0/0/0       //进入接口g0/0/0 
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24          //配置IP地址
[R1-GigabitEthernet0/0/0]un sh            //启动接口
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.0.0.1 24
[R1-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R1-GigabitEthernet0/0/1]q             //退出系统视图

配置R2的IP地址:

u t m
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]u in e
Info: Information center is disabled.
[Huawei]sys R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.254 24
[R2-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]undo ip add 192.168.2.254 24
[R2-GigabitEthernet0/0/0]ip add 10.0.0.2 24
[R2-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.2.254 24 
[R2-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R2-GigabitEthernet0/0/1]q

三、静态路由配置

IP route-static 目标网段 子网掩码 下一跳IP

下一跳:下一个路由器的直连接口的IP地址R1

R1静态配置

[R1]ip ro    
[R1]ip route-stat    
[R1]ip route-static 192.168.2.0 24 10.0.0.2 

R2静态配置

[R2]ip ro    
[R2]ip route-stat    
[R2]ip route-static 192.168.1.0 24 10.0.0.1

四、查看和测试

1、查看

查看路由表:display ip routing-table

静态路由的原理及配置_第4张图片

静态路由的原理及配置_第5张图片 

2、测试

通过PC1 ping PC2 可以看到可以ping通

静态路由的原理及配置_第6张图片

静态路由的原理及配置_第7张图片 

你可能感兴趣的:(网络)