网络-华为、思科交换机配置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>

验证

配置已经备份

日志已经汇总

相关推荐
交换机路由器测试之路4 天前
交换机路由器基础(三)--常见接口、线缆和器件
网络·智能路由器·路由器·交换机
ManageEngine卓豪4 天前
Syslog基础详解:协议、服务器、端口和实时监控
日志分析·日志监控·syslog·系统日志
交换机路由器测试之路9 天前
交换机路由器基础(一)基础概念
网络·智能路由器·路由器·交换机·网络基础·通信基础
A.sir啊15 天前
计算机网络:知识点梳理及讲解(三)数据链路层
计算机网络·以太网·交换机·数据链路层·局域网·ppp点对点·广播信道
tianyuanwo15 天前
计算机网络设计:从基础到原则的体系化指南
计算机网络·路由器·交换机·1024程序员节
墨咖17 天前
java实现NTP服务以及服务调用端(Client)功能
java·开发语言·时间同步·ntp·时钟源同步
九江Mgx18 天前
用 Go 手搓一个 NTP 服务:从“时间混乱“到“精准同步“的奇幻之旅
golang·ntp
野奔在山外的猫1 个月前
【文档】搭建 TFTP 服务器
tftp
aitav01 个月前
⚡ arm 32位嵌入式 Linux 系统移植 NTP 服务
linux·arm开发·ntp
失散131 个月前
分布式专题——33 一台新机器进行Web页面请求的历程
分布式·tcp/ip·http·路由器·交换机