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.
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.
If it doesn't work, check the layer order and investigate the cause! I learned at the company before, so I looked it up.
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.
systemctl status firewalld It was stopped.
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.
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.
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! !!
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