Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Automatic backup of network equipment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Reference link: https://github.com/ytti/oxidized

Test environment: CentOS Linux release 7.3.1611 (Core)

Main component: oxidized oxidized-script oxidized-web

Note: oxidized-web requires more than ruby2.3 support. If oxidized-web is not installed, the rest in the configuration file will be changed to false.

Install dependent component yum source modification: this test environment is an office network test machine, and you need to modify the yum source. It is usually recommended to modify it to the company's online or test environment yum source (you can ask business operation and maintenance to help pour it out and upload it to / etc/yum.repos.d)

Yum install make cmake which sqlite-devel openssl-devel libssh3-devel ruby gcc ruby-devel libicu-devel gcc-c++ install ruby

The default ruby for centos7 is version 2.0, which needs to be installed separately.

Yum install centos-release-scl

Yum-config-manager-enable rhel-server-rhscl-7-rpms

Yum install-y rh-ruby25-ruby-devel

Yum install rh-ruby25

Scl enable rh-ruby25 bash

Ruby-v

Ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

Cp / opt/rh/rh-ruby25/root/usr/lib64/libruby.so.2.5 / usr/lib/

Set ruby2.5 to start automatically when you log in:

Vim / etc/profile.d/rh-ruby25.sh

#! / bin/bash

Source / opt/rh/rh-ruby25/enable

Export Xerox SCLS = "scl enable rh-ruby25 'echo $Xerox SCLS'"

Export PATH=$PATH:/opt/rh/rh-ruby25/root/usr/local/bin

Install oxidized

Gem install oxidized

Gem install oxidized-script oxidized-web

Useradd-m-d / home/oxidized oxidized

Cp / opt/rh/rh-ruby25/root/usr/local/share/gems/gems/oxidized-0.24.0/extra/oxidized.service / lib/systemd/system

Mkdir-p / home/oxidized/.config/oxidized

Mkdir / home/oxidized/.config/oxidized/logs/

Mkdir / home/oxidized/.config/oxidized/configs

Chown oxidized:oxidized / home/oxidized/.config/oxidized

Config file

Username: username

Password: password

Model: junos

Interval: 3600

Log: / home/oxidized/.config/oxidized/logs/oxidized.log

Debug: false

Threads: 30

Timeout: 20

Retries: 3

Prompt:! ruby/regexp / ^ ([\ w.overview -] + [# >]\ s?) $/

Rest: 127.0.0.1:8888

Next_adds_job: false

Vars: {}

Groups: {}

Models: {}

Pid: "/ home/oxidized/.config/oxidized/pid"

Input:

Default: ssh, telnet

Debug: false

Ssh:

Secure: false

Output:

Default: file

File:

Directory: "/ home/oxidized/.config/oxidized/configs"

Source:

Default: csv

Csv:

File: "/ home/oxidized/.config/oxidized/router.db"

Delimiter:! ruby/regexp /: /

Map:

Name: 0

Model: 1

Username: 2

Password: 3

Gpg: false

Model_map:

Cisco: ios

Juniper: junos

Router.db file

Vim home/oxidized/.config/oxidized/router.db

172.18.31.11:comware:user:passwd

Start the service

Systemctl restart oxidized.service

Systemctl status oxidized.service

At this point, the basic function of automatic backup has been completed. You can view the backup configuration file in the directory, and then the configuration can be viewed on the web page.

Install nginx

Yum install nginx

Vim / etc/nginx/conf.d/oxidized.conf

Cat / etc/nginx/conf.d/oxidized.conf

Server {

Listen 80

Server_name 172.18.34.45

Location / {

Proxy_pass http://127.0.0.1:8888/;

}

Access_log / var/log/nginx/access_oxidized.log

Error_log / var/log/nginx/error_oxidized.log

}

Systemctl restart nginx.service

Browser open: there are 3 icons under http://172.18.34.45/nodesActions, the first click to open to see the configuration file. The second versions can see the configuration differences for each version. (git support is required, and the installation steps are described below) the third is a forced backup.

The default display time is wrong and the following configuration file needs to be modified.

Vim / opt/rh/rh-ruby25/root/usr/local/share/gems/gems/oxidized-web-0.11.1/lib/oxidized/web/public/scripts/oxidized.jsgit installation

Yum-y install git

Yum install libgit2

Git config user.name Oxidized

Git config user.email "o@example.com"

Modify the configuration file to git output

Systemctl restart oxidized.service

Systemctl status oxidized.service

You can view the configuration differences of each version through the area button.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report