网络-华为、思科交换机配置TFTP自动备份、NTP时间同步、SYSLOG日志同步

配置使用TFTP进行交换机配置的自动保存

华为设备

c++ 复制代码
<Huawei-sw>sys
[Huawei-sw]set save-configuration interval 60 delay 3 cpu-limit 60
[Huawei-sw]set save-configuration backup-to-server server <TFTP服务器IP> transport-type tftp path \Huawei-sw.zip
[Huawei-sw]quit
<Huawei-sw>save
  • 华为也可以使用ftp、sftp等其他协议,不过图个方便我还是用了不需要认证的TFTP,然后在防火墙里面加了白名单IP。
  • 华为发送的配置文件是个名为vrpcfg.zip的压缩包,所以这里的文件后缀要是zip结尾。
  • interval后接定时循环保存周期,单位分钟,如果有变动就保存,无变动不不保存;
  • delay后接save后多少时间保存,单位分钟;
  • cpu-limit后接cpu利用率,比如写60,当cpu利用率高于60时取消保存任务;
    具体参数可见官网

快速复制

set save-configuration interval 60 delay 3 cpu-limit 60

set save-configuration backup-to-server server <TFTP服务器IP> transport-type tftp path \Huawei-sw.zip

思科设备

c++ 复制代码
Cisco-sw>enable
Cisco-sw#conf t
Cisco-sw(config)#archive
Cisco-sw(config-archive)#path tftp://<TFTP服务器IP>/Cisco-sw.conf
Cisco-sw(config-archive)#time-period 10080
Cisco-sw(config-archive)#write-memory
Cisco-sw(config-archive)#exit
Cisco-sw(config)#do wr
  • time-period后接保存周期,单位分钟。比如每周保存,即可7*24*60=10080。
  • write-memory表示每一次执行write后立即保存。

快速复制

archive

path tftp://<TFTP服务器IP>/Cisco-sw.conf

write-memory

time-period 10080

单次TFTP备份

华为设备

c++ 复制代码
tftp <TFTP服务器IP> put vrpcfg.zip /Huawei-sw.zip

思科设备

c++ 复制代码
copy startup-config tftp://<TFTP服务器IP>/Cisco-sw

配置NTP

设置时区和NTP时间同步

华为设备

c++ 复制代码
<Huawei-sw>sys
[Huawei-sw]clock timezone Beijing,Chongqing,Hongkon,Urumqi add 08:00:00
[Huawei-sw]ntp-service unicast-server <NTP服务器IP>

快速复制

clock timezone Beijing,Chongqing,Hongkon,Urumqi add 08:00:00

ntp-service unicast-server <NTP服务器IP>

思科设备

c++ 复制代码
Cisco-sw>enable
Cisco-sw#conf t
Cisco-sw(config)#clock timezone GMT +8
Cisco-sw(config)#ntp server <NTP服务器IP>
Cisco-sw(config)#service timestamps log datetime localtime
Cisco-sw(config)#do wr
  • 思科注意,只修改时区使用show log还是显示默认UTC时区,需要修改本地时区service timestamps log datetime localtime

快速复制

clock timezone GMT +8

ntp server <NTP服务器IP>

service timestamps log datetime localtime

do wr

配置Syslog

华为设备

c++ 复制代码
<Huawei-sw>sys
[Huawei-sw]info-center loghost <Syslog服务器IP> local-time

快速复制

info-center loghost <Syslog服务器IP> local-time

华为这里有个坑要这里要加local-time,虽然display logbu显示的日志是修改过的时区,但是发送给syslog服务器的日期依旧是使用默认UTC时区

思科设备

c++ 复制代码
Cisco-sw>enable
Cisco-sw#conf t
Cisco-sw(config)#logging host <Syslog服务器IP>

快速复制

logging host <Syslog服务器IP>

验证

配置已经备份

日志已经汇总

相关推荐
haosend2 天前
计算机基础百科-彻底搞懂子网掩码(Subnet Mask)与CIDR的地址掩码(Address Mask):从困惑到清晰
路由器·交换机·数据网络
G皮T6 天前
【计算机网络】网络时间协议 NTP(二):X-Request-Start
网络·计算机网络·时钟同步·ntp·网络时间协议
G皮T6 天前
【计算机网络】网络时间协议 NTP(一)
网络·计算机网络·时钟同步·ntp·网络时间协议
haosend7 天前
【练习版】使用paramiko批量的查询,管理,配置路由器交换机
python·路由器·交换机·网络自动化
haosend8 天前
极简小白Python教程-实现能基本看懂和简单编写代码
python·路由器·交换机·网络自动化
希赛网19 天前
2026华为认证数通HCIA备考知识:生成树协议的原理、选举过程与配置要点
服务器·网络·stp·交换机·2026华为认证数通考试·stp生成树的概念·stp常用配置
渣渣盟21 天前
华为eNSP三层交换机实验全解析
运维·服务器·网络·网络工程·ensp
那就回到过去25 天前
交换机特性
网络·hcip·ensp·交换机
丁劲犇1 个月前
老旧CentOS7服务器JVM加载Jar缓慢排查:竟与NTP服务器有关
服务器·jvm·jar·java8·ntp·加载慢
碎梦归途1 个月前
思科网络设备配置命令大全,涵盖从交换机到路由器的核心配置命令
linux·运维·服务器·网络·网络协议·路由器·交换机