【实验名称】
利用TFTP服务器备份恢复路由器配置。
【实验目的】
能够从TFTP服务器备份,并恢复路由器配置。
【背景描述】
假设某台路由器的配置文件由于误操作或其他某种原因被破坏了,现在需要从TFTP服务器上的备份配置文件中恢复。
本实验以1台R1762路由器为例,路由器命名为RouterA。1台PC机通过串口(Com)连接到路由器的控制(Console)端口,通过网卡(NIC)连接到路由器的fastethernet0端口。假设PC机的IP地址和网络掩码分别为192.168.0.137,255.255.255.0,路由器的fastethernet1/0端口的IP地址和网络掩码分别为192.168.0.138,255.255.255.0。
【实验功能】
使网络管理员可以备份配置文件,并且将配置恢复到交换机上。
【实验设备】
R1762(1台)、PC(1台)、直连线(1条)
【实验拓扑】
2008-11-14 14:46
【实验步骤】
步骤1. 在路由器上配置fastethernet1/0端口的IP地址。
RouterA(config)# interface fastethernet1/0
RouterA(config-if)# ip address 192.168.0.138 255.255.255.0
RouterA(config-if)# no shutdown
验证测试:验证路由器接口fastethernet1/0的IP地址已经配置并且开启,PC机与路由器已有网络连通性。
RouterA#show ip interface fastethernet1/0
FastEthernet 1/0 is UP , line protocol is UP
Hardware is PQ2 FCC FAST ETHERNET CONTROLLER FastEthernet, address is 00d0.f888.
2be2 (bia 00d0.f888.2be2)
Interface address is: 192.168.0.138/24
ARP type: ARPA,ARP Timeout: 3600 seconds
MTU 1500 bytes, BW 100000 Kbit
Encapsulation protocol is Ethernet-II, loopback not set
Keepalive interval is 10 sec , set
Carrier delay is 2 sec
RXload is 1 ,Txload is 1
Queueing strategy: FIFO
Output queue 0/40, 0 drops;
Input queue 0/75, 0 drops
5 minutes input rate 33 bits/sec, 0 packets/sec
5 minutes output rate 1 bits/sec, 0 packets/sec
24 packets input, 1814 bytes, 0 no buffer
Received 24 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 abort
1 packets output, 42 bytes, 0 underruns
0 output errors, 0 collisions, 4 interface resets
Link Mode: 100M/Full-Duplex
或者:
RouterA#show ip interface brief
Interface IP-Address(Pri) OK? Status
serial 1/2 no address YES DOWN
serial 1/3 no address YES DOWN
FastEthernet 1/0 192.168.0.138/24 YES UP
FastEthernet 1/1 no address YES DOWN
Null 0 no address YES UP
RouterA#ping 192.168.0.137 !验证路由器与PC机具有网络连通性
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echoes to 192.168.0.137, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
步骤2. 备份路由器配置。
RouterA#copy running-config tftp
! 备份路由器的当前配置文件到TFTP服务器
Address or name of remote host []?192.168.0.137 !输入TFTP服务器IP
Destination filename []?config.text !输入下载后生成的文件名
Building configuration...
Accessing tftp://192.168.0.137/running-config...
Success : Transmission success,file length 1024
或者:
RouterA#copy startup-config tftp
! 备份路由器的初始配置文件到TFTP服务器
Address or name of remote host []?192.168.0.137 !输入TFTP服务器IP
Destination filename []?config.text !输入下载后生成的文件名
Building configuration...
Accessing tftp://192.168.0.137/running-config...
Success : Transmission success,file length 1024
验证测试:验证TFTP服务器上的配置文件。
打开TFTP服务器上的配置文件C:\ config.text (用Office Word程序即可打开)。
C:\ config.text文件内容如下:
!
version 8.32(building 5)
!
interface serial 1/2
clock rate 64000
!
interface serial 1/3
clock rate 64000
!
interface FastEthernet 1/0
ip address 192.168.0.138 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet 1/1
duplex auto
speed auto
!
interface Null 0
!
line con 0
line aux 0
line vty 0 4
login
!
!
end
步骤3. 恢复路由器配置。
RouterA#delete flash:config.text !删除路由器原有配置信息
RouterA#copy tftp startup-config ! 恢复配置到路由器的初始配置文件中
Address or name of remote host []?192.168.0.137 !输入TFTP服务器的IP
Source filename []?config.text !输入文件名
Accessing tftp://192.168.0.137/config.text...
Write file to flash successfully!
RouterA# copy startup-config running-config
! 将初始配置文件拷贝到路由器的当前配置文件中
验证测试:验证路由器已经更改为新的配置。
RouterA#show startup-config ! 验证路由器的初始配置文件为新的文件
!
Building configuration...(building 53)
Current configuration : 406 bytes
Copyright (c) 2004 by Re
!
version 8.32(building 5)
!
interface serial 1/2
clock rate 64000
!
interface FastEthernet 1/0
ip address 192.168.0.138 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet 1/1
duplex auto
speed auto
!
interface Null 0
!
line con 0
line aux 0
line vty 0 4
login
!
end
【注意事项】
在备份、恢复配置时,须验证路由器与PC机(TFTP Server)具有网络连通性。
【参考配置】
RouterA #show running-config
Building configuration...(building 53)
Current configuration : 406 bytes
Copyright (c) 2004 by Re
!
version 8.32(building 5)
interface serial 1/2
clock rate 64000
!
interface FastEthernet 1/0
ip address 192.168.0.138 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet 1/1
duplex auto
speed auto
interface Null 0
!
line con 0
line aux 0
line vty 0 4
login
!
end
联系客服