实验四、静态路由与动态路由的配置
- 格式:doc
- 大小:2.08 MB
- 文档页数:6
实验四、静态路由与动态路由的配置
2.1实验目的
1.掌握静态路由的配置方法;
2. 掌握动态路由(RIP与OSPF)的配置方法。
2.2 设备需求
(1) 2台路由器;
(2) 2台PC机;
(3) 2根Console控制台电缆(一端接交换机或路由器的Console端口,一端接PC机串口)。
2.3实验环境
图4-1静态路由和动态路由的配置
2.4实验内容和步骤
1.静态路由的配置
路由器A的配置:
进入超级终端,进入用户视图。
< MSR3040> sys 进入系统视图
[MSR3040]sysname RTA
[RTA] display current-configuration 查看当前配置,看以太网接口与广域网接口(串口) ......
#
interface Serial5/0
link-protocol ppp
#
interface Serial5/1
link-protocol ppp
#
interface Serial5/2
link-protocol ppp
#
interface Serial5/3
link-protocol ppp
......
interface GigabitEthernet0/0
port link-mode route
#
interface GigabitEthernet0/1
port link-mode route
说明:本次实验中连线如下:
1. V.35电缆是连接在Serial5/0
2. PC机的网线连接在GigabitEthernet0/0
[RTA]
[RTA] interface GigabitEthernet0/0 可能简写:int g5/0 进入以太网接口0 [RTA- GigabitEthernet0/0] ip address 202.101.1.1 255.255.255.0
[RTA-GigabitEthernet0/0] interface Serial0
[RTA-Serial5/0] ip address 192.168.0.1 255.255.255.0
[RTA-Serial5/0] quit
[RTA] ip route-static 202.101.5.0 255.255.255.0 192.168.0.2
[RTA]
路由器B的配置:
[RTB]interface GigabitEthernet0/0
[RTB-GigabitEthernet0/0] ip address 202.101.5.1 255.255.255.0
[RTB-GigabitEthernet0/0] interface Serial5/0
[RTB-Serial5/0] ip address 192.168.0.2 255.255.255.0
[RTB-Serial5/0] quit
[RTB] ip route-static 202.101.1.0 255.255.255.0 192.168.0.1
[RTB] dis ip rout (显示路由表)
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.0.0/24 Direct 0 0 192.168.0.1 Serial5/0
192.168.0.1/32 Direct 0 0 192.168.0.1 Serial5/0
192.168.0.2/32 Direct 0 0 127.0.0.1 LoopBack0
202.101.1.0/24 Static 60 0 192.168.0.1 Serial5/0 (静态路由表项) 202.101.5.0/24 Direct 0 0 202.101.5.1 GigabitEthernet0/0
202.101.5.1/32 Direct 0 0 127.0.0.1 LoopBack0
[RTB]
在PCA机的命令窗口ping PCB:ping 202.101.5.2,显示结果如下:
图4-2 PCA机的命令窗口ping PCB
从图4-2中,可知PCA与PCB是连通的,实验成功。
2.RIP动态路由的配置
路由器A的配置:
[RTA] undo ip rout 202.101.5.0 24 192.168.0.2 (取消静态路由)
[RTA] rip
[RTA - rip-1] network 192.168.0.0
[RTA - rip-1] network 202.101.1.0
[RTA - rip-1]quit
[RTA] display ip routing-table 显示路由表
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0 192.168.0.0/24 Direct 0 0 192.168.0.1 S5/0 192.168.0.1/32 Direct 0 0 127.0.0.1 InLoop0 192.168.0.2/32 Direct 0 0 192.168.0.2 S5/0 202.101.1.0/24 Direct 0 0 202.101.1.1 GE0/0 202.101.1.1/32 Direct 0 0 127.0.0.1 InLoop0 202.101.5.0/24 RIP 100 1 192.168.0.2 S5/0
路由器B的配置:
[RTB] rip
[RTB - rip-1] network 192.168.0.0
[RTB - rip-1] network 202.101.5.0
[RTB - rip-1] quit
[RTB] display ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0 192.168.0.0/24 Direct 0 0 192.168.0.2 S5/0
192.168.0.1/32 Direct 0 0 192.168.0.1 S5/0
192.168.0.2/32 Direct 0 0 127.0.0.1 InLoop0 202.101.1.0/24 RIP 100 1 192.168.0.1 S5/0 202.101.5.0/24 Direct 0 0 202.101.5.1 GE0/0 202.101.5.1/32 Direct 0 0 127.0.0.1 InLoop0 3.OSPF动态路由的配置
路由器A的配置:
[RTA] undo rip (取消RIP路由)
Warning : Undo RIP process? [Y/N]: y
[RTA] interface loopback 0
[RTA-LoopBack0] ip address 1.1.1.1 255.255.255.255
[RTA-LoopBack0] quit
[RTA] route ID 1.1.1.1
[RTA] ospf 1
[RTA-ospf-1] area 0
[RTA-ospf-1-area-0.0.0.0] network 1.1.1.1 0.0.0.0