Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

IP aliasing on en0

I am trying to add multiple IP addresses to my en0 interface but it is not working as expected.


sudo ifconfig en0 alias 10.0.0.1 255.255.255.255

sudo ifconfig en0 alias 10.0.0.2 255.255.255.255

sudo ifconfig en0 alias 10.0.0.3 255.255.255.255

After doing this, 10.0.0.1 resolves. I can ping.

But not 10.0.0.2 & 10.0.0.3.

Is this a known limitation or bug?

MacBook, macOS High Sierra (10.13.3), null

Posted on Mar 3, 2018 12:44 PM

Reply
Question marked as Best reply

Posted on Mar 9, 2018 12:13 AM

It works if you provide the correct parameters.


You need to explicitly specify the netmask tag:


$ ifconfig en0

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500

ether 8c:85:90:92:da:b8

inet 10.0.0.99 netmask 0xffffff00 broadcast 10.0.0.255

media: autoselect

status: active

$ sudo ifconfig en0 alias 10.0.0.98 netmask 255.255.255.255

$ ifconfig en0

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500

ether 8c:85:90:92:da:b8

inet 10.0.0.99 netmask 0xffffff00 broadcast 10.0.0.255

inet 10.0.0.98 netmask 0xffffffff broadcast 10.0.0.98

media: autoselect

status: active

$ ping 10.0.0.98

PING 10.0.0.98 (10.0.0.98): 56 data bytes

64 bytes from 10.0.0.98: icmp_seq=0 ttl=64 time=0.086 ms

64 bytes from 10.0.0.98: icmp_seq=1 ttl=64 time=0.091 ms

2 replies
Question marked as Best reply

Mar 9, 2018 12:13 AM in response to ganil

It works if you provide the correct parameters.


You need to explicitly specify the netmask tag:


$ ifconfig en0

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500

ether 8c:85:90:92:da:b8

inet 10.0.0.99 netmask 0xffffff00 broadcast 10.0.0.255

media: autoselect

status: active

$ sudo ifconfig en0 alias 10.0.0.98 netmask 255.255.255.255

$ ifconfig en0

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500

ether 8c:85:90:92:da:b8

inet 10.0.0.99 netmask 0xffffff00 broadcast 10.0.0.255

inet 10.0.0.98 netmask 0xffffffff broadcast 10.0.0.98

media: autoselect

status: active

$ ping 10.0.0.98

PING 10.0.0.98 (10.0.0.98): 56 data bytes

64 bytes from 10.0.0.98: icmp_seq=0 ttl=64 time=0.086 ms

64 bytes from 10.0.0.98: icmp_seq=1 ttl=64 time=0.091 ms

Mar 3, 2018 6:34 PM in response to ganil

Probably a restriction?


I am able to circumvent this problem by using loopback interface.


sudo ifconfig lo0 alias 127.0.0.2 0xff000000

sudo ifconfig lo0 alias 127.0.0.3 0xff000000


and I was able to successfully setup port forwarding on same port across IPs.


But I am interesting in knowing why it didn't work for en0.

IP aliasing on en0

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.