cisco Switching-三层交换配置RIP动态路由

 问题

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

通过RIP实现路由间通信

 方案

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

拓扑图

步骤

1.按拓扑图配置路由接口IP分别

2.在交换机上配置

Switch(config)#interface f0/6

Switch(config-if)#no switchport

Switch(config-if)#ip address 192.168.6.1 255.255.255.0

Switch(config-if)#no shutdown

3.分别在三层交换机和路由器上配置RIP路由协议

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 192.168.1.0

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

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

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

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

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

tarena-router(config)#router rip

tarena-router(config-router)#version 2

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

tarena-router(config-router)#network 192.168.6.0

tarena-router(config-router)#network 192.168.7.0

4.分别在三层交换机和路由器上查看路由表

注意以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 192.168.1.0/24 is directly connected, Vlan1

C 192.168.2.0/24 is directly connected, Vlan2

C 192.168.3.0/24 is directly connected, Vlan3

C 192.168.4.0/24 is directly connected, Vlan4

C 192.168.5.0/24 is directly connected, Vlan5

C 192.168.6.0/24 is directly connected, FastEthernet0/6

R 192.168.7.0/24 [120/1] via 192.168.6.2, 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 192.168.1.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0

R 192.168.2.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0

R 192.168.3.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0

R 192.168.4.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0

R 192.168.5.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0

C 192.168.6.0/24 is directly connected, FastEthernet0/0

C 192.168.7.0/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......................: 192.168.7.1

Subnet Mask.....................: 255.255.255.0

Default Gateway.................: 192.168.7.254

SERVER>ping 192.168.1.10

Pinging 192.168.1.10 with 32 bytes of data:

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

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

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

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

Ping statistics for 192.168.1.1:

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

Approximate round trip times in milli-seconds:

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

PC >ping 192.168.2.1

Pinging 192.168.2.10 with 32 bytes of data:

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

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

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

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

Ping statistics for 192.168.2.1:

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

Approximate round trip times in milli-seconds:

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

PC >ping 192.168.3.1

Pinging 192.168.3.10 with 32 bytes of data:

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

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

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

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

Ping statistics for 192.168.3.1:

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 192.168.3.10

Pinging 192.168.3.10 with 32 bytes of data:

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

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

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

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

Ping statistics for 192.168.4.1:

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 192.168.5.1

Pinging 192.168.5.1 with 32 bytes of data:

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

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

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

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

Ping statistics for 192.168.5.1:

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

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 199,902评论 5 468
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,037评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 146,978评论 0 332
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 53,867评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 62,763评论 5 360
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,104评论 1 277
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,565评论 3 390
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,236评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,379评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,313评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,363评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,034评论 3 315
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,637评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,719评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,952评论 1 255
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,371评论 2 346
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 41,948评论 2 341

推荐阅读更多精彩内容