ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

Cisco路由-静态路由

Cisco路由-静态路由

# 概述

静态路由(Static Routing)是由网络管理员手动配置的固定路由,用于指定数据包传输路径,不会自动更新或学习网络变化。

适用于网络规模小、拓扑稳定。

优点:简单、可靠、安全,不占用路由器CPU计算路径,没有协议开销。

缺点:缺乏灵活性,链路或设备故障时,必须由管理员手动修改,无法自动绕过。

# 架构图

# 配置命令

一、基础信息配置

R1配置

R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#int s0/0 R1(config-if)#no sh R1(config-if)#ip add 12.1.1.1 255.255.255.0 R1(config-if)#int f1/0 R1(config-if)#no sh R1(config-if)#ip add 192.168.1.254 255.255.255.0 R1(config-if)#end

R2配置

R2#conf t Enter configuration commands, one per line. End with CNTL/Z. R2(config)#int s0/0 R2(config-if)#no sh R2(config-if)#ip add 12.1.1.2 255.255.255.0 R2(config-if)#int f1/0 R2(config-if)#no sh R2(config-if)#ip add 192.168.2.254 255.255.255.0 R2(config-if)#end

PC1配置

PC1#conf t Enter configuration commands, one per line. End with CNTL/Z. PC1(config)#int f0/0 PC1(config-if)#no shu PC1(config-if)#ip add 192.168.1.1 255.255.255.0 PC1(config-if)#end PC1(config)#no ip routing PC1(config)#ip default-gateway 192.168.1.254 PC1(config)#end

PC2配置

PC2#conf t Enter configuration commands, one per line. End with CNTL/Z. PC2(config)#int f0/0 PC2(config-if)#ip add 192.168.2.1 255.255.255.0 PC2(config-if)#no shu PC2(config-if)#end PC2(config)#no ip routing PC2(config)#ip default-gateway 192.168.2.254 PC2(config)#end

二、配置静态路由

方式一:

R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#ip route 192.168.2.0 255.255.255.0 s0/0 R1(config)#end --- R2#conf t Enter configuration commands, one per line. End with CNTL/Z. R2(config)#ip route 192.168.1.0 255.255.255.0 s0/0 R2(config)#end

方式二:

R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#no ip route 192.168.2.0 255.255.255.0 s0/0 R1(config)#end --- R2#conf t Enter configuration commands, one per line. End with CNTL/Z. R2(config)#no ip route 192.168.1.0 255.255.255.0 s0/0 R2(config)#end

三、测试

PC1#ping 192.168.2.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds: ..!!! Success rate is 60 percent (3/5), round-trip min/avg/max = 132/160/184 ms
返回列表