How to Set Up a Local Loopback Alias
This guide shows you how to add a loopback alias on macOS so a locally installed platform is reachable at a fixed address, and how to confirm the alias took effect.
Type |
How-to guide |
Goal |
Reach a locally installed Axual Platform at a stable IP address from the host machine. |
Audience |
Anyone running the platform on their own macOS machine, with |
When to use |
Use this guide before a local installation, and again after every restart of the machine. |
This applies to local installations on macOS only. A cluster installation needs none of it. Some local cluster tools provide their own tunnel process to expose LoadBalancer Services to the host instead; where yours does, the quick-setup guides cover it.
| The alias does not survive a restart. Run the script again after every reboot, or the platform’s host names stop resolving. |
Prerequisites
Confirm the following before you begin.
Access and permissions required
You need the following access and permissions:
-
sudoon the macOS machine. Changing an interface withifconfigneeds it, and so does writing to/etc/hosts.
Add the alias
The script below removes the alias if it is already present and then adds it, so it is safe to re-run. It uses 192.168.99.100 as an example address, and any other free address in the 192.168.99.0/24 range works as well. Whichever you pick, use the same address in the script, in the hosts entry, and everywhere you reach the platform.
-
Save the following script as
loopback-alias.sh. It adds a loopback alias on the address at the top of the file.#!/bin/bash ITF=lo0 ADDRESS=192.168.99.100 ifconfig "$ITF" | grep inet | grep "$ADDRESS" >/dev/null if [ "$?" = "0" ]; then echo "Removing alias $ADDRESS from interface $ITF" sudo ifconfig "$ITF" -alias "$ADDRESS" echo "Adding alias $ADDRESS to interface $ITF" sudo ifconfig "$ITF" alias "$ADDRESS/32" up else echo "Adding alias $ADDRESS to interface $ITF" sudo ifconfig "$ITF" alias "$ADDRESS/32" up fi -
Run the script. It prompts for your password, because
ifconfigruns undersudo.bash ./loopback-alias.shA loopback alias is dropped when the machine reboots, so run the script again after every restart. None of the other steps have to be repeated. -
Add the following entry to your
/etc/hostsfile, using the same address as the script.192.168.99.100 platform.<domain>
Verify the alias
Confirm the address is on the loopback interface.
ifconfig | grep 192.168.99.100
The command reports the address on lo0:
inet 192.168.99.100 netmask 0xffffffff
No output means the alias is not there: the script ran against a different interface, or sudo did not authenticate.
Related pages
-
Deploying Axual Kafka and Axual Governance on Kubernetes covers the case where a tunnel process is needed instead of a loopback alias.