首页 > 编程知识 正文

思科如何配置静态路由,静态路由与默认路由配置实验

时间:2023-05-04 00:03:24 阅读:136310 作者:4398

静态路由配置实验2 (通过三台路由设备)实验拓扑图

PC1/PC2经由三个路由进行不同网段的相互通信

配置步骤1 .路由接口ip配置

路由设备a

R1(config ) #int f0/0

R1(config-if ) #ip add 192.168.1.1 255.255.255.0

R1 (配置if ) #no shut

R1 (配置if ) #exit

R1(config ) #int fa0/1

R1(config-if ) #ip add 192.168.2.1 255.255.255.0

R1 (配置if ) #no shut

路由设备b

R2(config ) #int fa 0/0

配置if (R2 ) # IP add 192.168.2.2 255.255.255.255.0

R2(config-if ) #否shut

R2(config ) #int fa0/1

R2(config-if ) #ip add 192.168.3.1 255.255.255.0

R2(config-if ) #否shut

路由设备c

router(config ) #int fa0/0

路由器(config-if ) # IP add 192.168.3.2 255.255.255.255.0

router(config-if ) #no shut

router(config ) #int fa0/1

配置(if ) # IP add 192.168.4.1 255.255.255.255.0

router(config-if ) #no shut

2 .设置PC的静态ip地址

PC1

PC2

3 .三台路由器的静态路由配置

RA

R1(config ) # IP route 192.168.3.0255.255.255.0192.168.2.2

R1(config ) # IP route 192.168.4.0255.255.255.0192.168.3.2

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外部类型1、N2-OSPF nssa外部类型2

E1-OSPF外部类型1,E2-OSPF外部类型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

对等下载静态

Gateway of last resort is not set

c 192.168.1.0/24 isdirectlyconnected,FastEthernet0/0

c 192.168.2.0/24 isdirectlyconnected,FastEthernet0/1

s 192.168.3.0/24 [1/0] via 192.168.2.2

s 192.168.4.0/24 [1/0] via 192.168.3.2

RBR2(config ) # IP route 192.168.1.0255.255.255.0192.168.2.1

R2(config ) # IP route 192.168.4.0255.255.255.0192.168.3.2

R2#show ip rou --显示路由信息

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外部类型1、N2-OSPF nssa外部类型2

E1-OSPF外部类型1,E2-OSPF外部类型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

对等下载静态

Gateway of last resort is not set

s 192.168.1.0/24 [1/0] via 192.168.2.1

c 192.168.2.0/24 isdirectlyconnected,FastEthernet0/0

c 192.168.3.0/24 isdirectlyconnected,FastEthernet0/1

s 192.168.4.0/24 [1/0] via 192.168.3.2

RCR3(config ) # IP route 192.168.2.0255.255.255.0192.168.3.1

r3(config ) # IP route 192.168.1.0255.255.255.0192.168.2.1

R3#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外部类型1、N2-OSPF nssa外部类型2

E1-OSPF外部类型1,E2-OSPF外部类型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

对等下载静态

Gateway of last resort is not set

s 192.168.1.0/24 [1/0] via 192.168.2.1

s 192.168.2.0/24 [1/0] via 192.168.3.1

c 192.168.3.0/24 isdirectlyconnected,FastEthernet0/0

c 192.168.4.0/24 isdirectlyconnected,FastEthernet0/1

4 .要测试路由器之间连接的RA ping RBRC接口地址

RB PingRARC接口地址

RC PingRARB接口地址

数据包正常发送

5 .测试pc机是否互通成功

pc1 ping pc2网卡的ip地址

pc2 ping pc1 ip地址

静态路由配置成功

归纳要点:

在配置过程中,请注意路由器b将路由器a连接到路由器b作为桥梁,并在a和b方向上设置静态路由器,静态路由按一跳进行寻址,不能直接从a到c。 只能先去b,然后从b去c。 因此,添加根a和c的静态路由时,必须注意下一跳地址从最近的根b开始

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。