| TTL | Scope |
| 0 | Restricted to the same host. Won't be output by any interface. |
| 1 | Restricted to the same subnet. Won't be forwarded by a router. |
| Restricted to the same site, organization or department. | |
| Restricted to the same region. | |
| Restricted to the same continent. | |
| Unrestricted in scope. Global. | |
Mapping of IP Multicast Addresses to Ethernet/FDDI addresses
Both Ethernet and FDDI frames have a 48 bit destination address field.
In order to avoid the need for a kind of multicast ARP to map multicast IP
addresses to ethernet/FDDI ones, the IANA reserved a range of
addresses for multicast: every ethernet/FDDI frame with its
destination in the range 01-00-5e-00-00-00 to 01-00-5e-ff-ff-ff (hex)
contains data for a multicast group. The prefix 01-00-5e identifies
the frame as multicast, the next bit is always 0 and so only 23 bits
are left to the multicast address. As IP multicast groups are 28 bits
long, the mapping can not be one-to-one. Only the 23 least significant
bits of the IP multicast group are placed in the frame. The remaining
5 high-order bits are ignored, resulting in 32 different multicast
groups being mapped to the same ethernet/FDDI address. This means that
the ethernet layer acts as an imperfect filter, and the IP layer will
have to decide whether to accept the datagrams the data-link layer
passed to it. The IP layer acts as a definitive perfect filter.
Full details on IP Multicasting over FDDI are given in RFC 1390:
Transmission of IP and ARP over FDDI Networks.
MBone
Using a new technology usually carries some advantages and
disadvantages. The
main disadvantage is that hundreds of hosts and, specially, routers
don't support it yet. As a consequence, people who started working on
multicast, bought new equipment, modified their operating systems, and
built multicast islands in their local places. Then they discovered
that it was difficult to communicate with people doing similar things
because if only one of the routers between them didn't support
multicast there was no way to get multicasting working between them.
The solution was clear: they decided to build a virtual multicast
network in the top of the Internet. That is: sites with multicast
routers between them could communicate directly. But sites joined
across unicast routers would send their island's multicast traffic
encapsulated in unicast packets to other multicast islands. Routers in
the middle would not have problems, as they would be dealing with
unicast traffic. Finally, in the receiving site, traffic would be de-
encapsulated, and sent to the island in the original multicast way.
Two ends converting from multicast to unicast, and then again to
multicast define what is called a multicast tunnel.
The MBone or Multicast Backbone is that virtual multicast network
based on multicast islands connected by multicast tunnels.
Several activities take place in the MBone daily, but it deserves to
be remarked the profusion of tele-conferences with real time audio and
video taking place across the whole Internet. For more Information on the
MBone, see:
http://www.mediadesign.co.at/newmedia/more/mbone-faq.html
Multicast addresses are IP
addresses in the range of 224.0.0.0 to 239.255.255.255.
There are some special multicast groups, say well known multicast groups, you should not use in your particular applications due the special purpose they are destined to:
Multicasting and linux
Linux is, full Level-2 Multicast-Compliant. It meets all requirements to
send, receive and act as a router (mrouted) for multicast datagrams.
Once the kernel is configured and installed, you should
provide a default route for multicast traffic. The goal is to add a
route to the network 224.0.0.0:
route add 224.0.0.0 netmask 240.0.0.0 dev eth0
Construction of multicast sockets
If we do not define a port number, the socket is bound to an anonymous port.
import sun.net.*;
import java.net.*;
import java.io.*;
public class MulticastConstructor {
public static void main(String[] args){
try{
MulticastSocket ms = new MulticastSocket(5500);
System.out.println(ms);
}
catch (SocketException se) {
System.err.println(se);
}
catch (IOException ie) {
System.err.println(ie);
}
}
}
Once a MulticastSocket exists, there are four key operations it can
perform:
MulticastSocket class has methods for operations 1, 2 and 4. No new
method is necessary for receiving data.
public void joinGroup(InetAddress mcastaddr) throws SocketException; public void leaveGroup(InetAddress mcastaddr) throws SocketException; public synchronized void send(DatagramPacket dp, byte ttl) throws SocketException, IOException;Most multicast servers do not discriminate any clients. Therefore it is easy to join a group and watch the data that is being sent to it:
import sun.net.*;
import java.net.*;
import java.io.*;
public class MulticastSniffer{
public static void main(String[] args) {
InetAddress ia = null;
byte[] buffer = new byte[65535];
DatagramPacket dp = new DatagramPacket(buffer, buffer.length);
int port = 0;
//read the address from the command line
try{
try {
ia = InetAddress.getByName(args[0]);
}
catch (UnknownHostException e) {
System.err.println(e);
}
port = Integer.parseInt(args[1]);
}// end try
catch (Exception e) {
System.err.println(e);
System.err.println
("Usage: java MulticastSniffer MulticastAddress port");
System.exit(1);
}
try{
MulticastSocket ms = new MulticastSocket(port);
ms.joinGroup(ia);
while (true) {
ms.receive(dp);
String s = new String(dp.getData(),0,dp.getLength());
System.out.println(s);
}
}
catch (SocketException se) {
System.err.println(se);
}
catch (IOException ie) {
System.err.println(ie);
}
}
}