4 ms·
On OSX (and, I suspect, vanilla FreeBSD), this looks like (replacing 127.1.2.3 with the address you want to use; 0xff000000 must stay the same, since netmasks o
by JonathonW 10y ago
On OSX (and, I suspect, vanilla FreeBSD), this looks like (replacing 127.1.2.3 with the address you want to use; 0xff000000 must stay the same, since netmasks of all addresses on an interface must not confict if they're on the same subnet):
sudo ifconfig lo0 alias 127.1.2.3 0xff000000
And then, when you're done:
sudo ifconfig lo0 -alias 127.1.2.3
to tear it back down.
- inferiorhuman 10y agoOn FreeBSD at least you can assign whatever address you want to a loopback interface. I'm currently using aliases on a loopback device (lo1 in this case) for host <-> jail communication. The jails get 172.16.0.0/16. You can manage this trivially in rc.conf and then restart the netif and route services.
- X-Istence 10y agoRecommendation for aliases on an interface is to use 255.255.255.255 as the netmask on FreeBSD. For example to add extra interfaces to lo0 on FreeBSD you may use: ipv4_addrs_lo0="127.0.0.2-5/8" in rc.conf And now those addresses are automatically assigned to lo0, the netmask will be set to 255.255.255.255 automatically for all but the first in that range (.2). Since 127.0.0.1 is unconditionally assigned to lo0, you could also use: ipv4_addrs_lo0="127.0.0.2-5/32" This is what I do on FreeBSD.