教育资源为主的文档平台

当前位置: 查字典文档网> 所有文档分类> > 计算机硬件及网络> 静态路由配置

静态路由配置

上传者:田雯
|
上传时间:2015-05-07
|
次下载

静态路由配置

静态路由配置

路由器属于网络层设备,能够根据IP包头的信息,选择一条最佳路径,将数据包转发出去。实现不同网段的主机之间的互相访问。 路由器是根据路由表进行选路和转发的。而路由表里就是由一条条的路由信息组成。路由表实的产生方式一般有3种: 1.直连路由 给路由器接口配置一个IP地址,路验由器自动产生本接口IP所在网段的路由信息。 2.静态路由 在拓扑结构简原单的网络中,网管员通过手工的方式配置本路由器未知网段的路由信息,从理 而实现不同网段之间的连接。 3.动态路由协议学习产生的路由 在大规模的网络中,或网络拓扑相对复杂的情况下,通过在路由器上运行动态路由协议,路由器之间互相自动学习产生路由信息。

第一步:配置路由器的名称、接口IP地址和时钟

R3740#configure terminal

Enter configuration commands, one per line. End with CNTL/Z. R3740(config)#hostname RouterA

!配置路由器的名称

RouterA(config)#

RouterA(config)#interface serial 4/0

!进入端口S4/0的接口配置模式

RouterA(config-if)#clock rate 512000

!设置串口的时钟

RouterA(config-if)#ip address 192.168.1.1 255.255.255.0

!设置端口的IP地址

RouterA(config-if)#no shutdown

!开启端口

RouterA(config-if)#exit 实RouterA(config)# 验RouterA(config)#interface loopback 0 内!设置Loopback端口用于测试 容 RouterA(config-if)#Sep 15 01:05:02 RouterA %7:%LINE PROTOCOL CHANGE: Interface Loopback 0, changed state to UP

RouterA(config-if)#ip address 172.16.1.1 255.255.255.0

RouterA(config-if)#exit

RouterA(config)#

RouterA(config)#interface loopback 1

RouterA(config-if)#Sep 15 01:05:31 RouterA %7:%LINE PROTOCOL CHANGE: Interface Loopback 1, changed state to UP

RouterA(config-if)#ip address 172.16.2.1 255.255.255.0

RouterA(config-if)#exit

R3740#configure terminal

Enter configuration commands, one per line. End with CNTL/Z. R3740 (config)#hostname RouterB

RouterB(config)#

RouterB(config)#interface serial 4/0

RouterB(config-if)#ip address 192.168.1.2 255.255.255.0

RouterB(config-if)#no shutdown

RouterB(config-if)#exit

RouterB(config)#

RouterB(config)#interface loopback 0

RouterB(config-if)#Aug 22 03:03:36 RouterB %7:%LINE PROTOCOL CHANGE: Interface Loopback 0, changed state to UP

RouterB(config-if)#ip address 10.1.1.1 255.255.255.0

RouterB(config-if)#exit

RouterB(config)#

RouterB(config)#interface loopback 1

RouterB(config-if)#Aug 22 03:04:03 RouterB %7:%LINE PROTOCOL CHANGE: Interface Loopback 1, changed state to UP

RouterB(config-if)#ip address 10.2.2.1 255.255.255.0

RouterB(config-if)#exit

第二步:配置静态路由

RouterA(config)#ip route 10.1.1.0 255.255.255.0 192.168.1.2 !设置到子网10.1.1.0的静态路由,采用下一跳的方式

RouterA(config)#ip route 10.2.2.0 255.255.255.0 s4/0

!设置到子网10.2.2.0的静态路由,采用出站端口的方式

RouterB(config)#ip route 172.16.1.0 255.255.255.0 192.168.1.1 RouterB(config)#ip route 172.16.2.0 255.255.255.0 s4/0

第三步:查看路由表和接口配置

RouterA#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

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

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

* - candidate default

Gateway of last resort is no set

S 10.1.1.0/24 [1/0] via 192.168.1.2

S 10.2.2.0/24 is directly connected, serial 4/0

C 172.16.1.0/24 is directly connected, Loopback 0

C 172.16.1.1/32 is local host.

C 172.16.2.0/24 is directly connected, Loopback 1

C 172.16.2.1/32 is local host.

C 192.168.1.0/24 is directly connected, serial 4/0

C 192.168.1.1/32 is local host.

!可以看到以下一跳方式配置的静态路由和以出站端口方式配置的静态路由,在路由表中的显示方式是不一样的

RouterA#show interfaces serial 4/0

Index(dec):1 (hex):1

serial 4/0 is UP , line protocol is UP

Hardware is Infineon DSCC4 PEB20534 H-10 serial

Interface address is: 192.168.1.1/24

MTU 1500 bytes, BW 2000 Kbit

Encapsulation protocol is HDLC, loopback not set

Keepalive interval is 10 sec , set

Carrier delay is 2 sec

RXload is 1 ,Txload is 1

Queueing strategy: WFQ

11421118 carrier transitions

V35 DCE cable

DCD=up DSR=up DTR=up RTS=up CTS=up

5 minutes input rate 19 bits/sec, 0 packets/sec

5 minutes output rate 19 bits/sec, 0 packets/sec

95 packets input, 4134 bytes, 0 no buffer, 1 dropped

Received 69 broadcasts, 0 runts, 0 giants

0 input errors, 0 CRC, 0 frame, 0 overrun, 0 abort

94 packets output, 4118 bytes, 0 underruns , 0 dropped

0 output errors, 0 collisions, 0 interface resets

RouterB#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

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

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

* - candidate default

Gateway of last resort is no set

C 10.1.1.0/24 is directly connected, Loopback 0

C 10.1.1.1/32 is local host.

C 10.2.2.0/24 is directly connected, Loopback 1

C 10.2.2.1/32 is local host.

S 172.16.1.0/24 [1/0] via 192.168.1.1

S 172.16.2.0/24 is directly connected, serial 4/0

C 192.168.1.0/24 is directly connected, serial 4/0

C 192.168.1.2/32 is local host.

RouterB#show interfaces serial 4/0

Index(dec):1 (hex):1

serial 4/0 is UP , line protocol is UP

Hardware is Infineon DSCC4 PEB20534 H-10 serial

Interface address is: 192.168.1.2/24

MTU 1500 bytes, BW 2000 Kbit

Encapsulation protocol is HDLC, loopback not set

Keepalive interval is 10 sec , set

Carrier delay is 2 sec

RXload is 1 ,Txload is 1

Queueing strategy: WFQ

11421118 carrier transitions

V35 DTE cable

DCD=up DSR=up DTR=up RTS=up CTS=up

5 minutes input rate 74 bits/sec, 0 packets/sec

5 minutes output rate 74 bits/sec, 0 packets/sec

86 packets input, 3942 bytes, 0 no buffer, 0 dropped

Received 61 broadcasts, 0 runts, 0 giants

0 input errors, 0 CRC, 0 frame, 0 overrun, 0 abort

87 packets output, 3964 bytes, 0 underruns , 0 dropped

0 output errors, 0 collisions, 1 interface resets

第四步:测试网络连通性

RouterA#ping 10.1.1.1

Sending 5, 100-byte ICMP Echoes to 10.1.1.1, timeout is 2 seconds: < press Ctrl+C to break >

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms

RouterA#ping 10.2.2.1

Sending 5, 100-byte ICMP Echoes to 10.2.2.1, timeout is 2 seconds: < press Ctrl+C to break >

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms

RouterB#ping 172.16.1.1

Sending 5, 100-byte ICMP Echoes to 172.16.1.1, timeout is 2 seconds: < press Ctrl+C to break >

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms

RouterB#ping 172.16.2.1

Sending 5, 100-byte ICMP Echoes to 172.16.2.1, timeout is 2 seconds: < press Ctrl+C to break >

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms

【注意事项】

1、 如果两台路由器通过串口直接互连,则必须在其中一端设置时钟频率(DCE)。

2、 静态路由必须双向都配置才能互通,配置时注意回程路由。

【参考配置】

RouterA#show running-config

Building configuration...

Current configuration : 745 bytes

!

version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 21:16:17 CST 2007 -ubu1server)

hostname RouterA

!

!

interface serial 4/0

ip address 192.168.1.1 255.255.255.0

clock rate 512000

!

interface serial 4/1

clock rate 64000

!

interface GigabitEthernet 0/0

duplex auto

speed auto

!

interface GigabitEthernet 0/1

duplex auto

speed auto

!

interface Loopback 0

ip address 172.16.1.1 255.255.255.0

!

interface Loopback 1

ip address 172.16.2.1 255.255.255.0

!

ip route 10.1.1.0 255.255.255.0 192.168.1.2

ip route 10.2.2.0 255.255.255.0 serial 4/0

!

line con 0

line aux 0

line vty 0 4

login

!

end

RouterB#show running-config

Building configuration...

Current configuration : 725 bytes

!

version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 21:16:17 CST 2007 -ubu1server)

版权声明:此文档由查字典文档网用户提供,如用于商业用途请与作者联系,查字典文档网保持最终解释权!

下载文档

热门试卷

2016年四川省内江市中考化学试卷
广西钦州市高新区2017届高三11月月考政治试卷
浙江省湖州市2016-2017学年高一上学期期中考试政治试卷
浙江省湖州市2016-2017学年高二上学期期中考试政治试卷
辽宁省铁岭市协作体2017届高三上学期第三次联考政治试卷
广西钦州市钦州港区2016-2017学年高二11月月考政治试卷
广西钦州市钦州港区2017届高三11月月考政治试卷
广西钦州市钦州港区2016-2017学年高一11月月考政治试卷
广西钦州市高新区2016-2017学年高二11月月考政治试卷
广西钦州市高新区2016-2017学年高一11月月考政治试卷
山东省滨州市三校2017届第一学期阶段测试初三英语试题
四川省成都七中2017届高三一诊模拟考试文科综合试卷
2017届普通高等学校招生全国统一考试模拟试题(附答案)
重庆市永川中学高2017级上期12月月考语文试题
江西宜春三中2017届高三第一学期第二次月考文科综合试题
内蒙古赤峰二中2017届高三上学期第三次月考英语试题
2017年六年级(上)数学期末考试卷
2017人教版小学英语三年级上期末笔试题
江苏省常州西藏民族中学2016-2017学年九年级思想品德第一学期第二次阶段测试试卷
重庆市九龙坡区七校2016-2017学年上期八年级素质测查(二)语文学科试题卷
江苏省无锡市钱桥中学2016年12月八年级语文阶段性测试卷
江苏省无锡市钱桥中学2016-2017学年七年级英语12月阶段检测试卷
山东省邹城市第八中学2016-2017学年八年级12月物理第4章试题(无答案)
【人教版】河北省2015-2016学年度九年级上期末语文试题卷(附答案)
四川省简阳市阳安中学2016年12月高二月考英语试卷
四川省成都龙泉中学高三上学期2016年12月月考试题文科综合能力测试
安徽省滁州中学2016—2017学年度第一学期12月月考​高三英语试卷
山东省武城县第二中学2016.12高一年级上学期第二次月考历史试题(必修一第四、五单元)
福建省四地六校联考2016-2017学年上学期第三次月考高三化学试卷
甘肃省武威第二十三中学2016—2017学年度八年级第一学期12月月考生物试卷

网友关注视频

冀教版英语五年级下册第二课课程解读
沪教版牛津小学英语(深圳用) 五年级下册 Unit 12
第19课 我喜欢的鸟_第一课时(二等奖)(人美杨永善版二年级下册)_T644386
30.3 由不共线三点的坐标确定二次函数_第一课时(市一等奖)(冀教版九年级下册)_T144342
冀教版英语四年级下册第二课
【部编】人教版语文七年级下册《过松源晨炊漆公店(其五)》优质课教学视频+PPT课件+教案,江苏省
《小学数学二年级下册》第二单元测试题讲解
二年级下册数学第一课
苏科版数学七年级下册7.2《探索平行线的性质》
冀教版小学数学二年级下册第二单元《有余数除法的整理与复习》
三年级英语单词记忆下册(沪教版)第一二单元复习
19 爱护鸟类_第一课时(二等奖)(桂美版二年级下册)_T502436
冀教版小学数学二年级下册1
每天日常投篮练习第一天森哥打卡上脚 Nike PG 2 如何调整运球跳投手感?
第4章 幂函数、指数函数和对数函数(下)_六 指数方程和对数方程_4.7 简单的指数方程_第一课时(沪教版高一下册)_T1566237
冀教版小学英语五年级下册lesson2教学视频(2)
飞翔英语—冀教版(三起)英语三年级下册Lesson 2 Cats and Dogs
冀教版小学英语四年级下册Lesson2授课视频
外研版英语三起5年级下册(14版)Module3 Unit2
第五单元 民族艺术的瑰宝_16. 形形色色的民族乐器_第一课时(岭南版六年级上册)_T3751175
沪教版牛津小学英语(深圳用)五年级下册 Unit 1
北师大版数学四年级下册3.4包装
【部编】人教版语文七年级下册《泊秦淮》优质课教学视频+PPT课件+教案,广东省
沪教版牛津小学英语(深圳用) 五年级下册 Unit 7
3月2日小学二年级数学下册(数一数)
沪教版八年级下册数学练习册21.3(2)分式方程P15
冀教版小学数学二年级下册第二单元《余数和除数的关系》
苏科版八年级数学下册7.2《统计图的选用》
外研版英语三起6年级下册(14版)Module3 Unit1
【部编】人教版语文七年级下册《过松源晨炊漆公店(其五)》优质课教学视频+PPT课件+教案,辽宁省