[CENTOS] What to do if you have corrected the mistake in the IP address of the zone file but cannot connect to the DNS server

Guest OS: centos7 Host OS: MacOs web server: apache DNS server: BIND

I am a beginner who is self-taught about infrastructure. It didn't work well while building the server, and I had a little trouble, so I will post it as a memorandum. I'm sorry if the usage of terms is wrong.

Flow of problem occurrence

Start a web server on centos7 on virtualbox and resolve the name with DNS. I built a DNS server with BIND and a web server with apache. To check the connection from the browser, set the DNS server of the host OS to the IP address described in /etc/resolv.conf of centos. I access it with the curl command, but it doesn't connect.

The way to a solution

If it doesn't work, check the layer order and investigate the cause! I learned at the company before, so I looked it up.

(1) Check if communication is possible from the host OS to the guest OS

Execute the following command on the terminal (MacOS). ping (IP address of centos) IP address of PING centos (IP address of centos): 56 data bytes 64 bytes from (IP address of centos): icmp_seq = 0 ttl = 64 time = 0.431 ms 64 bytes from (IP address of centos): icmp_seq = 1 ttl = 64 time = 0.390 ms 64 bytes from (IP address of centos): icmp_seq = 2 ttl = 64 time = 0.543 ms ^C --- (IP address of centos) ping statistics --- 3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.390/0.455/0.543/0.065 ms Confirm that it is connected from the above.

② Check if the firewall is stopped.

systemctl status firewalld It was stopped.

③ Check if there is a problem with the DNS server.

Execute the following command on the terminal (MacOS). nslookup www.example.com ← Set domain The set IP address did not come out.

I confirmed that there was a problem with the DNS server, so when I reviewed the zone file again, the IP address of the A record was incorrect. Correct and restart service. nslookup www.example.com When I entered the above command again, the IP address was displayed, so the DNS server worked fine.

④ Further problems.

I access it with the curl command for final confirmation, but it doesn't connect. I think there are other problems and then check the web server. There is no problem even if you check all the configuration files such as http.conf. Check if you can connect again. ・ Curl www.example.com This command does not connect ・ Curl (IP address of centos) I was able to connect with this command.

⑤ I thought that the cache might remain in the DNS of the Mac, so I decided to delete the cache.

Execute the following command. sudo killall -HUP mDNSResponder

Check again. curl www.example.com I was able to display the html file prepared on the web server! !!

Summary

In this case, I didn't notice that the cache remained in the DNS of the Mac, so the layer order was slightly changed and the cause investigation was delayed. I learned that a speedy solution can be achieved by steadily eliminating the causes one by one while being aware of the layers in this case! Next time! !!

Recommended Posts

What to do if you have corrected the mistake in the IP address of the zone file but cannot connect to the DNS server
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
What to do if the progress bar is not displayed in tqdm of python
What to do if you can't hit the arrow keys in the Python interactive console
What to do if the package dependency cannot be repaired
[* CentOS 6.10] What to do if you cannot add the IUS Community Project repository on CentOS 6.5 (VirtualBox)
Make a note of what you want to do in the future with Raspberry Pi
What to do if you get "coverage unknown" in Coveralls
What to do if you can't log in as root
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if you get `locale.Error: unsupported locale setting` when getting the day of the week from a date in Python
What to do if you cat or tail a binary file and the terminal is garbled
[Django] What to do if the model you want to create has a large number of fields
What to do if you get an error saying c compiler cannot create executables in configure
What to do if you get a minus zero in Python
If you just want to get the dump file of the server, it was convenient to build an http server
What to do if you should have set an ssh key but are prompted for a password
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
What to do if you can't find PDO in Laravel or CakePHP
What to do if you can't use scikit grid search in Python
What to do if you get angry in TensorFlow v2 without attribute'app'
What to do if the server doesn't start with python manage.py runserver
What to do if you installed pyenv on Mac OS using Homebrew but the python version doesn't switch
What to do if you get a "No versions found" error in pipenv
I made you to express the end of the IP address with L Chika
file name. You can have a half-width space in pathlib, but you should escape the half-width space when you hit it in the subprocess. If you use check_output, you don't need to escape.
In pandas.DataFrame, even when assigning only a specific column, if index is attached, you do not have to worry about the order of data
What to do if you get "Python not configured." Using PyDev in Eclipse
What to do if a version error occurs in the selenium Chrome driver
What to do if (base) is displayed at the beginning of the Mac terminal
What to do if pipreqs results in UnicodeDecodeError
What to do if mod_fcgid cannot resolve UnicodeEncodeError
What to do if pip cannot be installed
What to do if you get an "unknown service" error from your gRPC server
What to do if the Microsoft Store opens even if you run python on Windows
What to do if you get `No kernel for language python found` in Hydrogen
What to do if pvcreate produces a lot of WARNING and cannot be created
What to do if the print command itself causes an error in Maya python
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do if you run python in IntelliJ and end with an error
What to do if the library doesn't load when you run it in PyCharm, even though it works fine on terminal
What to do if you can't pip install mysqlclient
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
What to do if a UnicodeDecodeError occurs in pip
To do the equivalent of Ruby's ObjectSpace._id2ref in Python
[OCI] Python script to get the IP address of a compute instance in Cloud Shell
What to do if you get Swagger-codegen in python and Import Error: No module named
What you should not do in the process of time series data analysis (including reflection)
What to do if you get an error when running "certbot renew" in CakePHP environment
What to do if ʻObject arrays cannot be loaded when allow_pickle = False` occurs in numpy.load ()
What do you do with configuration management of a server that has implemented Ansible but is already running? I'm hitting the problem