本章4点配置
1、RIPv1基本配置
2、RIPv2基本配置
3、RIPv2扩展配置
4、RIP路由引入静态路由
拓扑如下:
IP地址规划
设备 | 接口 | IP地址 | 子网掩码 | 默认网关 | AR1 | S1/0 | 192.168.12.1 | 255.255.25N/A | N/A | S3/0 | 192.168.13.1 | 255.255.255.0 | N/A | Loopback 0 | 192.168.1.1 | 255.255.255.0 | N/A | AR2 | S1/0 | 192.168.12.2 | 255.255.255.0 | N/A | S2/0 | 192.168.23.2 | 255.255.255.0 | N/A | Loopback 0 | 192.168.2.2 | 255.255.255.0 | N/A | AR3 | S2/0 | 192.168.23.3 | 255.255.255.0 | N/A | S3/0 | 192.168.13.3 | 255.255.255.0 | N/A | Loopback 0 | 192.168.3.3 | 255.255.255.0 | N/A |
1、RIPv1基本配置
配置接口IP地址
AR1配置
[AR1]interface Serial 1/0 //进入接口
[AR1-Serial1/0]ip address 192.168.12.1 24 //配置IP地址
[AR1-Serial1/0]undo shutdown //启用接口
[AR1]interface Serial 3/0 //进入接口
[AR1-Serial3/0]ip address 192.168.13.1 24 //配置IP地址
[AR1-Serial3/0]undo shutdown //启用接口
[AR1]interface LoopBack 0 //进入接口
[AR1-LoopBack0]ip address 192.168.1.1 24 //配置IP地址
AR2配置
[AR2]interface Serial 1/0 //进入接口
[AR2-Serial1/0]ip address 192.168.12.2 24 //配置IP地址
[AR2-Serial1/0]undo shutdown //启用接口
[AR2]interface Serial 2/0 //进入接口
[AR2-Serial2/0]ip address 192.168.23.2 24 //配置IP地址
[AR2-Serial2/0]undo shutdown //启用接口
[AR2]interface LoopBack 0 //进入接口
[AR2-LoopBack0]ip address 192.168.2.2 24 //配置IP地址
AR3配置
[AR3]interface Serial 2/0 //进入接口
[AR3-Serial2/0]ip address 192.168.23.3 24 //配置IP地址
[AR3-Serial2/0]undo shutdown //启用接口
[AR3]interface Serial 3/0 //进入接口
[AR3-Serial3/0]ip address 192.168.13.3 24 //配置IP地址
[AR3-Serial3/0]undo shutdown //启用接口
[AR3]interface LoopBack 0 //进入接口
[AR3-LoopBack0]ip address 192.168.3.3 24 //配置IP地址
?配置RIPv1
RIPv1配置
AR1
[AR1]rip //进入rip视图
[AR1-rip-1]network 192.168.12.0 //宣告网段
[AR1-rip-1]network 192.168.13.0 //宣告网段
[AR1-rip-1]network 192.168.1.0 //宣告网段
RIPv1配置
AR2
[AR2]rip //进入rip视图
[AR2-rip-1]network 192.168.12.0 //宣告网段
[AR2-rip-1]network 192.168.23.0 //宣告网段
[AR2-rip-1]network 192.168.2.0 //宣告网段
RIPv1配置
AR3
[AR3]rip //进入rip视图
[AR3-rip-1]network 192.168.13.0 //宣告网段
[AR3-rip-1]network 192.168.23.0 //宣告网段
[AR3-rip-1]network 192.168.3.0 //宣告网段
查看路由表
AR1路由表
[AR1]display ip routing-table
Destinations : 25 Routes : 26
Destination/Mask Proto Pre Cost NextHop Interface
192.168.1.0/32 Direct 0 0 192.168.1.1 Loop0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.255/32 Direct 0 0 192.168.1.1 Loop0
192.168.2.0/24 RIP 100 1 192.168.12.2 Ser1/0
192.168.3.0/24 RIP 100 1 192.168.13.3 Ser3/0
192.168.12.0/24 Direct 0 0 192.168.12.1 Ser1/0
192.168.12.0/32 Direct 0 0 192.168.12.1 Ser1/0
192.168.23.0/24 RIP 100 1 192.168.12.2 Ser1/0
AR2路由表
[AR2]display ip routing-table
Destinations : 25 Routes : 26
Destination/Mask Proto Pre Cost NextHop Interface
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 RIP 100 1 192.168.12.1 Ser1/0
192.168.2.255/32 Direct 0 0 192.168.2.2 Loop0
192.168.3.0/24 RIP 100 1 192.168.23.3 Ser2/0
192.168.12.255/32 Direct 0 0 192.168.12.2 Ser1/0
192.168.13.0/24 RIP 100 1 192.168.12.1 Ser1/0
AR3路由表
[AR3]display ip routing-table
Destinations : 25 Routes : 26
Destination/Mask Proto Pre Cost NextHop Interface
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 RIP 100 1 192.168.13.1 Ser3/0
192.168.2.0/24 RIP 100 1 192.168.23.2 Ser2/0
192.168.3.255/32 Direct 0 0 192.168.3.3 Loop0
192.168.12.0/24 RIP 100 1 192.168.13.1 Ser3/0
查看rip信息?
查看rip协议
[AR1]display rip
Public VPN-instance name:
RIP process: 1
RIP version: 1
Preference: 100
Checkzero: Enabled
Default cost: 0
Summary: Enabled
Host routes: Enabled
Maximum number of load balanced routes: 32
Update time : 30 secs Timeout time : 180 secs
Suppress time : 120 secs Garbage-collect time : 120 secs
Update output delay: 20(ms) Output count: 3
TRIP retransmit time: 5(s) Retransmit count: 36
Graceful-restart interval: 60 secs
Triggered Interval : 5 50 200
BFD: Disabled
Silent interfaces: None
Default routes: Disabled
Verify-source: Enabled
Networks:
192.168.1.0 192.168.12.0
192.168.13.0
Configured peers: None
查看rip数据库
[AR1]display rip 1 database
192.168.1.0/24, auto-summary
192.168.1.0/24, cost 0, nexthop 192.168.1.1, RIP-interface
192.168.2.0/24, auto-summary
192.168.2.0/24, cost 1, nexthop 192.168.12.2
192.168.3.0/24, auto-summary
192.168.3.0/24, cost 1, nexthop 192.168.13.3
192.168.12.0/24, auto-summary
192.168.12.0/24, cost 0, nexthop 192.168.12.1, RIP-interface
192.168.13.0/24, auto-summary
192.168.13.0/24, cost 0, nexthop 192.168.13.1, RIP-interface
192.168.23.0/24, auto-summary
192.168.23.0/24, cost 1, nexthop 192.168.12.2
192.168.23.0/24, cost 1, nexthop 192.168.13.3
其他rip常用命令
<AR1>reset rip 1 process //重启进程
<AR1>display rip 1 interface Serial 1/0 //查看接口信息
<AR1>display rip 1 route //查看指定rip进程的路由信息以及每条路由相关的定时器的值
[AR1-rip-1]preference 120 //设置优先级默认为100
[AR1-rip-1]timers ? //调整4个定时器的值
garbage-collect Garbage-collect timer
suppress Suppress timer
timeout Timeout timer
update Update timer
RIPv2基础配置
拓扑如下:
IP地址规划
设备 | 接口 | IP地址 | 子网掩码 | 默认网关 | AR1 | G0/0 | 192.168.12.1 | 255.255.255.0 | N/A | Loopback 0 | 172.16.1.1 | 255.255.255.0 | N/A | Loopback 1 | 172.16.2.1 | 255.255.255.0 | N/A | AR2 | G0/0 | 192.168.12.2 | 255.255.255.0 | N/A | G0/1 | 192.168.23.2 | 255.255.255.0 | N/A | AR3 | G0/1 | 192.168.23.3 | 255.255.255.0 | N/A | Loopback 0 | 172.16.3.3 | 255.255.255.0 | N/A | Loopback 1 | 172.16.4.3 | 255.255.255.0 | N/A |
配置接口IP地址
AR1配置
[AR1]interface GigabitEthernet 0/0 //进入接口
[AR1-GigabitEthernet0/0]ip address 192.168.12.1 24 //配置IP地址
[AR1-GigabitEthernet0/0]undo shutdown //激活接口
[AR1]interface LoopBack 0 //进入接口
[AR1-LoopBack0]ip address 172.16.1.1 24 //配置IP地址
[AR1]interface LoopBack 1 //进入接口
[AR1-LoopBack1]ip address 172.16.2.1 24 //配置IP地址
AR2配置
[AR2]interface GigabitEthernet 0/0 //进入接口
[AR2-GigabitEthernet0/0]ip address 192.168.12.2 24 //配置IP地址
[AR2-GigabitEthernet0/0]undo shutdown //激活接口
[AR2]interface GigabitEthernet 0/1 //进入接口
[AR2-GigabitEthernet0/1]ip address 192.168.23.2 24 //配置IP地址
[AR2-GigabitEthernet0/1]undo shutdown //激活接口
AR3配置
[AR3]interface GigabitEthernet 0/1 //进入接口
[AR3-GigabitEthernet0/1]ip address 192.168.23.3 24 //配置IP地址
[AR3-GigabitEthernet0/1]undo shutdown //激活接口
[AR3]interface LoopBack 0 //进入接口
[AR3-LoopBack0]ip address 172.16.3.3 24 //配置IP地址
[AR3]interface LoopBack 1 //进入接口
[AR3-LoopBack1]ip address 172.16.4.3 24 //配置IP地址
?配置RIPv2
RIPv2版本只需要在rip协议下输入verison2,对于不连续网络,必须关闭自动聚合功能,使用命令undo summary
AR1配置
[AR1]rip //进入rip协议
[AR1-rip-1]version 2 //版本为2
[AR1-rip-1]no summary //关闭聚合功能
[AR1-rip-1]network 192.168.12.0 //宣告网段
[AR1-rip-1]network 172.16.1.0 //宣告网段
[AR1-rip-1]network 172.16.2.0 //宣告网段
AR2配置
[AR2]rip //进入rip协议
[AR2-rip-1]version 2 //版本为2
[AR2-rip-1]undo summary //关闭聚合功能
[AR2-rip-1]network 192.168.12.0 //宣告网段
[AR2-rip-1]network 192.168.23.0 //宣告网段
AR3配置
[AR3]rip //进入rip协议
[AR3-rip-1]version 2 //版本为2
[AR3-rip-1]undo summary //关闭聚合功能
[AR3-rip-1]network 192.168.23.0 //宣告网段
[AR3-rip-1]network 172.16.3.0 //宣告网段
[AR3-rip-1]network 172.16.4.0 //宣告网段
测试:
AR1去访问AR3虚拟地址172.16.4.3
?RIPv2扩展配置
掌握RIP网络中引入默认路由的方法
拓扑:
IP地址规划
设备 | 接口 | IP地址 | 子网掩码 | 默认网关 | AR1 | G0/0 | 192.168.12.1 | 255.255.255.0 | N/A | Loopback 0 | 192.168.1.1 | 255.255.255.0 | N/A | AR2 | G0/0 | 192.168.12.2 | 255.255.255.0 | N/A | G0/1 | 192.168.23.2 | 255.255.255.0 | N/A | AR3 | G0/1 | 192.168.23.3 | 255.255.255.0 | N/A |
?
配置接口IP地址
AR1配置
[AR1]interface GigabitEthernet 0/0 //进入接口
[AR1-GigabitEthernet0/0]ip address 192.168.12.1 24 //配置IP地址
[AR1-GigabitEthernet0/0]undo shutdow //激活接口
[AR1]interface LoopBack 0 //进入接口
[AR1-LoopBack0]ip address 192.168.1.1 24 //配置IP地址
AR2配置
[AR2]interface GigabitEthernet 0/0 //进入接口
[AR2-GigabitEthernet0/0]ip address 192.168.12.2 24 //配置IP地址
[AR2-GigabitEthernet0/0]undo shutdown //激活接口
[AR2]interface GigabitEthernet 0/1 //进入接口
[AR2-GigabitEthernet0/1]ip address 192.168.23.2 24 //配置IP地址
[AR2-GigabitEthernet0/0]undo shutdown //激活接口
AR3配置
[AR3]interface GigabitEthernet 0/1 //进入接口
[AR3-GigabitEthernet0/1]ip address 192.168.23.3 24 //配置IP地址
[AR3-GigabitEthernet0/1]undo shutdown //激活接口
配置RIP
AR1配置
[AR1]rip //进入rip协议
[AR1-rip-1]network 192.168.1.0 //宣告网段
[AR1-rip-1]network 192.168.12.0 //宣告网段
AR2配置
[AR2]rip //进入rip协议
[AR2-rip-1]network 192.168.12.0 //宣告网段
AR3配置
[AR3]ip route-static 192.168.1.0 24 192.168.23.2 //配置静态路由
[AR3]ip route-static 192.168.12.0 24 192.168.23.2 //配置静态路由
引入默认路由
AR2配置
[AR2]rip //进入rip协议
[AR2-rip-1]default-route originate //宣告网段
输入命令“default-route originate“后路由器R2发送一条0.0.0.0子网的路由更新信息,使得R1学习到了默认路由
RIP认证
AR1配置
[AR1]interface GigabitEthernet 0/0 //进入接口
[AR1-GigabitEthernet0/0]rip authentication-mode md5 rfc2453 plain 123123 //设置认证模式为MD5密码为123123
AR2配置
[AR2]interface GigabitEthernet 0/0 //进入接口
[AR2-GigabitEthernet0/0]rip authentication-mode md5 rfc2453 plain 123 //设置认证模式为MD5密码为123123
查看路由表
可以看到查到了路由信息
[AR2]display ip routing-table protocol rip
Summary count : 2
RIP Routing table status : <Active>
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
192.168.1.0/24 RIP 100 1 192.168.12.1 GE0/0
|