0

I have a web server and database server sitting behind a public ip. The webserver is accessible to the public using NAT. A user can create and manage databases from the web server by makeing api calls to the database server using the private ip of the mysql server. But when i try to set the api call using the server's FQDN, it fails.

My server is running Ubuntu 16.04 and the webserver is powered by VestaCP. The database server runs Ubuntu 16.04 with MySQL Server 5.7. The webserver has a local ip of 192.168.1.4 and database server has ip of 192.168.1.6.

My /etc/hosts looks like this 192.168.1.4 cpanel.example.com example 192.168.1.6 db.example.com db

I have tried to set bind-address to 192.168.1.6. What could be wrong?

What could be the problem?

Renjith
  • 21
  • 4
  • If using the ip-address 192.168.1.6 works but the FQDN of the database server does not start by checking if the FQDN actually points to the correct ip-address and is not overruled by a /etc/hosts entry on the web server (`getent hosts FQDN`) – HBruijn May 26 '18 at 06:53
  • @HBruijn Thank you for your reply. I have checked both the server's /etc/hosts entries. In the database server, i have commented the 127.0.0.1 and 127.0.1.1 hosts. Is it OK? – Renjith May 26 '18 at 07:15
  • @Renjith When you say **Cannot connect** do you mean, you can't get any connection (i.e. ping) through to SQL server at all or is it just refusing to login from another machine (i.e.webserver)? – Praveen Premaratne May 26 '18 at 10:58
  • Hi Guys. Got it sorted as it was due to a resolution problem due to the way the network was set up. Sorted it out. Thank you all for your input. – Renjith May 31 '18 at 10:04

0 Answers0