1. Simple automatic generation of text scripts:
Cat > Word1.txt waits for input when creating text, and if you want to generate text directly without waiting for input, you can write a script (for example: word.sh) and write the corresponding input between +end+ +end+. Run the script to generate Word1.txt word2.txt two text, no need to wait for input.
[[Email protected] ww]# VI word.sh (scripting)
#! /bin/> Word1.txt << +end+word1+end+> Word2.txt << +end+word2+ End+
[[Email protected] ww]# sh word.sh (Execute script)
To view the generated text:
2. Similarly, you can automatically deploy the name server to 155 machines
(scripting)
[Email protected] root]# VI dnsgen.sh
ip= "192.168.155"RIP= "155.168.192"#! /bin/Bashcat>>/etc/named.conf << +end+Zone"Gr.org"In {type Master;file"Gr.org.db"; allow-update {none;};}; Zone"$RIP. In-addr.arpa"in{type master; File"$RIP. db";};+end+Cat>/var/named/$RIP. db << +end+\ $TTL86400@ in SOA ns.gr.org. root.gr.org. ( 201502154H 20M 1W 15M) In NS ns.gr.org.3In PTR ns.gr.org.3In PTR www.gr.org.4In PTR mail.gr.org.+end+Cat>/var/named/gr.org.db << +end+\ $TTL86400@ in SOA ns.gr.org. root.gr.org. ( 201402036H 20M 3W 15M) @ in NS ns.gr.org.@ in MX10Mail.gr.org.bbs in CNAME www.gr.org.www in A $IP.3NS in A $IP.3Mail in A $IP.4+end+Cat>/etc/resolv.conf << +end+nameserver $IP 3+end+
2. Execute script
Start copying the above text to 192.168.155.3
[Email protected] root]# sh dnsgen.sh
If you are not prompted, the deployment succeeds, and you can see whether the following files and content look normal:
[Email protected] root]# cd/var/named
[[email protected] named]# ls
155.168.192.db gr.org.db (successfully generated)
[Email protected] named]# cat/etc/resolv.conf
NameServer 192.168.155.3 (successfully added )
[Email protected] named]# cat/etc/named.conf
Zone "gr.org" in {
Type master;
File "Gr.org.db";
allow-update {none; };
};
Zone "155.168.192.in-addr.arpa" in {
Type master;
File "155.168.192.db";
};
It's all been deployed.
3. Start the service
[[Email protected] named]# service named start
The rest to verify
Refer to section 3, following the DNS server functionality (forward, reverse resolution)
4, automatic deployment (through the script to automatically deploy the name server to the 155 machine)