如何给三层交换机配置rip路由

如何给三层交换机配置rip路由,第1张

假设校园网通过一台三层交换机连到校园网出口路由器上,要怎么配置rip路由呢下面由我为你整理了如何给三层交换机配置rip路由的相关方法,希望对你有帮助!
三层交换机配置rip路由的方法和步骤如下
建立建立packet tracer拓扑图

在三层交换机上划分VLAN10和VLAN20,其中VLAN10用于连接校园网主机,VLAN20用于连接R1

路由器之间通过V35电缆通过串口连接,DCE端连接在R1上,配置其时钟频率64000。

主机和交换机通过直连线,主机与路由器通过交叉线连接。

在S3560上配置RIPV2路由协议。

在路由器R1、R2上配置RIPV2路由协议。

将PC1、PC2主机默认网关设置为与直连网路设备接口IP地址。

PC1

IP: 19216812

Submask: 2552552550

Gateway: 19216811

PC2

IP: 19216822

Submask: 2552552550

Gateway: 19216821

验证PC1、PC2主机之间可以互相同信;




1 新版斐讯pto路由器的设置教程

2 斐讯fir303c路由器怎么设置上网

3 在三层交换机配置DHCP的方法

4 tp450g路由器怎么设置与三层交换机对接

5 路由器多网段NAT实现与三层交换机对接怎么设置

接口IP配置(如图标示IP)

RT1(config)#int e3/0        (e3/0的IP配置)

RT1(config-if)#ip add 192168201 2552552550

RT1(config-if)#no shut     (激活接口)

RT1(config-if)#no keepalive (将接口置为不保活,即无论有没有保活信息该接口都可以出于“活”的状态)

RT1(config)#int e3/1        (e3/1的IP配置)

RT1(config-if)#ip add 192168211 2552552550

RT1(config-if)#no shut

RT1(config-if)#no keepalive

RT1(config)#int f2/0         (f2/0的IP配置)

RT1(config-if)#ip add 19216829 255255255248

RT1(config-if)#no shut

RT1(config)#int s0/2         (s0/2的配置)

RT1(config-if)#encapsulation hdlc   (S口需要封装一种广域网协议,此处均封装hdlc)

RT1(config-if)#clock rate 1000000  (设置时钟频率,只设置链路的一段即可)

RT1(config-if)#ip add 19216819 255255255252(配置IP)

RT1(config-if)#no shut

RT1(config)#int s0/0         (s0/0的配置)

RT1(config-if)#en hd

RT1(config-if)#en hdlc

RT1(config-if)#clock r 1000000

RT1(config-if)#ip add 19216811 255255255252

RT1(config-if)#no shut

RT1(config)#int s0/1         (s0/1的配置)

RT1(config-if)#en hd

RT1(config-if)#en hdlc

RT1(config-if)#ip add 19216815 255255255252

RT1(config-if)#no shu

RT3、RT5、RT7的IP配置就不多写了,很简单,按照图示配置即可,S口注意封装hdlc协议,如果对端配置了时钟频率那另一端就不用再配置时钟频率了。

三、RIP信息配置

RT1(config)#router rip (开启RIP)

RT1(config-router)#version 2(设置为版本2,版本2是无类路由,传播路由时会携带接口掩码,版本1基本不再用了)

RT1(config-router)#no auto-summary(关闭RIP的自动汇总功能)

RT1(config-router)#network 192168200  (通告发布的网段,下几句命令也是这样)

RT1(config-router)#network 192168210

RT1(config-router)#network 19216810

RT1(config-router)#network 19216814

RT1(config-router)#network 19216818

RT1(config-router)#passive-interface default(将RT1的所有接口置为被动接口,置为被动接口后就不会从这个接口向外传播RIP路由信息了)

RT1(config-router)#no passive-interface s0/0(将需要传播路由的接口设置为“no”被动,即,可以从这个接口发出路由信息,下面几句命令类似)

RT1(config-router)#no passive-interface s0/1

RT1(config-router)#no passive-interface s0/2

RT3(config)#router rip

RT3(config-router)#version 2

RT3(config-router)#no auto-summary

RT3(config-router)#net 192168360

RT3(config-router)#net 192168370

RT3(config-router)#net 19216810

RT3(config-router)#net 19216814

RT3(config-router)#passive-interface default

RT3(config-router)#no passive-interface s0/0

RT3(config-router)#no passive-interface s0/1

RT5(config)#router rip

RT5(config-router)#version 2

RT5(config-router)#no auto-summary

RT5(config-router)#net 19216818

RT5(config-router)#net 192168448

RT5(config-router)#passive-interface default

RT5(config-router)#no passive-interface s0/0

四、其他路由配置(使RIP可以与没有运行RIP的那部分连通)

RT7(config)#ip route 19216800 25525500 19216829  (RT7上配置通往RIP区域的静态路由)

RT1(config)#ip route 0000 0000  192168210   (在RT1上配置缺省路由通往外部区域)

RT1(config)#router rip     (进入RIP配置子模式)

RT1(config-router)#default-information originate           (对RIP区域下发下发缺省路由)

五、在设备上查看各自的路由表

在RT1上 show  ip  route

R    192168440/24 [120/1] via 192168110, 00:00:18, Serial0/2

C    192168210/24 is directly connected, Ethernet3/1

C    192168200/24 is directly connected, Ethernet3/0

R    192168360/24 [120/1] via 19216816, 00:00:14, Serial0/1

[120/1] via 19216812, 00:00:09, Serial0/0

R    192168370/24 [120/1] via 19216816, 00:00:14, Serial0/1

[120/1] via 19216812, 00:00:09, Serial0/0

19216810/30 is subnetted, 3 subnets

C       19216818 is directly connected, Serial0/2

C       19216810 is directly connected, Serial0/0

C       19216814 is directly connected, Serial0/1

19216820/29 is subnetted, 1 subnets

C       19216828 is directly connected, FastEthernet2/0

S   0000/0 [1/0] via 192168210

R代表RIP学到的路由,C代表直连路由,S代表静态且为缺省的路由。

在RT3上show  ip  route

R    192168440/24 [120/2] via 19216815, 00:00:08, Serial0/1

[120/2] via 19216811, 00:00:14, Serial0/0

R    192168210/24 [120/1] via 19216815, 00:00:08, Serial0/1

[120/1] via 19216811, 00:00:14, Serial0/0

R    192168200/24 [120/1] via 19216815, 00:00:08, Serial0/1

[120/1] via 19216811, 00:00:14, Serial0/0

C    192168360/24 is directly connected, Ethernet3/0

C    192168370/24 is directly connected, Ethernet3/1

19216810/30 is subnetted, 3 subnets

R       19216818 [120/1] via 19216815, 00:00:08, Serial0/1

[120/1] via 19216811, 00:00:14, Serial0/0

C       19216810 is directly connected, Serial0/0

C       19216814 is directly connected, Serial0/1

R   0000/0 [120/1] via 19216815, 00:00:08, Serial0/1

[120/1] via 19216811, 00:00:14, Serial0/0

R代表RIP下发缺省路由得到的路由条目,这条路由指向的地方就是下发缺省路由的设备。

在RT5上show  ip  route

C    192168440/24 is directly connected, Ethernet3/0

R    192168210/24 [120/1] via 19216819, 00:00:21, Serial0/0

R    192168200/24 [120/1] via 19216819, 00:00:21, Serial0/0

R    192168360/24 [120/2] via 19216819, 00:00:21, Serial0/0

R    192168370/24 [120/2] via 19216819, 00:00:21, Serial0/0

19216810/30 is subnetted, 3 subnets

C       19216818 is directly connected, Serial0/0

R       19216810 [120/1] via 19216819, 00:00:21, Serial0/0

R       19216814 [120/1] via 19216819, 00:00:21, Serial0/0

R   0000/0 [120/1] via 19216819, 00:00:21, Serial0/0

在RT7上show  ip  route

2022022020/29 is subnetted, 1 subnets

C       202202202200 is directly connected, FastEthernet1/0

19216820/29 is subnetted, 1 subnets

C       19216828 is directly connected, FastEthernet2/0

S    19216800/16 [1/0] via 19216829

在三层交换机上配置RIP路由协议,以三层交换机代替路由器。

通过RIP实现路由间通信

动态路由协议配置灵活,路由器会发送自身的路由信息给其他路由器,同时也会接收其他路由器发来的路由信息建立自己的路由表。这样在路由器上就不必像静态路由那样为每个目标地址都配置路由,因为路由器可以通过协议学习这些路由。网络拓扑改变,路由信息也会自动更新,无需管理员干预。

Switch(config)#interface f0/6

Switch(config-if)#no switchport

Switch(config-if)#ip address 19216861 2552552550

Switch(config-if)#no shutdown

RIP路由协议在配置network时,只需要配置该路由器所直连的主类网络,不与该路由器直连的网络不需要包含在network中。

RIP默认工作在第一版本下,但是RIP-V1是有类路由协议,而且通过广播的方式进行路由更新,无论是功能上还是效率上都有一些缺陷,这些缺陷RIP-V2可以弥补。在使用时建议采用RIP-V2而不是RIP-V1。

tarenasw-3L(config)#router rip

tarenasw-3L(config-router)#version 2

tarenasw-3L(config-router)#no auto-summary

tarenasw-3L(config-router)#network 19216810

tarenasw-3L(config-router)#network 19216820

tarenasw-3L(config-router)#network 19216830

tarenasw-3L(config-router)#network 19216840

tarenasw-3L(config-router)#network 19216850

tarenasw-3L(config-router)#network 19216860

tarena-router(config)#router rip

tarena-router(config-router)#version 2

tarenasw-3L(config-router)#no auto-summary

tarena-router(config-router)#network 19216860

tarena-router(config-router)#network 19216870

注意以R开头的路由,这些路由表示通过RIP协议从其他运行RIP的路由器学习过来的路由。每条路由都写明了目标网络、下一跳IP地址以及从自己哪个端口发出去。

tarenasw-3L#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 19216810/24 is directly connected, Vlan1

C 19216820/24 is directly connected, Vlan2

C 19216830/24 is directly connected, Vlan3

C 19216840/24 is directly connected, Vlan4

C 19216850/24 is directly connected, Vlan5

C 19216860/24 is directly connected, FastEthernet0/6

R 19216870/24 [120/1] via 19216862, 00:00:12, FastEthernet0/6 0

Router#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

R 19216810/24 [120/1] via 19216861, 00:00:25, FastEthernet0/0

R 19216820/24 [120/1] via 19216861, 00:00:25, FastEthernet0/0

R 19216830/24 [120/1] via 19216861, 00:00:25, FastEthernet0/0

R 19216840/24 [120/1] via 19216861, 00:00:25, FastEthernet0/0

R 19216850/24 [120/1] via 19216861, 00:00:25, FastEthernet0/0

C 19216860/24 is directly connected, FastEthernet0/0

C 19216870/24 is directly connected, FastEthernet0/1

5在PC上测试到五个VLAN中主机的通信

PC>ipconfig

FastEthernet0 Connection:(default port)

Link-local IPv6 Address: FE80::2E0:8FFF:FE14:BB43

IP Address: 19216871

Subnet Mask: 2552552550

Default Gateway: 1921687254

SERVER>ping 192168110

Pinging 192168110 with 32 bytes of data:

Reply from 19216811: bytes=32 time=0ms TTL=126

Reply from 19216811: bytes=32 time=0ms TTL=126

Reply from 19216811: bytes=32 time=0ms TTL=126

Reply from 19216811: bytes=32 time=1ms TTL=126

Ping statistics for 19216811:

Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

PC >ping 19216821

Pinging 192168210 with 32 bytes of data:

Reply from 19216821: bytes=32 time=0ms TTL=126

Reply from 19216821: bytes=32 time=0ms TTL=126

Reply from 19216821: bytes=32 time=0ms TTL=126

Reply from 19216821: bytes=32 time=0ms TTL=126

Ping statistics for 19216821:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 0ms, Average = 0ms

PC >ping 19216831

Pinging 192168310 with 32 bytes of data:

Reply from 19216831: bytes=32 time=1ms TTL=126

Reply from 19216831: bytes=32 time=0ms TTL=126

Reply from 19216831: bytes=32 time=0ms TTL=126

Reply from 19216831: bytes=32 time=0ms TTL=126

Ping statistics for 19216831:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

PC >

31% /misc/nfsdir SERVER>

SERVER>ping 192168310

Pinging 192168310 with 32 bytes of data:

Reply from 19216841: bytes=32 time=1ms TTL=126

Reply from 19216841: bytes=32 time=0ms TTL=126

Reply from 19216841: bytes=32 time=0ms TTL=126

Reply from 19216841: bytes=32 time=0ms TTL=126

Ping statistics for 19216841:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

31% /misc/nfsdir​

SERVER>ping 19216851

Pinging 19216851 with 32 bytes of data:

Reply from 19216851: bytes=32 time=1ms TTL=126

Reply from 19216851: bytes=32 time=0ms TTL=126

Reply from 19216851: bytes=32 time=0ms TTL=126

Reply from 19216851: bytes=32 time=0ms TTL=126

Ping statistics for 19216851:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

31% /misc/nfsdir

    RIP,routing information protocol,要求网络中每台路由器都i要维护从自身到每个目的网络的路由信息。RIP协议使用跳数来衡量网络间的“距离”。从一台路由器到其直连网络的跳数为1,从一台路由器到其非直连网络的距离定义为每经过一个路由器距离加1。RIP允许路由的最大跳数为15,16则不可达。

    RIP有两个版本,RIPv1和RIPv2。RIPv2是对RIPv1的扩充,能够携带更多信息量,并增强安全性。但都是基于UDP协议,使用UDP520端口收发数据包。

接口配置:

[R1]int e0/0/0

[R1-Ethernet0/0/0]ip address 100121 24

[R1]int LoopBack 0

[R1-LoopBack0]ip address 10011 24
[R2]int e0/0/0

[R2-Ethernet0/0/0]ip address 100122 24

[R1]int LoopBack 0

[R1-LoopBack0]ip address 10011 24

[R1]rip

[R1-rip-1]network 10000

[R2]rip

[R2-rip-1]network 10000

    运行dis ip routing-table查看路由表,两台路由器已经通过RIP协议学习到对方环回接口所在网段的路由条目。

ping对方的环回地址,可以通信。

在用户视图下,使用debuging命令查看RIP协议定期更新情况。完成后使用undo debugging rip或者undo debugging all。

<R1>debugging rip 1

<R1>terminal debugging

<R1>terminal monitor

    配置v2。

[R1]rip

[R1-rip-1]version 2

[R2]rip

[R2-rip-1]version 2

在用户视图下,使用debuging命令查看RIP协议定期更新情况。发现RIPv1与RIPv2的不同:

1、RIPv2的路由信息中携带了子网掩码;

2、RIPv2的路由信息中携带了下一跳地址,标志一个比通告路由器的地址更好的下一跳地址。它指出的地址,其度量值(跳数)比在同一个子网上的通告路由器更靠近目的地。

3、RIPv2默认采用组播方式发送报文,地址为224009

分类: 电脑/网络 >> 互联网
问题描述:

我想问一下就是为什么你在使用RIP协议的时候,可以不用子网掩码的,那如果有子网的话,怎么去区别他呢?怎么样知道它的下一跳呢?是不是每一个网段的子网掩码都要一样才可以配置RIP协议的????还是说不一样的时候就要用子网掩码了,不用子网掩码就表示他们的子网掩码都一样的!!!!!!!!!!!1

解析:

rip 有两个版本,rip1,rip2,rip1不可以发送子网掩码,它是这样来识别对方通告的网络ip的掩码的:如果对方通告的主网络和自己的接受接口的ip属于同一个主网络,那么就按本接口上的掩码作为通告的ip网段的掩码,如果主网络不同,就按对方通告的ip的分类网络的默认子网掩码作为其掩码。因而有如下结论:同一个主网络的不同子网在配置时必须采用相同的子网掩码,并且不要被其它的不同主类网络所分割(当然也可以分割,但需要再配置辅助地址),如果每个网段都是不同的主类网络那就完全没有问题了(但这样的设计很糟糕)。

这样你就可以理解为什么了,不是不用掩码,而是rip1协议在通告路由时是不携带子网掩码的,所以才有上述限制。至于你说的‘那如果有子网的话,怎么去区别他呢’

如果按上述要求的去配置,路由表中就会含有正确的子网掩码信息,这样就可以正确识别了,如果不这样做,将会出现问题。
对于rip2来说,因为在hello包中携带了子网掩码,因而他的配置没有上述限制

neork 后面跟的是分类网络。他的含义是:我的所有启用了rip的借口的ip地址都在neork后的地址范围内,但这个地址是主网络号。举例:一个路由器有三个接口:192168122/30,192168133/27,172166567/18

那么neork命令应该有两条:

neork 19216810

neork 1721600

当然关于这方面的细节问题还有很多,你如果还有不明白的地方可以问我。现在很难想象还有用rip协议的,如果你是在学习那就罢了,如果使用在实际工作中,那我并不推荐你使用。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/13324694.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-15
下一篇 2023-07-15

发表评论

登录后才能评论

评论列表(0条)

保存