1静态路由.docx
《1静态路由.docx》由会员分享,可在线阅读,更多相关《1静态路由.docx(13页珍藏版)》请在冰豆网上搜索。
1静态路由
静态路由(全网通)
拓扑图如下:
接口连接:
Router1S0/0<---->Router2S0/0
Router3S0/1<---->Router2S0/1
路由器参考配置如下:
路由器R1的配置:
Router>//用户模式
Router>enable//从用户模式进入到特权模式
Router#configureterminal//从特权模式进入到全局模式
Router(config)#hostnameR1//给路由器从命名为R1
R1(config)#noipdomainlookup//关闭域名查找
R1(config)#lineconsole0//进入控制口
R1(config-line)#loggingsynchronous//光标跟随
R1(config-line)#exec-timeout00//关闭延迟
R1(config-line)#exit
R1(config)#interfaceloopback0//配置接口ip地址
R1(config-if)#ipaddress1.1.1.1255.255.255.0
R1(config-if)#noshutdown//激活接口(此接口可不激活,但物理接口一定要激活)
R1(config-if)#interfaces0/0//配置串口ip地址
R1(config-if)#ipaddress192.1.1.1255.255.255.0
R1(config-if)#noshutdown
R1(config-if)#end
R1#showiproute//查看路由表的信息
Codes:
C-connected,S-static,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2
i-IS-IS,su-IS-ISsummary,L1-IS-ISlevel-1,L2-IS-ISlevel-2
ia-IS-ISinterarea,*-candidatedefault,U-per-userstaticroute
o-ODR,P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
1.0.0.0/24issubnetted,1subnets
C1.1.1.0isdirectlyconnected,Loopback0
C192.1.1.0/24isdirectlyconnected,Serial0/0
R1#configureterminal
R1(config)#iproute2.2.2.0255.255.255.0192.1.1.2//在全局模式下配置静态ip地址
R1(config)#iproute3.3.3.0255.255.255.0192.1.1.2
R1(config)#iproute193.1.1.0255.255.255.0192.1.1.2
R1(config)#end
R1#showiproute
Codes:
C-connected,S-static,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2
i-IS-IS,su-IS-ISsummary,L1-IS-ISlevel-1,L2-IS-ISlevel-2
ia-IS-ISinterarea,*-candidatedefault,U-per-userstaticroute
o-ODR,P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
//C是直联ip地址,S是静态ip地址
1.0.0.0/24issubnetted,1subnets
C1.1.1.0isdirectlyconnected,Loopback0
2.0.0.0/24issubnetted,1subnets
S2.2.2.0[1/0]via192.1.1.2
3.0.0.0/24issubnetted,1subnets
S3.3.3.0[1/0]via192.1.1.2
S193.1.1.0/24[1/0]via192.1.1.2
C192.1.1.0/24isdirectlyconnected,Serial0/0
R1#showrunning-config//查看配置的信息
Buildingconfiguration...
Currentconfiguration:
858bytes
!
version12.4
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
noservicepassword-encryption
!
hostnameR1
!
boot-start-marker
boot-end-marker
!
!
noaaanew-model
memory-sizeiomem5
!
!
ipcef
!
!
noipdomainlookup
!
!
!
!
!
interfaceLoopback0
ipaddress1.1.1.1255.255.255.0
!
interfaceSerial0/0
ipaddress192.1.1.1255.255.255.0
serialrestart-delay0
!
interfaceSerial0/1
noipaddress
shutdown
serialrestart-delay0
!
interfaceSerial0/2
noipaddress
shutdown
serialrestart-delay0
!
interfaceSerial0/3
noipaddress
shutdown
serialrestart-delay0
!
iphttpserver
iproute2.2.2.0255.255.255.0192.1.1.2
iproute3.3.3.0255.255.255.0192.1.1.2
iproute193.1.1.0255.255.255.0192.1.1.2
!
!
!
!
!
control-plane
!
!
linecon0
exec-timeout00
loggingsynchronous
lineaux0
linevty04
!
End
R1#
路由器R2的配置:
Router>
Router>enable
Router#configureterminal
Router(config)#hostnameR2
R2(config)#noipdomainlookup
R2(config)#lineconsole0
R2(config-line)#loggingsynchronous
R2(config-line)#exec-timeout00
R2(config-line)#exit
R2(config)#interfaceloopback0
R2(config-if)#ipaddress2.2.2.2255.255.255.0
R2(config-if)#noshutdown
R2(config-if)#interfaces0/0
R2(config-if)#ipaddress192.1.1.2255.255.255.0
R2(config-if)#noshutdown
R2(config-if)#interfaces0/1
R2(config-if)#ipaddress193.1.1.2255.255.255.0
R2(config-if)#noshutdown
R2(config-if)#end
R2#showiproute
Codes:
C-connected,S-static,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2
i-IS-IS,su-IS-ISsummary,L1-IS-ISlevel-1,L2-IS-ISlevel-2
ia-IS-ISinterarea,*-candidatedefault,U-per-userstaticroute
o-ODR,P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
2.0.0.0/24issubnetted,1subnets
C2.2.2.0isdirectlyconnected,Loopback0
C193.1.1.0/24isdirectlyconnected,Serial0/1
C192.1.1.0/24isdirectlyconnected,Serial0/0
R2#configureterminal
R2(config)#iproute1.1.1.0255.255.255.0192.1.1.1
R2(config)#iproute3.3.3.0255.255.255.0193.1.1.1
R2(config)#exit
R2#showiproute
Codes:
C-connected,S-static,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2
i-IS-IS,su-IS-ISsummary,L1-IS-ISlevel-1,L2-IS-ISlevel-2
ia-IS-ISinterarea,*-candidatedefault,U-per-userstaticroute
o-ODR,P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
1.0.0.0/24issubnetted,1subnets
S1.1.1.0[1/0]via192.1.1.1
2.0.0.0/24issubnetted,1subnets
C2.2.2.0isdirectlyconnected,Loopback0
3.0.0.0/24issubnetted,1subnets
S3.3.3.0[1/0]via193.1.1.1
C193.1.1.0/24isdirectlyconnected,Serial0/1
C192.1.1.0/24isdirectlyconnected,Serial0/0
R2#showrunning-config
Buildingconfiguration...
Currentconfiguration:
826bytes
!
version12.4
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
noservicepassword-encryption
!
hostnameR2
!
boot-start-marker
boot-end-marker
!
!
noaaanew-model
memory-sizeiomem5
!
!
ipcef
!
!
noipdomainlookup
!
!
!
!
!
interfaceLoopback0
ipaddress2.2.2.2255.255.255.0
!
interfaceSerial0/0
ipaddress192.1.1.2255.255.255.0
serialrestart-delay0
!
interfaceSerial0/1
ipaddress193.1.1.2255.255.255.0
serialrestart-delay0
!
interfaceSerial0/2
noipaddress
shutdown
serialrestart-delay0
!
interfaceSerial0/3
noipaddress
shutdown
serialrestart-delay0
!
iphttpserver
iproute1.1.1.0255.255.255.0192.1.1.1
iproute3.3.3.0255.255.255.0193.1.1.1
!
!
!
!
!
control-plane
!
!
linecon0
exec-timeout00
loggingsynchronous
lineaux0
linevty04
!
end
R2#
路由器R3的配置:
Router>
Router>enable
Router#configureterminal
Router(config)#hostnameR3
R3(config)#noipdomainlookup
R3(config)#lineconsole0
R3(config-line)#loggingsynchronous
R3(config-line)#exec-timeout00
R3(config-line)#exit
R3(config)#interfaceloopback0
R3(config-if)#ipaddress3.3.3.3255.255.255.0
R3(config-if)#noshutdown
R3(config-if)#interfaces0/0
R3(config-if)#ipaddress193.1.1.1255.255.255.0
R3(config-if)#noshutdown
R3(config-if)#end
R3#showiproute
Codes:
C-connected,S-static,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2
i-IS-IS,su-IS-ISsummary,L1-IS-ISlevel-1,L2-IS-ISlevel-2
ia-IS-ISinterarea,*-candidatedefault,U-per-userstaticroute
o-ODR,P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
3.0.0.0/24issubnetted,1subnets
C3.3.3.0isdirectlyconnected,Loopback0
C193.1.1.0/24isdirectlyconnected,Serial0/1
R3#configureterminal
R3(config)#iproute1.1.1.0255.255.255.0193.1.1.2
R3(config)#iproute2.2.2.0255.255.255.0193.1.1.2
R3(config)#iproute192.1.1.0255.255.255.0193.1.1.2
R3(config)#end
R3#showiproute
Codes:
C-connected,S-static,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2
i-IS-IS,su-IS-ISsummary,L1-IS-ISlevel-1,L2-IS-ISlevel-2
ia-IS-ISinterarea,*-candidatedefault,U-per-userstaticroute
o-ODR,P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
1.0.0.0/24issubnetted,1subnets
S1.1.1.0[1/0]via193.1.1.2
2.0.0.0/24issubnetted,1subnets
S2.2.2.0[1/0]via193.1.1.2
3.0.0.0/24issubnetted,1subnets
C3.3.3.0isdirectlyconnected,Loopback0
C193.1.1.0/24isdirectlyconnected,Serial0/1
S192.1.1.0/24[1/0]via193.1.1.2
R3#showrunning-config
Buildingconfiguration...
Currentconfiguration:
858bytes
!
version12.4
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
noservicepassword-encryption
!
hostnameR3
!
boot-start-marker
boot-end-marker
!
!
noaaanew-model
memory-sizeiomem5
!
!
ipcef
!
!
noipdomainlookup
!
!
!
!
!
interfaceLoopback0
ipaddress3.3.3.3255.255.255.0
!
interfaceSerial0/0
noipaddress
shutdown
serialrestart-delay0
!
interfaceSerial0/1
ipaddress193.1.1.1255.255.255.0
serialrestart-delay0
!
interfaceSerial0/2
noipaddress
shutdown
serialrestart-delay0
!
interfaceSerial0/3
noipaddress
shutdown
serialrestart-delay0
!
iphttpserver
iproute1.1.1.0255.255.255.0193.1.1.2
iproute2.2.2.0255.255.255.0193.1.1.2
iproute192.1.1.0255.255.255.0193.1.1.2
!
!
!
!
!
control-plane
!
!
linecon0
exec-timeout00
loggingsynchronous
lineaux0
linevty04
!
end
R3#
最终可以实现全网通。
2009-05-06