Create a localhost alias

It is often helpful to be able associate a private IP address with the local loopback. This may be required to allow references to host services from within the private network space of a Docker container for example.

Configure a Local Network Interface in Mac OSX

We will associate a private IP address with the lo0 ( network interface of our Mac. Create /Library/LaunchDaemons/ca.epbc.loopback-dev.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Note you will have to reboot your Mac for the alias to take effect. Modify /etc/hosts Then add the following local hostnames to /etc/hosts:

$ echo " dev myapp" >> /etc/hosts

On Windows (in PowerShell?):

$ netsh interface ip add address "Local Dev Connection"
$ echo " dev myapp" >> C:\Windows\System32\Drivers\etc\hosts

Note: I’m on a Mac so Windows users please apply the required edits to make the above work - apparently you can accomplish the same thing using the advanced network interface properties screen. Also, I’m not sure if the above setting for Windows will survive logout or reboot.

When you are done confirm that you can ping the above local host names.