Linuxiptables backing up and recovering instances from different machines

Source: Internet
Author: User
Linuxiptables: backs up and recovers instances from different machines. 1. the configuration file location of iptables is:/etc/sysconfig/iptables master control machine: a sub-machine in service running. backup machine: when the master machine fails, switch to the backup machine-operations on the master machine ----------------- 2. create...
Linux iptables: backs up and recovers instances from different machines. 1. iptables configuration file location:/etc/sysconfig/iptables master machine: machines in service running; backup machine: when the master machine fails, switch to the backup host-operations on the master machine ----------------- 2. create a directory: mkdir-p/bak/iptables/mkdir/root/script/3. create a script in the/root/script/directory: vi backup. sh www.2cto.com \ cp/etc/sysconfig/iptables/bak/iptables _ $ (date + % Y % m % d % H) 4. Custom automatic tasks: crontab-e */10 *****/usr/sbin/ntpdate 210.72.145.4410 ***** sh/root/script/backup. sh- -On the backup machine, perform operations ----------------- 5. create a directory: mkdir-p/bak/iptables/{lt, yd} # lt directory to store the backups that are redirected to China Unicom, copy the mkdir/root/script/6 file in the yd directory and create a script in the/root/script/directory: vi scp_lt.sh #! /Usr/bin/empty CT-fset password maid scp-P 22 root@202.105.135.52:/etc/sysconfig/iptables/bak/iptables/lt/iptablesset timeout 300 empty CT "root@202.105.135.52's password: "set timeout 300 send" $ password \ r "set timeout 300 send" exit \ r "keep Ct eof 7. create a script in the/root/script/directory: vi scp_yd.sh www.2cto.com #! /Usr/bin/login CT-fset password maid scp-P 22 root@183.62.178.91:/etc/sysconfig/iptables/bak/iptables/yd/iptablesset timeout 300 login CT "root@183.62.178.91's password: "set timeout 300 send" $ password \ r "set timeout 300 send" exit \ r "keep Ct eof 8. create a script in the/root/script/directory: vi backup. sh www.2cto.com login CT/root/script/scp_lt.shexpect/root/script/scp_yd.shsed-I's/202.105.135.52/logs/g'/bak/iptables/lt/iptablessed-I's/logs /58.250.56.154/g'/bak/iptables/lt/iptables \ cp/bak/iptables/lt/iptables/etc/sysconfig/iptables/etc/init. d/iptables restart/etc/init. d/iptables savemv/bak/iptables/lt/iptables _ $ (date + % Y % m % d % H) mv/bak/iptables/yd/iptables _ $ (date + % Y % m % d % H) 9. note, you need to manually log on to the backup machine once to obtain the RSA public key, and then do not need to log on like this, otherwise the script will execute error 10, custom automatic task: crontab-e */10 *****/usr/sbin/ntpdate 210.72.145.4420 ***** sh/root/script/backup. sh author wang7dao
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.