Implementation of shell separation parsing script


Detach parse script

Before running the script, we need VM virtual machine, centos7, two hosts, one win10 – 1 as Wan host and one win10 – 2 as LAN host.

I had a tutorial on my blog before

//Modify and add network card configuration file
//Setting up dual network card
sed -i '4s/dhcp/static/' /etc/sysconfig/network-scripts/ifcfg-ens33
sed -i '15aIPADDR=\nNETMASK=' /etc/sysconfig/network-scripts/ifcfg-ens33
cp -p /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-ens36
sed -i '13d' /etc/sysconfig/network-scripts/ifcfg-ens36
sed -i '12s/ens33/ens36/' /etc/sysconfig/network-scripts/ifcfg-ens36
sed -i '13s/ens33/ens36/' /etc/sysconfig/network-scripts/ifcfg-ens36
sed -i '15s/' /etc/sysconfig/network-scripts/ifcfg-ens36
Systemctl restart network // restart the network service
//Modify master profile
sed -i '13s/' /etc/named.conf
sed -i '21s/localhost/any/' /etc/named.conf
sed -i '54,57d' /etc/ named.conf    //Delete the root domain of the master profile
//Delete add zone profile
sed -i '13,48d' /etc/ named.rfc1912 . zones // delete 13 to 48 lines of zone configuration file
cat >> /etc/ named.rfc1912 . zones < < - EOF // add external and internal network cards to the zone profile
view "wan" {
    Match clients { / 24;}; // internal network segment

    zone "" IN {
     type master;
     file "";

    zone "." IN {
     type hint;
     file "";

view "lan" {
    Match clients { / 24;}; // external network segment

    zone "" IN {
     type master;
     file "";

cd /var/named
cp -p  named.localhost   //Copy the template to the zone data profile you set
sed -i '2s/@/ ./2'  //Change the @ in the second line of the zone data profile to
sed -i '2s/rname.invalid./'
sed -i '8s/@/'
sed -i '9s/'
sed -i '10asmtp IN A\nwww IN A'
cp -p
sed -i '9s/'
sed -i '11s/'
sed -i '12s/'

systemctl stop  firewalld.service   //Turn off the firewall
Setenforce 0 // turn off enhancements
Systemctl start named // start the service

Finally, we use windows to try to resolve the domain name

The above is the whole content of this article, I hope to help you in your study, and I hope you can support developeppaer more.