Establishing a Default Multicast Interface
CyberData Corporation
930367H
Operations Guide
54
A final multicast-related extension is independent of IP: two new ioctls, SIOCADDMULTI and
SIOCDELMULTI, are available to add or delete link-level (e.g., Ethernet) multicast addresses
accepted by a particular interface. The address to be added or deleted is passed as a sockaddr
structure of family AF_UNSPEC, within the standard ifreq structure. These ioctls are for the use of
protocols other than IP, and require superuser privileges. A link-level multicast address added via
SIOCADDMULTI is not automatically deleted when the socket used to add it goes away; it must be
explicitly deleted. It is inadvisable to delete a link-level address that may be in use by IP. (These
ioctls already exist in SunOS and Ultrix; they are new to BSD Unix.)
Drivers that have been modified to support multicasting also support the IFF_PROMISC and
IFF_ALLMULTI interface flags, to the degree possible.
The kernel modification required to support Van Jacobson's traceroute program is also included in
this release.
Examples of usage of the above facilities can be found in the programs accompanying this
distribution, such as "ping", "mtest" and "rwhod".
C.3 Establishing a Default Multicast Interface
Selection of the default multicast interface is controlled via the kernel (unicast) routing table. If there
is no multicast route in the table, all multicasts will, by default, be sent on the interface associated
with the default gateway. If that interface does not support multicast, attempts to send will receive
an ENETUNREACH error.
A route may be added for a particular multicast address or for all multicast addresses, to direct them
to a different default interface. For example, to specify that multicast datagrams addressed to
224.0.1.3 should, by default, be sent on the interface with local address 36.2.0.8, use the following:
/etc/route add 224.0.1.3 36.2.0.8 0
To set the default for all multicast addresses, other than those with individual routes, to be the
interface with local address 36.11.0.1, use:
/etc/route add 224.0.0.0 36.11.0.1 0
If you point a multicast route at an interface that does not support multicasting, an attempt to
multicast via that route will receive an ENETUNREACH error.
If needed, these commands normally would be added to the /etc/rc.ip or /etc/rc.local file, to take
effect every time the system is booted.