Cisco路由器静态路由和默认路由的配置.docx
《Cisco路由器静态路由和默认路由的配置.docx》由会员分享,可在线阅读,更多相关《Cisco路由器静态路由和默认路由的配置.docx(14页珍藏版)》请在冰点文库上搜索。
Cisco路由器静态路由和默认路由的配置
实验四Cisco路由器静态路由和默认路由的配置(验证性)(2学时)
一、实验目的
1.进一步熟悉Cisco路由器的配置环境
2.掌握Cisco路由器静态路由的配置方法
3.掌握Cisco路由器默认路由的配置方法
二、实验内容
(一)静态路由的配置
建立如上所示的拓扑结构,现在需要完成的就是让HostA能和HostB互相ping通。
具体配置如下:
router1的配置:
PressEntertoStart
Router>
Router>en
Router#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Router(config)#hostnamerouter1
router1(config)#interfacee0
router1(config-if)#ipaddress192.168.1.2255.255.255.0
router1(config-if)#noshut
%LINK-3-UPDOWN:
InterfaceEthernet0,changedstatetoup
router1(config-if)#interfaces0
router1(config-if)#ipaddress192.168.2.1255.255.255.0
router1(config-if)#clockrate6400//clockrate是dce设备给dte设备提供时钟频率的,需要在dce里面设置,而另外的一个路由器里面则不用设置
router1(config-if)#noshut
%LINK-3-UPDOWN:
InterfaceSerial0,changedstatetoup
router1(config-if)#end
%LINK-3-UPDOWN:
InterfaceSerial0,changedstatetodown
%LINEPROTO-5-UPDOWN:
LineprotocolonInterfaceSerial0,changedstatetodown
router1#configt
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
router1(config)#iproute192.168.3.0255.255.255.0192.168.2.1//设定静态路由
router1(config)#iproute192.168.2.0255.255.255.0192.168.2.1
router1(config)#end
router1#copyrunningstartup
Destinationfilename[startup-config]?
Buildingconfiguration...
[OK]
%LINK-3-UPDOWN:
InterfaceSerial0,changedstatetoup
%LINEPROTO-5-UPDOWN:
LineprotocolonInterfaceSerial0,changedstatetoup
router2的配置:
PressEntertoStart
Router>en
Router#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Router(config)#interfacee0
Router(config-if)#end
Router#configt
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Router(config)#hostnamerouter2
router2(config)#interfaces0
router2(config-if)#ipaddress192.168.2.2255.255.255.0
router2(config-if)#noshut
%LINK-3-UPDOWN:
InterfaceSerial0,changedstatetoup
router2(config-if)#interfaces0
router2(config-if)#interfacee0
router2(config-if)#ipaddress192.168.3.1255.255.255.0
router2(config-if)#noshut
%LINK-3-UPDOWN:
InterfaceEthernet0,changedstatetoup
router2(config-if)#end
router2#configt
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
router2(config)#iproute192.168.1.0255.255.255.0192.168.2.2
router2(config)#iproute192.168.2.0255.255.255.0192.168.2.2
router2(config)#end
router2#copyrunningstartup
Destinationfilename[startup-config]?
Buildingconfiguration...
[OK]
router2#ping192.168.1.2
Typeescapesequencetoabort.
Sending5,100-byteICMPEchosto192.168.1.2,timeoutis2seconds:
!
!
!
!
!
Successrateis100percent(5/5),round-tripmin/avg/max=1/2/4ms
router2#ping192.168.2.1
Typeescapesequencetoabort.
Sending5,100-byteICMPEchosto192.168.2.1,timeoutis2seconds:
!
!
!
!
!
Successrateis100percent(5/5),round-tripmin/avg/max=1/2/4ms
router2#ping192.168.2.2
Typeescapesequencetoabort.
Sending5,100-byteICMPEchosto192.168.2.2,timeoutis2seconds:
!
!
!
!
!
Successrateis100percent(5/5),round-tripmin/avg/max=1/2/4ms//路由器之间试ping一下,应该可以ping通,接下来配pc
pc1的配置如下:
BosonBOSS5.0
Copyright1998-2003BosonSoftware,Inc.
Usethecommandhelptogetstarted
PressEntertobegin
C:
>ipconfig/ip192.168.1.1255.255.255.0//此时尚未指定网关
C:
>ping192.168.2.1
Pinging192.168.2.1with32bytesofdata:
Requesttimedout.
Requesttimedout.
Requesttimedout.
Requesttimedout.
Requesttimedout.
Pingstatisticsfor192.168.2.1:
Packets:
Sent=5,Received=0,Lost=5(100%loss),//未指定网关时不能ping通router1的s0
Approximateroundtriptimesinmilli-seconds:
Minimum=0ms,Maximum=0ms,Average=0ms
C:
>ipconfig/dg192.168.1.2//指定网关为与本机直连的router1的e0口
C:
>ping192.168.1.2
Pinging192.168.1.2with32bytesofdata:
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.1.2:
Packets:
Sent=5,Received=5,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms
C:
>ping192.168.2.1
Pinging192.168.2.1with32bytesofdata:
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.2.1:
Packets:
Sent=5,Received=5,Lost=0(0%loss),//指定网关后可以ping通s0口了
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms
C:
>ping192.168.2.2
Pinging192.168.2.2with32bytesofdata:
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.2.2:
Packets:
Sent=5,Received=5,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms
C:
>ping192.168.3.1
Pinging192.168.3.1with32bytesofdata:
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.3.1:
Packets:
Sent=5,Received=5,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms
//可以ping通任意一台设备的IP地址,实验成功
C:
>
pc2的配置如下:
BosonBOSS5.0
Copyright1998-2003BosonSoftware,Inc.
Usethecommandhelptogetstarted
PressEntertobegin
C:
>
C:
>ipconfig/ip192.168.3.1255.255.255.0
C:
>ipconfig/dg192.168.3.1//把IP和网关设好
C:
>ping192.168.1.1
Pinging192.168.1.1with32bytesofdata:
Replyfrom192.168.1.1:
bytes=32time=60msTTL=241
Replyfrom192.168.1.1:
bytes=32time=60msTTL=241
Replyfrom192.168.1.1:
bytes=32time=60msTTL=241
Replyfrom192.168.1.1:
bytes=32time=60msTTL=241
Replyfrom192.168.1.1:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.1.1:
Packets:
Sent=5,Received=5,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms
C:
>ping192.168.1.2
Pinging192.168.1.2with32bytesofdata:
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Replyfrom192.168.1.2:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.1.2:
Packets:
Sent=5,Received=5,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms
C:
>ping192.168.2.1
Pinging192.168.2.1with32bytesofdata:
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Replyfrom192.168.2.1:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.2.1:
Packets:
Sent=5,Received=5,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms
C:
>ping192.168.2.2
Pinging192.168.2.2with32bytesofdata:
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Replyfrom192.168.2.2:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.2.2:
Packets:
Sent=5,Received=5,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms
C:
>ping192.168.3.1
Pinging192.168.3.1with32bytesofdata:
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Replyfrom192.168.3.1:
bytes=32time=60msTTL=241
Pingstatisticsfor192.168.3.1:
Packets:
Sent=5,Received=5,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=50ms,Maximum=60ms,Average=55ms//可以ping通任意一台设备的IP地址,实验成功
(二)默认路由的配置
建立如上所示的拓扑结构。
具体配置如下:
r1的配置:
PressEntertoStart
Router>
Router>en
Router#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Router(config)#hostnamerouter1
router1(config)#interfacee0
router1(config-if)#ipaddress192.168.1.2255.255.255.0
router1(config-if)#noshut
%LINK-3-UPDOWN:
InterfaceEthernet0,changedstatetoup
router1(config-if)#interfaces0
router1(config-if)#ipaddress192.168.2.1255.255.255.0
router1(config-if)#clockrate6400
router1(config-if)#noshut
%LINK-3-UPDOWN:
InterfaceSerial0,changedstatetoup
router1(config-if)#exit
%LINK-3-UPDOWN:
InterfaceSerial0,changedstatetodown
%LINEPROTO-5-UPDOWN:
LineprotocolonInterfaceSerial0,changedstatetodown
router1(config)#iproute0.0.0.00.0.0.0192.168.2.1
router1(config)#exit
router1#copyrunningstartup
Destinationfilename[startup-config]?
Buildingconfiguration...
[OK]
%LINK-3-UPDOWN:
InterfaceSerial0,changedstatetoup
%LINEPROTO-5-UPDOWN:
LineprotocolonInterfaceSerial0,changedstatetoup
r2的配置:
PressEntertoStart
Router>en
Router#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Router(config)#interfaces0
Router(config-if)#ipaddress192.168.2.2255.255.255.0
Router(config-if)#noshut
%LINK-3-UPDOWN:
InterfaceSerial0,changedstatetoup
Router(config-