思科静态路由配置实验一(途经两台路由器)

  • Post author:
  • Post category:其他




静态路由配置实现不同网段通信——实验一


实验拓扑

在这里插入图片描述



PC1经过R1和R2两个路由访问PC2,两台PC处于不同网段,进行通信互访,这里我们使用静态路由的方式进行模拟配置实验



1.配置R1和R2接口ip地址

R1>enable

R1#configure terminal

R1(config)#int fa0/1

R1(config-if)#ip address 192.168.10.30 255.255.255.0

R1(config-if)#no shutdown

R1(config)#int fa0/0

R1(config-if)#ip address 192.168.20.10 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)end

R1#show ip int b

R1#show ip interface brief

——查看接口配置状态信息

Interface IP-Address OK? Method Status Protocol

FastEthernet0/0 192.168.20.10 YES manual up up

FastEthernet0/1 192.168.10.30 YES manual up up

Vlan1 unassigned YES unset administratively

down down


同样操作配置R2接口ip地址

R1>enable

R1#configure terminal

R1(config)#int fa0/1

R1(config-if)#ip address 192.168.30.10 255.255.255.0

R1(config-if)#no shut

R1(config)#int fa0/0

R1(config-if)#ip address 192.168.20.20 255.255.255.0

R1(config-if)#no shut

R1(config-if)end

R1#show ip int b

R1#show ip interface brief


Interface IP-Address OK? Method Status Protocol

FastEthernet0/0 192.168.20.20 YES manual up up

FastEthernet0/1 192.168.30.10 YES manual up up

Vlan1 unassigned YES unset administratively

down down



2.配置PC1\PC2静态ip地址

在这里插入图片描述

在这里插入图片描述


注意:PC网关设置与直连的路由接口ip地址保持一致


3.设置静态路由


Tips:如果不配置静态路由信息,两网段的是无法ping通的,两端如果都配置了默认路由之后会造成路由环路,一端配置默认路由 0.0.0.0 0.0.0.0,也可以ping通。


R1–>R2:

R1(config-if)#ip route 192.168.30.0 255.255.255.0 192.168.20.20

R1–>R2:

R1(config-if)#ip route 192.168.10.0 255.255.255.0 192.168.20.10












R1#show ip route –查看路由信息

Codes: C – connected, S – static, I – IGRP, R – RIP, M – mobile, B – BGP

D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area

N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2

E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGP

i – IS-IS, L1 – IS-IS level-1, L2 – IS-IS level-2, ia – IS-IS inter area

* – candidate default, U – per-user static route, o – ODR

P – periodic downloaded static route

Gateway of last resort is not set

C 192.168.10.0/24 is directly connected, FastEthernet0/1

C 192.168.20.0/24 is directly connected, FastEthernet0/0

S 192.168.30.0/24 [1/0] via 192.168.20.20


R1#show ip route

Codes: C – connected, S – static, I – IGRP, R – RIP, M – mobile, B – BGP

D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area

N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2

E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGP

i – IS-IS, L1 – IS-IS level-1, L2 – IS-IS level-2, ia – IS-IS inter area

* – candidate default, U – per-user static route, o – ODR

P – periodic downloaded static route

Gateway of last resort is not set

C 192.168.10.0/24 is directly connected, FastEthernet0/1

C 192.168.20.0/24 is directly connected, FastEthernet0/0

S 192.168.30.0/24 [1/0] via 192.168.20.20


4.PC之间进行PING测试

在这里插入图片描述

在这里插入图片描述

数据正常通信,静态路由配置成功



总结


关键点:理解静态路由命令:ip route + 目的地址+下一跳地址

下一跳地址的确定(源地址设备直连路由器到对端设备的直连接口作为下一跳地址)



版权声明:本文为qq_44526151原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。