案例十八 利用TFTP备份还原配置文件.docx
《案例十八 利用TFTP备份还原配置文件.docx》由会员分享,可在线阅读,更多相关《案例十八 利用TFTP备份还原配置文件.docx(14页珍藏版)》请在冰豆网上搜索。
案例十八利用TFTP备份还原配置文件
案例十八利用TFTP备份还原配置文件
【背景描述】
假设某台路由器的配置文件由于误操作或其他某种原因被破坏了,现在需要从TFTP服务器上的备份配置文件中恢复。
【实现功能】
使网络管理员可以备份配置文件,并且将配置恢复到交换机上。
【使用设备】
设备类型
设备名称
设备数量
交换机
路由器
router
1
三层交换机
双绞线
2
计算机
1
【案例拓扑】
【实现过程】
步骤1先查看路由器的配置
RA#showrunning-config
Buildingconfiguration...
Currentconfiguration:
!
version6.14(9coll)
!
hostname"RA"
!
enablepassword123
!
ipsubnet-zero
!
interfaceLoopback0
ipaddress1.1.1.1255.255.255.0
!
interfaceFastEthernet0
ipaddress172.16.2.1255.255.255.0
!
interfaceFastEthernet1
ipaddress12.1.1.2255.255.255.0
shutdown
!
interfaceFastEthernet2
noipaddress
shutdown
!
interfaceFastEthernet3
noipaddress
shutdown
!
interfaceSerial0
noipaddress
shutdown
!
interfaceSerial1
ipaddress12.1.1.1255.255.255.0
encapsulationframe-relay
frame-relayinverse-arp
!
routerrip
version2
network172.16.0.0
network1.0.0.0
network12.0.0.0
noauto-summary
!
ipclassless
!
linecon0
password123
login
lineaux0
linevty04
login
linevty519
login
!
end
测试连通性:
在路由器上ping服务器地址
RA#ping172.16.2.10
Typeescapesequencetoabort.
Sending5,100-byteICMPEchoesto172.16.2.10,timeoutis2seconds:
!
!
!
!
!
Successrateis100percent(5/5),round-tripmin/avg/max=1/1/4ms
步骤2备份路由器配置
RA#copyrunning-configtftp
Remotehost[172.16.2.10]?
Nameofconfigurationfiletowrite[ra-confg]?
config.text
Writefileconfig.textonhost172.16.2.10?
[confirm]
Buildingconfiguration...
Writingconfig.text!
!
[OK]
或者
RA#copystartup-configtftp
Remotehost[172.16.2.10]?
Nameofconfigurationfiletowrite[ra-confg]?
config.text
Writefileconfig.textonhost172.16.2.10?
[confirm]
Writingconfig.text!
!
[OK]
验证测试:
验证TFTP服务器上的配置文件
打开TFTP服务器上的配置文件C:
\config.text(用记事本就可以查看)
!
version6.14(9coll)
!
hostname"RA"
!
enablepassword123
!
ipsubnet-zero
!
interfaceLoopback0
ipaddress1.1.1.1255.255.255.0
!
interfaceFastEthernet0
ipaddress172.16.2.1255.255.255.0
!
interfaceFastEthernet1
ipaddress12.1.1.2255.255.255.0
shutdown
!
interfaceFastEthernet2
noipaddress
shutdown
!
interfaceFastEthernet3
noipaddress
shutdown
!
interfaceSerial0
noipaddress
shutdown
!
interfaceSerial1
ipaddress12.1.1.1255.255.255.0
encapsulationframe-relay
frame-relayinverse-arp
!
routerrip
version2
network172.16.0.0
network1.0.0.0
network12.0.0.0
noauto-summary
!
ipclassless
!
linecon0
password123
login
lineaux0
linevty04
login
linevty519
login
!
end
步骤3恢复路由器配置
RA#erasestartup-config
RA#reload
Proceedwithreload?
[confirm]
查看路由器配置
Red-Giant#showrunning-config
Buildingconfiguration...
Currentconfiguration:
!
version6.14(9coll)
!
hostname"Red-Giant"
!
ipsubnet-zero
!
interfaceFastEthernet0
noipaddress
shutdown
!
interfaceFastEthernet1
noipaddress
shutdown
!
interfaceFastEthernet2
noipaddress
shutdown
!
interfaceFastEthernet3
noipaddress
shutdown
!
interfaceSerial0
noipaddress
shutdown
!
interfaceSerial1
noipaddress
shutdown
!
ipclassless
!
linecon0
lineaux0
linevty04
login
linevty519
login
!
end
先给和TFTP相连的服务器配置一个IP地址测试连通性
Red-Giant#ping172.16.2.10
Typeescapesequencetoabort.
Sending5,100-byteICMPEchoesto172.16.2.10,timeoutis2seconds:
!
!
!
!
!
Successrateis100percent(5/5),round-tripmin/avg/max=1/1/4ms
然后进行还原
Red-Giant#copytftprunning-config
Addressofremotehost[255.255.255.255]?
172.16.2.10
Nameofconfigurationfile[red-giant-confg]?
config.text
Configureusingconfig.textfrom172.16.2.10?
[confirm]
Loadingconfig.textfrom172.16.2.10(viaFastEthernet0):
!
[OK-733/32727bytes]
验证测试:
验证路由器上已经更新为新的配置
Red-Giant#copytftprunning-config
Addressofremotehost[255.255.255.255]?
172.16.2.10
Nameofconfigurationfile[red-giant-confg]?
config.text
Configureusingconfig.textfrom172.16.2.10?
[confirm]
Loadingconfig.textfrom172.16.2.10(viaFastEthernet0):
!
[OK-733/32727bytes]
RA#showrunning-config
Buildingconfiguration...
Currentconfiguration:
!
version6.14(9coll)
!
hostname"RA"
!
enablepassword123
!
ipsubnet-zero
!
interfaceLoopback0
ipaddress1.1.1.1255.255.255.0
!
interfaceFastEthernet0
ipaddress172.16.2.1255.255.255.0
!
interfaceFastEthernet1
ipaddress12.1.1.2255.255.255.0
shutdown
!
interfaceFastEthernet2
noipaddress
shutdown
!
interfaceFastEthernet3
noipaddress
shutdown
!
interfaceSerial0
noipaddress
shutdown
!
interfaceSerial1
ipaddress12.1.1.1255.255.255.0
encapsulationframe-relay
frame-relayinverse-arp
!
routerrip
version2
network172.16.0.0
network1.0.0.0
network12.0.0.0
noauto-summary
!
ipclassless
!
linecon0
password123
login
lineaux0
linevty04
login
linevty519
login
!
end
参考配置
Red-Giant#copytftprunning-config
Addressofremotehost[255.255.255.255]?
172.16.2.10
Nameofconfigurationfile[red-giant-confg]?
config.text
Configureusingconfig.textfrom172.16.2.10?
[confirm]
Loadingconfig.textfrom172.16.2.10(viaFastEthernet0):
!
[OK-733/32727bytes]
RA#showrunning-config
Buildingconfiguration...
Currentconfiguration:
!
version6.14(9coll)
!
hostname"RA"
!
enablepassword123
!
ipsubnet-zero
!
interfaceLoopback0
ipaddress1.1.1.1255.255.255.0
!
interfaceFastEthernet0
ipaddress172.16.2.1255.255.255.0
!
interfaceFastEthernet1
ipaddress12.1.1.2255.255.255.0
shutdown
!
interfaceFastEthernet2
noipaddress
shutdown
!
interfaceFastEthernet3
noipaddress
shutdown
!
interfaceSerial0
noipaddress
shutdown
!
interfaceSerial1
ipaddress12.1.1.1255.255.255.0
encapsulationframe-relay
frame-relayinverse-arp
!
routerrip
version2
network172.16.0.0
network1.0.0.0
network12.0.0.0
noauto-summary
!
ipclassless
!
linecon0
password123
login
lineaux0
linevty04
login
linevty519
login
!
end
【注意事项】
在备份、恢复配置时,应验证路由器与PC(TFTP服务器)具有网络连通性。