How to add an IP address to loopback interface on Mac

Create file /Library/LaunchDaemons/yourname.plist with the following content:

<plist version="1.0">
            <string>Your Label</string>

and reboot the machine.

Follow me:
Latest posts by saki (see all)

4 Responses

  1. I rarely comment, however after browsing a bunch of remarks on How to add an IP address to loopback interface on Mac | Saki’s Blog. I actually do have 2 questions for you if it’s okay.

    Could it be just me or does it look like some of these responses look as if they are coming from brain dead visitors?

    😛 And, if you are posting on additional online social
    sites, I’d like to follow you. Would you make a list of every one of your social networking sites like your twitter feed, Facebook page or linkedin profile?

  2. Andi,
    adding myhost.local myhost

    to /etc/hosts is not enough as it doesn’t create IP on lo adapter. I’ve tested it right now on SL 10.6.5.

    I should have explained better: The point here is not if mask is “usual or not” neither if I have to reboot or not. Sure I do not need to reboot as it is enough to run command:

    sudo ifconfig lo0 netmask

    The whole point is how to make this change permanent so I do not need to run this command after each reboot. Therefore the reboot in the original post: to verify that everything went right.

  3. With the release of Snow Leopard, there is a watcher on /etc/hosts…
    just do your edits there, like under any other *nix, and the changes will get picked up immediately.
    SL will also automatically update other places like /private/etc/hosts afterwards.

  4. Very strange…

    First, netmask for loopback interface usually is
    Second, reboot just to add address sounds very oldfashioned.
    Third, at least under linux, one could use any 127.x.y.z addresses without setting any alias at all. I often use ssh -L 127.x.y.z:2222:10.x.y.z:22 user@gw commands to access boxes behind firewall when VPNs do not work. And I don’t have to setup any aliases. lo0 does the magic.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your username and password to log into your account. Don't have an account? Sign up.

Want to collaborate on an upcoming project?