在Linux中配置DNS的正确方式

时间:2023-11-21 22:24:20

链接:http://ccl.cse.nd.edu/operations/condor/hostname.shtml

Common Hostname Problem on Linux

Newly installed Linux machines often have a common configuration problem that breaks several distributed systems, including Condor. Many programs need to determine their own IP address so that they can tell other machines how to contact them. This doesn't work with the default /etc/hosts on many Linux machines, which looks like this:

Incorrect /etc/hosts:

127.0.0.1 machinename localhost localhost.localdomain

When a program attempts to determine it's own IP address, it will think it to be the loopback address 127.0.0.1. When it communicates that address to other machines, everyone gets confused. There are two solutions to this problem. You can either put the proper IP address in /etc/hosts, or you can leave it out entirely, and let DNS figure it out.

Correct /etc/hosts Option A:

127.0.0.1 localhost localhost.localdomain
1.2.3.4 machinename

Correct /etc/hosts Option B:

127.0.0.1 localhost localhost.localdomain

After making this change, either reboot the machine or run condor_restart -master to reset Condor.