TCP/IP Study Notes (7)-broadcast and multicast, IGMP Protocol

Source: Internet
Author: User
1. Introduction to unicast, multicast, and broadcast 1. 1. Unicast (unicast)

Unicast means data transmission to a specific host. For example, an IP packet is sent to a host. At this time, the data link layer is given in the Data header is very specific destination address, for Ethernet, is the nic mac address (not FF-FF-FF-FF-FF-FF such address ). The current host with the routing function should be able to distribute unicast data in a targeted manner, while the network interface of the target host can filter out data inconsistent with its own MAC address.

1. 2. Broadcast (unicast)

Broadcast is a packet sent by a host to all hosts on a network. This network may be a network, a subnet, or all subnets. If it is a network, for example, the broadcast of a type of web site is netid.255.255.255. If it is a subnet, It is netid. netid. subnetid.255; for all subnets (Class B IP addresses), it is netid. netid.255.255. The MAC address FF-FF used by the broadcast. All hosts in the network will receive the broadcast data, the network card as long as the MAC address for the FF-FF-FF-FF-FF-FF of the data to the kernel can be. Generally, ARP or the route protocol rip should be broadcast.

1. 3. Multicasting)

Broadcast is a special case of multicast. multicast sends data to a specific host (multicast group, the data broadcast range is smaller (in fact, the broadcast range is not smaller). The multicast MAC address is the lowest of the highest byte, for example, 01-00-00-00-00-00. The multicast group address is a Class d ip address, which must be 224.0.0.0-239.255.255.255.

Although multicasting is special, the principle is that multicast data must be bound to MAC addresses through the data link layer and then sent. Therefore, after an Ethernet Card is bound to a multicast IP address, it must be bound to a multicast MAC address so that it can work like unicast. This multicast IP address and multicast MAC address have a corresponding algorithm between the p133 and P134 of the book. We can see that this is not a one-to-one correspondence. The host still needs to filter multicast data.

My opinion: the nature of broadcast and multicast is the same. The router puts the data in the LAN, and then the NIC filters the data and only obtains the data you want, for example, multicast data that you are interested in and multicast data that you are interested in. When a host runs a process that processes a multicast IP address, the process binds a virtual multicast MAC address to the NIC and creates a multicast IP address. In this way, the NIC will allow the data with the multicast MAC address to communicate, and those hosts that do not listen to the data will filter out the data. In other words, multicast makes the kernel of the host easy, and nic. Sorry, you are tired.

Some articles also confirm this idea. The most obvious thing is the principle, implementation and prevention of LAN listening.

2. Some validation experiments

These experiments are not very complex. We just need to ping a normal IP address and a broadcast address. First, ping a host in its subnet:

Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time = 1 ms TTL = 255

We can see that the machine returns a response from a host, and then speculate that what if I ping a broadcast address? The result is as follows:

Reply from 192.168.11.9: bytes = 32 time = 1 ms TTL = 255
Reply from 192.168.11.174: bytes = 32 time <1 ms TTL = 64
Reply from 192.168.11.174: bytes = 32 time <1 ms TTL = 64
Reply from 192.168.11.174: bytes = 32 time <1 ms TTL = 64
Reply from 192.168.11.218: bytes = 32 time <1 ms TTL = 64
Reply from 192.168.11.174: bytes = 32 time <1 ms TTL = 64

Ping returns some random IP addresses, all of which are in the same subnet as the host. We can see that the broadcast actually sends messages to all IP addresses in the subnet.

Another example of multicasting is that it is not easy to implement this multicasting, because I don't know how many multicast groups are in the network, we had to use several special multicast addresses for verification.

For multicast addresses, several special multicast addresses are occupied. They are

  1. 224.0.0.1 -- all system groups in this subnet.
  2. 224.0.0.2 -- all routers in this subnet.
  3. 224.0.1.1 -- the network implements the dedicated ntp ip.
  4. 224.0.0.9 -- r00002 private IP Address

Therefore, you only need to ping these IP addresses, for example, Ping 224.0.0.2.

Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255
Reply from 192.168.11.1: bytes = 32 time <1 ms TTL = 255

We can see that this ping only returns a response from one IP address. This is the address of my gateway, which also verifies that 224.0.0.2 is the multicast (Multicast) address of all routers.

3. IGMP Protocol

The role of IGMP is to let all other hosts and routers that need to know which multicast group they are in know their statuses. Generally, a multicast Router does not need to know how many hosts are in a multicast group, but only needs to know whether there are hosts in a multicast group in its subnet. As long as a multicast group has another host, the multicast router will transmit the data so that the receiver can obtain the desired data through the NIC filter function. To know multicast group information, the multicast router needs to regularly send IGMP queries. The IGMP format can be used to read books. The hosts in each multicast group need to reply to their statuses based on the query. The vro determines which multicast groups you want to send data.

The TTL of this query response datagram is generally 1, and no ICMP error is generated even if an error occurs (unnecessary ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.