Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a website that uses CakePHP and in the current database configuration the developer before me is using the public IP of our database server. Should I use the local IP when accessing the web server? Will there be any kind of performance increase gained by switching to the local IP?

My understanding is that the router will look at the external IP and realize that it's an address on it's own network and just route the traffic accordingly. Considering that sort of thing is more than likely cached in a good router my guess is I should not actually see any difference.

Also, is there any actual reason for using the external IP vs the local one?

Thanks in advance for any help!

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I would use a public IP only as a last result.

I think in order of best connection to mysql would be

  • unix socket (named pipe in windows)
  • localhost (127.0.0.1)
  • private (internal) ip
  • public ip

IMO, this list is in order of all important factors: speed, ease of setup, and security.

As you move down the list, you have to open more and more of your server and mysql up which can lead to more points of attack. And as mentioned by ErikA you also introduce more possible points of failure.

share|improve this answer

You should use the local one. You're not gaining anything by using the public IP, and are introducing additional points of possible failure.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.