您的位置:首页 > 其它

实验 8 路由器的静态路由、默认路由

2017-04-28 22:59 579 查看
一.实验目的:

掌握路由器静态路由、默认路由的配置方法

二.实验要点:

通过对路由器 A 和路由器 B 在路由表里添加静态路由、默认路由,使路由器 A 可 Ping 通路由器 B

所连的各个网络,反之亦然.

三.实验设备:

路由器 Cisco 2621 两台,交换机 Cisco 2950 两台,带有网卡的工作站 PC 至少两台,控制台电

缆二条。

四、实验环境

当没有交换机配置时



当有交换机配置时



交换机设置在和路由器接口相连的同一个网段

交换机配置信息

交换机2950T-24配置

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int f0/1
Switch(config-if)#int vlan 1
Switch(config-if)#exit
Switch(config)#int f0/2
Switch(config-if)#int vlan 1
Switch(config-if)#ip ad 192.168.1.10 255.255.255.0
Switch(config-if)#exit


五. 实验步骤

RouterA 和 RouterB对应图示中的Router0和 Router1

1.按图 8 连接路由器和各工作站。

2.按图 8 配置路由器和各工作站 IP 地址等参数。

l 在路由器 A (假设为 DCE 端)上

router>en

router#conf t

router(config)#int s0/0

router(config-if)ip ad 10.0.0.1 255.255.255.0

router(config-if)cl ra 64000

router(config-if)no sh

router(config)#int f0/0

router(config-if)ip ad 192.168.0.1 255.255.255.0

router(config-if)no sh

router(config-if)exit

l 在路由器 B (假设为 DTE 端)上

router>en

router#conf t

router(config)#int s0/0

router(config-if)ip ad 10.0.0.2 255.255.255.0

router(config-if)no sh

router(config)#int f0/0

router(config-if)ip ad 192.168.1.1 255.255.255.0

router(config-if)no sh

router(config-if)exit

实验结果:

a. 在路由器 A 上是否能 ping 通路由器 B 的串口 S0/0 (10.0.0.2)

b. 在路由器 A 上是否能 ping 通路由器 B 的以太口 F0/0 (192.168.1.1)

答:

a.能

b.不能

3.配置路由器 RouterA 和 RouterB 上的静态路由。

在路由器 A 上: router (config)#ip route 192.168.1.0 255.255.255.0 10.0.0.2

在路由器 B 上: router(config)#ip route 192.168.0.0 255.255.255.0 10.0.0.1

实验结果:

a. 在路由器 A 上是否能 ping 通路由器 B 的串口 S0/0 (10.0.0.2)

b. 在路由器 A 上是否能 ping 通路由器 B 的以太口 F0/0 (192.168.1.1)

答:

a.能

b.能

4.测试各工作站之间的连通性。

5.配置路由器 RouterA 上的默认路由,使其指向 Internet

6.检查路由器 RouterA 和 RouterB 的路由表。

7.检查路由器 RouterA 和 RouterB 的运行配置文件内容。

六. 实验总结

1.记录实验步骤 2、3、4 中的结果,并分析原因。

详细步骤

在Router0上面的配置:

Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface Serial0/0
Router(config-if)#ip address 10.0.0.1 255.0.0.0
Router(config-if)#clock rate 64000
Router(config-if)#no shutdown
Router(config-if)#
Router(config-if)#exit
Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 192.168.0.1 255.255.255.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

%LINK-5-CHANGED: Interface Serial0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up

Router(config-if)#exit
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console

//当没有配置静态路由时
Router#ping 10.0.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/7 ms

Router#ping 192.168.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)


没有配置静态路由时,主机发送给路由器的信息,路由器不知道往什么方向转发,所以才会出现ping不通的情况,当设置好之后,就能实现正常通信。

在Router1上面的配置:

Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface Serial0/0
Router(config-if)#ip address 10.0.0.2 255.0.0.0
Router(config-if)#clock rate 64000
This command applies only to DCE interfaces
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface Serial0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up

Router(config-if)#exit
Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.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


在Router0上面的配置:

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 192.168.1.0 255.255.255.0 10.0.0.2
Router(config)#exit


在Router1上面的配置:

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 192.168.0.0 255.255.255.0 10.0.0.1
Router(config)#exit


在Router0上面的测试:

Router#ping 10.0.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

Router#ping 192.168.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms

Router#ping 192.168.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/2/8 ms

//路由表的内容
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

C    10.0.0.0/8 is directly connected, Serial0/0
C    192.168.0.0/24 is directly connected, FastEthernet0/0
S    192.168.1.0/24 [1/0] via 10.0.0.2
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  思科 路由器