Can someone explain how does one map IP multicast address to ethernet multicast address?
I know for ethernet few addresses are reserved but dont know which ones
Basically you take last 23 bits of IPv4 and add 01:00:5E at the beginning of the multicast MAC, for example:
ip = 224.1.2.3
mac = 0x01005e000000 + ip & 0x7FFFFF
IPv4 multicast packets are delivered using the Ethernet MAC address range 01:00:5e:00:00:00–01:00:5e:7f:ff:ff (with an OUI owned by the IANA). This range has 23 bits of available address space. The first octet (01) includes the broadcast/multicast bit. The lower 23 bits of the 28-bit multicast IP address are mapped into the 23 bits of available Ethernet address space. This means that there is ambiguity in delivering packets. If two hosts on the same subnet each subscribe to a different multicast group whose address differs only in the first 5 bits, Ethernet packets for both multicast groups will be delivered to both hosts, requiring the network software in the hosts to discard the unrequired packets.
Source: Wikipedia or RFC 1112
To convert an IP multicast address to a 48-bit MAC multicast address you need to understand how the 48-bit MAC multicast address came about.
To get a 48-bit MAC address OUI (24 bits, leaving 24 bits for individual addresses) registered with the IEEE used to cost $1000, which was a lot of money in those days. The guy experimenting with multicast couldn't afford it, so he went in with someone else to buy the OUI, and they split it, each getting 23 bits of addressing in the OUI.
An IPv4 multicast address has 28 bits of addressing (224.0.0.0/4, so 32-4=28). You must somehow map the 28 bits of IPv4 addressing into 23 bits of MAC addressing. That means there are 32 times (28-23=5 and 2^5=32) as many IPv4 multicast addresses as there are 48-bit MAC multicast addresses. Each 48-bit MAC multicast address will map to 32 different IPv4 multicast addresses.
The mapping from an IPv4 multicast address to a 48-bit MAC multicast address is pretty simple. Just take the 48-bit MAC multicast OUI of 01-00-5E, append a zero bit, and append the low-order 23 bits of the IPv4 multicast address. That creates the 48-bit MAC multicast address from an IPv4 multicast address.
The reverse mapping is more complex, and it is inexact since each 48-bit MAC multicast address actually represents 32 different IPv4 multicast addresses. You can only recover the last 23 bits of the IPv4 multicast address from the 48-bit MAC multicast address.
Related
I tried to understand mapping multicast IP address to layer 2 ethernet frame i.e IEEE 802.3 multicast frame but didn't understand the concept behind it. I'm will appreciate the answers with examples here, of which mapping of an IP address to Ethernet frame can be explained on the scale side by side.
This is very simple:
For ipv4 :
Mac adress has to start with 01:00:5E the 01 in binary gives 00000001 the the lowest bit of the hihgest byte give multicast or not. This is the first bit received by network card so then can quickly ignore or not multicast packet
So you have 01:00:5E:XX:YY:ZZ the range of available mac adresses goes from 01:00:5e:00:00:00 to 01:00:5e:7f:ff:ff
So you have 23 bits to complete with the 23 lowest bits of the ipv4 adresses
IPV4 adresses multicast go from 224.0.0.0 to 239.255.255.255
So for example OSPF (well know routing protocol) use these ipv4 adresses :
224.0.0.5 that give 01:00:5E:00:00:05
224.0.0.6 that give 01:00:5E:00:00:06
For ipv6 :
ipv6 adress are ff00::/8
You use mac prefix 33:33:XX:YY:ZZ (remark the lowest bit of the highest bytes is 1)
and you complete by the lowest bytes of ipv6 adress
I have around 500 IP addresses. 172.45.67.1 - 172.45.67.200. How do I find the Wifi subnet for these IP addresses? If I could use a java API, that would be great. If not, any other technique to determine the subnet?
Your IP range appears to be part of a Class B IPv4 subnet based on the starting octet value 172.
http://en.wikipedia.org/wiki/IP_address#IPv4_subnetting
As such the subnet mask would be 255.255.0.0.
http://www.subnet-calculator.com/subnet.php?net_class=B
A Class B subnet allows for a maximum of 65,536 addresses.
Your building may be allocated just a slice of that subnet by the people administering that subnet. However, there is no way of knowing how much of that subnet is allocated to the building without further information (if there are 500 addresses, they cannot all be allocated from 172.45.67.* as there are only 255 addresses in that range).
I'm having trouble understanding how multicast addresses work.
First off, is it true that if I have N clients or peers working on separate networks, they all subscribe to the same multicast group, and this group allows any source to send messages, these peers/hosts can all communicate to each other through this group? (sounds like black magic!)
Second, I've heard hints that the IANA controls/regulates the multicast addresses. So do you have to request / ask IANA for a specific multicast address for your project / company? How does this work? Am I mistaken? Can you clarify multicast networking for me?
Thanks much!
Firstly, multicast only works if the routers in the network support it. The IGMP protocol is used for this purpose: http://en.wikipedia.org/wiki/Internet_Group_Management_Protocol. Assuming you have N clients on separate networks connected by multicast capable routers, then they could send messages to a multicast address and other peers that have subscribed to that multicast address will then receive those messages. You can read up further on multicast on Wikipedia.
I think you're confusing IEEE with IANA, the Internet Assigned Numbers Authority (IANA). Have a look at http://www.iana.org/assignments/multicast-addresses/multicast-addresses.xml for multicast address assignments.
Hi All
I ve two PC's A and B which are connected to LAN1 .A is listening on UPNP multicast address 239.255.255.250 .
I have a mobile device D which is connected to a WIFI and the WIFI is connected to LAN1 .
Ip address of PC A is xxx.yyy.209.80 PC B is xxx.yyy.209.81 and device D is xxx.yyy.209.82.
If I send a multicast packet to 239.255.255.250 from PC B it reaches PC A.
But if I send a multicast pakcet from device D it never reaches PC A .Can anyone tell me why ?How to resolve it ?
Thanks in advance
Kozlov
I realize this post is 3 years old but the following information may be useful to someone. I have an iPhone App that uses a 239.x.x.x address and I have issues with certain wireless access points. I found a document that says the following:
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:
224.0.0.1 is the all-hosts group. If you ping that group, all multicast capable hosts on the network should answer, as every
multicast capable host must join that group at start-up on all it's
multicast capable interfaces.
224.0.0.2 is the all-routers group. All multicast routers must join that group on all it's multicast capable interfaces.
224.0.0.4 is the all DVMRP routers, 224.0.0.5 the all OSPF routers, 224.0.013 the all PIM routers, etc. All this special multicast groups are regularly published in the "Assigned Numbers" RFC.
In any case, range 224.0.0.0 through 224.0.0.255 is reserved for local
purposes (as administrative and maintenance tasks) and datagrams
destined to them are never forwarded by multicast routers. Similarly,
the range 239.0.0.0 to 239.255.255.255 has been reserved for
"administrative scoping" (see section 2.3.1 for information on
administrative scoping).
Anyway I changed my address to 238.x.x.x and that did not help with the Netgear R6100 AP. The issue I have seen with Wireshark is that LAN packets are not forwarded to wireless devices. I have not tried the other direction.
Are the following IP adresses - 168.94.254.255 & 168.94.255.254 - used for broadcast, if they belong to B Class? (The adresses were randomly chosen). I suppose 168.94.255.255 would rather be a broadcast adress, but I'm not sure. Thanks in advance!
A class B network in CIDR notation is a /16 network. A broadcast address is where all of the host bits are 1. In your case, the last 16 bits would need to be 1 to be a broadcast address.
168.94.254.255 and 168.94.255.254 each have a zero bit in the last 16 bits, so they are not broadcast addresses.
If your class B is subnetted into /24's, then the 168.94.254.255 address may be a broadcast address if 168.94.254.0/24 is the network address.