思科 实验 动态路由的配置和使用

动态路由参考配置实验包
状态1

实验要求和目的

  • 配置不同的网段 IP
  • 使用 RIP V2 协议
  • 向路由器中的路由表加入网段

第一步 划分网段

IP 地址分配如图,【注意】不要连错接口!

如图 左侧PC 配置 192.168.1.1 网段 网关是192.168.1.254

如图 右侧PC 配置 192.168.2.1 网段 网关是192.168.2.254

配置 路由器端口IP 👇

配置1: 如下代码 进入左侧路由器R5 f0/0端口0配置 192.168.1.254 网段 , f0/1端口配置 20.1.1.1 网段

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface f0/0            //进入端口 0/0
Router(config-if)#no shutdown            //打开端口
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ip address 192.168.1.254 255.255.255.0   //添加 0/0端口的 ip
Router(config-if)#exit
Router(config)#interface f0/1            //进入端口 0/1
Router(config-if)#no shutdown            //打开端口
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#ip address 20.1.1.1 255.255.255.0         //添加 0/1端口的ip
Router(config-if)#exit
Router(config)#

配置2: 如下代码 进入中间路由器R6 f0/0端口0配置 20.1.1.2 网段 , f0/1端口配置 30.1.1.1 网段

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface f0/0              //进入 0/0 端口
Router(config-if)#no shutdown              //打开端口
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ip address 20.1.1.2 255.255.255.0      //给 0/0端口配置 ip
Router(config-if)#exit                      //退出操作
Router(config)#interface f0/1               //进入端口 0/1    
Router(config-if)#no shutdown               //打开端口
Router(config-if)# 
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#ip address 30.1.1.1 255.255.255.0       //给 0/1端口配置 ip
Router(config-if)#exit                       //退出操作
Router(config)#

配置2: 如下代码 进入右侧路由器R7 f0/0端口0配置 30.1.1.2 网段 , f0/1端口配置 192.168.2.254 网段

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface f0/0           // 进入端口 0/0
Router(config-if)#no shutdown           // 打开端口
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ip address 30.1.1.2 255.255.255.0     // 给 0/0 端口配置 IP
Router(config-if)#exit                   // 推出操作 
Router(config)#interface f0/1            // 进入端口 0/1
Router(config-if)#no shutdown            // 打开端口
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#ip address 192.168.2.254 255.255.255.0     // 给 0/1 端口配置 IP
Router(config-if)#exit
Router(config)#

ok , 到这里 所有的 IP 已经分配完成,接下来配置路由器的动态路由协议以及添加网段

第二步 配置 动态路由 以及 网段

配置1: 如下代码 进入 左侧 R5 的全局配置模式

Router>
Router>en
Router#conf               // 进入 全局配置 模式
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#router rip                       // 配置路由器 的 RIP 协议
Router(config-router)#version 2                 // 配置 RIP 协议为 V2版本
Router(config-router)#network 192.168.1.0       // 宣告 192.168.1.0 网段 
Router(config-router)#network 20.1.1.0          // 宣告 20.1.1.0 网段
Router(config-router)#exit                 //退出操作
Router(config)#

配置2: 如下代码 进入 左侧 R6 的全局配置模式

Router>
Router>en
Router#conf            //进入全局配置模式
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#router rip                  // 配置路由器 的 RIP 协议
Router(config-router)#version 2            // 配置 RIP 协议为 V2版本
Router(config-router)#network 20.1.1.0     // 宣告 20.1.1.0 网段 
Router(config-router)#network 30.1.2.0     // 宣告 30.1.2.0 网段
Router(config-router)#exit
Router(config)#

配置3: 如下代码 进入 左侧 R7 的全局配置模式

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#router rip                 // 配置路由器 的 RIP 协议
Router(config-router)#version 2           // 配置 RIP 协议为 V2版本
Router(config-router)#network 30.1.1.0    // 宣告30.1.1.0 网段
Router(config-router)#network 192.168.2.0 // 宣告 192.168.2.0 网段
Router(config-router)#exit
Router(config)#

ok , 全部配置已经完成 请耐心等待30s-1分钟,路由器正在学习中

ping 192.168.2.1 主机 成功。

实验结束,感谢你的阅读和观看!

点击数:122

默认图片
JiHua article
文章: 17

留下评论