缺省路由属于特殊的静态路由
PC的网关其实就是一种缺省路由
缺省路由属于“替补路由”,只有当其他的路由不可达时才会使用缺省路由
缺省路由适用于边缘节点,以及企业出口
PC1(配置IP地址)
IP地址:10.1.1.2
子网掩码:255.255.255.0
网关:10.1.1.1
PC2(配置IP地址)
IP地址:10.1.1.3
子网掩码:255.255.255.0
网关:10.1.1.1
百度(配置IP地址)
IP地址:30.3.3.2
子网掩码:255.255.255.0
网关:30.3.3.1
搜狐(配置IP地址)
IP地址:40.4.4.2
子网掩码:255.255.255.0
网关:40.4.4.1
R1(设置IP地址)
<Huawei>system-view //进入全局配置模式
[Huawei]undo info-center enable //关闭信息告警
[Huawei]sysname R1 //改名
[R1]interface e0/0/0 //进入接口
[R1-Ethernet0/0/0]ip address 10.1.1.1 24 //设置IP地址
[R1-Ethernet0/0/0]quit //退出
[R1]interface e0/0/1 //进入接口
[R1-Ethernet0/0/1]ip address 20.2.2.1 24 //设置IP地址
[R1-Ethernet0/0/1]quit //退出
[R1]
R2(设置IP地址)
<Huawei>system-view //进入全局配置模式
[Huawei]undo info-center enable //关闭信息告警提示
[Huawei]sysname R2 //改名
[R2]interface e0/0/1 //进入接口
[R2-Ethernet0/0/1]ip address 30.3.3.1 24 //设置IP地址
[R2-Ethernet0/0/1]quit //退出
[R2]interface e0/0/0 //进入接口
[R2-Ethernet0/0/1]ip address 40.4.4.1 24 //设置IP地址
[R2-Ethernet0/0/1]quit //退出
[R2]interface g0/0/0 //进入接口
[R2-GigabitEthernet0/0/0]ip address 20.2.2.2 24 //设置IP地址
[R2-GigabitEthernet0/0/0]quit //退出
[R2]
R1(配置默认路由,缺省路由)缺省路由适用于边缘节点,以及企业出口
[R1]ip route-static 0.0.0.0 0 20.2.2.2 //配置缺省路由
R2(配置静态路由)
[R2]ip route-static 10.1.1.0 24 20.2.2.1 //配置默认路由
PC1(测试是否可以ping通百度和搜狐)
PC>ping 30.3.3.2 //测试是否可以ping通百度
Ping 30.3.3.2: 32 data bytes, Press Ctrl_C to break
From 30.3.3.2: bytes=32 seq=1 ttl=126 time=141 ms //ping通
From 30.3.3.2: bytes=32 seq=2 ttl=126 time=78 ms
From 30.3.3.2: bytes=32 seq=3 ttl=126 time=110 ms
From 30.3.3.2: bytes=32 seq=4 ttl=126 time=94 ms
From 30.3.3.2: bytes=32 seq=5 ttl=126 time=94 ms
--- 30.3.3.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/103/141 ms
PC>ping 40.4.4.2 //测试是否可以ping通搜狐
Ping 40.4.4.2: 32 data bytes, Press Ctrl_C to break
From 40.4.4.2: bytes=32 seq=1 ttl=126 time=124 ms //ping通
From 40.4.4.2: bytes=32 seq=2 ttl=126 time=93 ms
From 40.4.4.2: bytes=32 seq=3 ttl=126 time=62 ms
From 40.4.4.2: bytes=32 seq=4 ttl=126 time=78 ms
From 40.4.4.2: bytes=32 seq=5 ttl=126 time=78 ms
--- 40.4.4.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 62/87/124 ms
PC>
PC2(测试是否可以ping通百度和搜狐)
PC>ping 30.3.3.2 //测试是否可以ping通百度
Ping 30.3.3.2: 32 data bytes, Press Ctrl_C to break
From 30.3.3.2: bytes=32 seq=1 ttl=126 time=141 ms //ping通
From 30.3.3.2: bytes=32 seq=2 ttl=126 time=78 ms
From 30.3.3.2: bytes=32 seq=3 ttl=126 time=110 ms
From 30.3.3.2: bytes=32 seq=4 ttl=126 time=94 ms
From 30.3.3.2: bytes=32 seq=5 ttl=126 time=94 ms
--- 30.3.3.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/103/141 ms
PC>ping 40.4.4.2 //测试是否可以ping通搜狐
Ping 40.4.4.2: 32 data bytes, Press Ctrl_C to break
From 40.4.4.2: bytes=32 seq=1 ttl=126 time=124 ms //ping通
From 40.4.4.2: bytes=32 seq=2 ttl=126 time=93 ms
From 40.4.4.2: bytes=32 seq=3 ttl=126 time=62 ms
From 40.4.4.2: bytes=32 seq=4 ttl=126 time=78 ms
From 40.4.4.2: bytes=32 seq=5 ttl=126 time=78 ms
--- 40.4.4.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 62/87/124 ms
PC>
转载:https://blog.csdn.net/Yang__Qi/article/details/102461922
查看评论