CCNA之旅-rip协议1
拓扑如上图:
1、配置ROUTER0和ROUTER1
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip domain-loo
Router(config)#no ip domain-lookup
Router(config)#hostname r1
r1(config)#line console 0
r1(config-line)#no exec-timeout
r1(config-line)#logging synchronous
r1(config-line)#exit
r1(config)#int f0/0
r1(config-if)#ip add 192.168.172.16.1.1 255.255.0.0
r1(config-if)#ip add 172.16.1.1 255.255.0.0
r1(config-if)#no shut
r1(config-if)#int lo0
r1(config-if)#ip add 10.1.1.1 255.0.0.0
r1(config-if)#no shut
r1(config)#int s1/0
r1(config-if)#ip add 192.168.12.1 255.255.255.0
r1(config-if)#no shut
r1(config-if)#end
r1#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.16.1.1 YES manual up up
Serial1/0 192.168.12.1 YES manual up up
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 10.1.1.1 YES manual up up
r1#
r1#
r1#
r1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r1(config)#router rip
r1(config-router)#network 172.16.0.0
r1(config-router)#network 192.168.12.0
r1(config-router)#network 10.0.0.0
r1(config-router)#end
2、配置ROUTER1
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip domain-lookup
Router(config)#hostname r2
r2(config)#int s1/0
r2(config-if)#ip add 192.168.12.2 255.255.255.0
r2(config-if)#no shut
r2(config-if)#exit
r2(config)#line console 0
r2(config-line)#logging
r2(config-line)#logging syn
r2(config-line)#logging synchronous
r2(config-line)#no exec-timeout
r2(config-line)#end
r2#
r2#ping 192.168.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 136/152/192 ms
r2#
r2#
r2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#int lo0
r2(config-if)#ip add 2.2.2.2 255.0.0.0
r2(config-if)#no shut
r2(config-if)#end
r2#
r2#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 192.168.12.2 YES manual up up
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 2.2.2.2 YES manual up up
r2#
r2#
r2#
r2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#router rip
r2(config-router)#networ
r2(config-router)#network 192.168.12.0
r2(config-router)#network 2.0.0.0
r2(config-router)#end
3、开启检测RIP进程
r1#debug ip rip
RIP protocol debugging is on
r1#
00:06:20: RIP: sending v1 update to 255.255.255.255 via FastEthernet0/0 (172.16.1.1)
00:06:20: RIP: build update entries
00:06:20: network 2.0.0.0 metric 2
00:06:20: network 10.0.0.0 metric 1
00:06:20: network 192.168.12.0 metric 1
00:06:20: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.12.1)
00:06:20: RIP: build update entries
00:06:20: network 10.0.0.0 metric 1
00:06:20: network 172.16.0.0 metric 1
00:06:20: RIP: sending v1 update to 255.255.255.255 via Loopback0 (10.1.1.1)
00:06:20: RIP: build update entries
00:06:20: network 2.0.0.0 metric 2
00:06:20: network 172.16.0.0 metric 1
00:06:20: network 192.168.12.0 metric 1
r1#
00:06:31: RIP: received v1 update from 192.168.12.2 on Serial1/0
00:06:31: 2.0.0.0 in 1 hops
不需要向这些借口发送路由更新,因为它西面没有连接路由器,我们可一设置这些借口为被动接口
r1(config)#router rip
r1(config-router)#pas
r1(config-router)#passive-interface f0/0
r1(config-router)#passive-interface
00:07:42: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.12.1)
00:07:42: RIP: build update entries
00:07:42: network 10.0.0.0 metric 1
00:07:42: network 172.16.0.0 metric 1
00:07:42: RIP: sending v1 update to 255.255.255.255 via Loopback0 (10.1.1.1)
00:07:42: RIP: build update entries
00:07:42: network 2.0.0.0 metric 2
00:07:42: network 172.16.0.0 metric 1
00:07:42: network 192.168.12.0 metric 1
看看效果马上就出来了!接着设置回环借口也为被动接口
r1(config-router)#passive-interface lo0
r1(config-router)#end
r1#
00:07:48: %SYS-5-CONFIG_I: Configured from console by console
r1#
00:07:57: RIP: received v1 update from 192.168.12.2 on Serial1/0
00:07:57: 2.0.0.0 in 1 hops
r1#
00:08:10: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.12.1)
00:08:10: RIP: build update entries
00:08:10: network 10.0.0.0 metric 1
00:08:10: network 172.16.0.0 metric 1
r1#
00:08:24: RIP: received v1 update from 192.168.12.2 on Serial1/0
00:08:24: 2.0.0.0 in 1 hops
被动接口只能接收路由更新,不能以广播或者组播的方式发送路由更新,但是可以以单播的方式发送路由更新,
命令如下:r1(conf-rotuer)#neighbor A.B.C.D
如上图我们的网络场景,
路由R1,只想把路由更新发送到R3上,但是默认情况下,RIP 1是以广播的方式更新路由信息的,所以R1发送的路由更新会在整个局域网中广播。我们可以把R1的接口G0/0配置成被动接口让后再让R1进行单播更新指定到R3上,配置如下:
r1(config-rotuer)#router rip
r1(config-rotuer)#passive-interfce g0/0
r1(config-rotuer)#neighbor 172.16.1.3
配置rip v2
转载于:https://blog.51cto.com/crazyguming/407757