配置默认路由
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置默认路由相关的知识,希望对你有一定的参考价值。
1.配置接口IP地址并通过静态路由、默认路由配置实现全网互通 ,具体如下图.
2设置第一台路由:
<Huawei>u t m //关闭更新消息
Info: Current terminal monitor is off.
<Huawei>sys //进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1 //更改名字为r1
[r1]int g0/0/0 //进入0/0/0接口
[r1-GigabitEthernet0/0/0]ip address 192.168.2.1 24 //设置IP
[r1]int g0/0/1 //进入0/0/1接口
[r1-GigabitEthernet0/0/1]ip address 192.168.1.254 24 //设置IP
设置第二台路由:
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.2.2 24
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.3.1 24
设置第三台路由:
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.4.254 24
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.3.2 24
3.将PC机设置IP地址及网关:
4.用ping命令测试互通:
目前无法互通
5.设置静态路由模式以及默认路由模式:
用ip route-static命令进行设置
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.2 //默认模式
[R2]ip route-static 192.168.1.0 255.255.255.0 192.168.2.1 //静态模式
[R2]ip route-static 192.168.4.0 255.255.255.0 192.168.3.2
[R3]ip route-static 0.0.0.0 0.0.0.0 192.168.3.1
6.再次测试连通性:
7.可以实现互通
以上是关于配置默认路由的主要内容,如果未能解决你的问题,请参考以下文章