This question already has an answer here:

I want to add a second IP address on my Mac like on Ubuntu.

On Ubuntu I use this:

$ sudo ip addr add dev eth0

On my Mac I used this:

$ sudo ifconfig en0 alias

On Ubuntu every computer on my local network can reach, however on my Mac it's not the same behavior, I can reach the local IP only on the computer and not on the others.

Do you know what can be the problem?

marked as duplicate by Allan macos Apr 15 at 20:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you sure you've created the alias on the correct interface? - Have you checked which interface connects to your local network? (is it for example a wired or wireless interface, etc.) – jksoegaard Apr 15 at 20:16
  • Your commands look correct, they're consistent w/ these here -osxdaily.com/2009/08/05/…. You may want to try doing the subnet mask broken out vs as CIDR notation, just an idea. – slm Apr 15 at 20:38
  • 1
    You need to be using networksetup. Remember macOS ≠ Linux – Allan Apr 15 at 20:56
  • The linked question isn't really a duplicate, because it only deals with setting an IP address, not adding another one. For this, you'll need to do networksetup -duplicatenetworkservice or -createnetworkservice to create a new "service" on the same hardware port, and only then use networksetup -setmanual to set the new service's address. – Gordon Davisson Apr 16 at 6:12

Browse other questions tagged .