Configure the DNS service in Liunx and the DNS service in Liunx
When you Ping the host name, you can map the IP address of the host, and vice versa. Configure and specify the DNS server to quickly deploy the cluster. You do not need to modify the HOSTS file on each host to resolve the IP address and host name. In Linux, DNS is implemented using bind.
Machine IP machine name usage
10.190.60.5 hadoop01.ftgov-DNS host
10.190.60.6 hadoop02.ftgov-DNS Client
10.190.60.7 hadoop03.ftgov-DNS Client
Procedure
Command: yum-y install bind-utils bind-chroot
- Modify/etc/named. conf access permission
Command: vim/etc/named. conf
- Modify the/etc/named. rfc1912.zones file and add the forward and reverse resolution configurations.
Command: vim/etc/named. rfc1912.zones
Resolution:
Zone "ftgov" IN {// parse when the input is similar to the "ftgov" suffix, for example, hadoop01.ftgov
Type master; // This is a dns host
File "named.ftgov.com"; // The resolution file will read the domain name and IP ing configuration of the named.ftgov.com file in the/var/named directory (the file will be generated later)
Allow-update {none ;};
};
Zone "60.190.10.in-addr. arpa" IN {// reverse resolution when the input is similar to "10.190.60.xxx". Pay attention to the address order.
Type master;
File "named.10.190.60.zone"; // The Reverse file is located in the configuration of named.10.190.60.zone in the/var/named directory (the file will be generated later)
Allow-update {none ;};
};
- Generate the forward and reverse file required for the above Configuration
- Open the directory cd/var/named
- Generate file named.ftgov.com
- Configure named.ftgov.com
- Generate file named.10.190.60.zone
- Configure other DNS clients
1. First Use ifconfig to check which Nic is used by the current client, such as my host: eth1 Nic
2. Modify the file
Vim/etc/sysconfig/network-scripts/ifcfg-eth1 // change to the name of the NIC you are currently using
Add the IP address of the DNS host to the last line.
3. Restart the client NETWORK SERVICE
Command: service network restart
4. perform the same operations on other clients.
Start command: service named start
Check whether the service is normal: tail-n 30/var/log/messages | grep named
Positive Solution:
Reverse Solution:
Done.