Subject: SIOCAIFADDR vs ifconfig
To: None <>
From: Tomas Berndtsson <>
List: tech-net
Date: 09/22/2001 20:28:19

On NetBSD/powermac have a program where I use ioctl SIOCAIFADDR to add
an alias to lo0. I add Ifconfig -A lo0
then tells me:

lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 33228
        inet netmask 0xff000000
        inet alias netmask 0xffffff00

And netstat -rn:

127                UGRS        0        0  33228 lo0          UH          1       64  33228 lo0     UH          0        0  33228 lo0

This looks perfectly alright to me, but when I try to ping, I get:

PING ( 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host

Now, if I add the same alias, using ifconfig:

ifconfig lo0 netmask alias

I get the exact same output from ifconfig -A lo0 and netstat -rn as
when I added it using my program, but now I can suddenly ping it. 

I've been trying to read the source of ifconfig to see if it does
anything more than SIOCAIFADDR to set the alias, but I can't see that
it does. Can anyone enlighten me on this?