Networks

There is more than one localhost

Well, technically I lied. Of course, localhost maps to just 127.0.0.1 but that is not the only address that points to your local machine. There are actually 16.7 million (2^24) addresses, as the loopback network range is 127.0.0.0/8.

I find it particularly useful to have different loopback addresses per project, while keeping their ports consistent. For example:

Project A development environment

  • 127.0.0.2:3000 http server
  • 127.0.0.2:5432 postgres
  • 127.0.0.2:6379 redis

Project B development environment