Broadcast, multicast, and Subnet

Source: Internet
Author: User

BroadcastThat is, messages are sent to multiple computers in the subnet at the same time, and all computers in the subnet can receive messages sent from the sender. Each broadcast message contains a special IP address.

There are two types of broadcast message addresses: local broadcast and global broadcast.

When a broadcast message is sent to all computers in the subnet through a local broadcast, other networks are not affected by the local broadcast. We know that IP addresses are divided into two parts: network address and host address. The standard network address consists of the first part of the local network address, the part of the byte address, all of which are 1, is used for the host address part (that is, 255 in decimal format ).

For example, for type B network 192.168.0.0, use the subnet mask 255.0.0 (the network number of this IP address is 192.168, the host number is 0.0, And the subnet mask is the network number of the corresponding IP address of all 1) the local broadcast address is 192.168.255.255, which is expressed as 11000000, 10101000, 11111111, and 11111111 in binary format. The first two bytes are the network address, and the last two bytes are the host address.

Take 192.168.0.0 as an example. If the subnet mask is 255.255.255.0, the local broadcast address is 192.168.0.255. 192.168.0 indicates the network address and 255 indicates the host address in the 192.168.0 subnet.

Global broadcast uses an IP address with all four bytes of 1, that is, 255.255.255.255.255 in decimal notation. This specific broadcast address indicates that the destination of the datagram is all devices on the network. However, because the vro automatically filters out global broadcasts, using this address is meaningless.

Subnet division

The subnet is divided to solve the problem of networkIPInsufficient,

In fact, in A, B, or C class, the host number originally allocated to it is used as the network number..This can alleviate the problem of insufficient network IP addresses..

One subnet 192.168.15.0 is divided into three subnets, one of which has 100 and the other has 60 and 48.

There are three subnets. Therefore, you can borrow up to two subnets from the host number. The subnets can be divided into four subnets (,). On average, each subnet is 2 ^ 6-2 = 62, because the first subnet requires 100 instances, the subnet is divided into one

A subnet contains 100 hosts. Therefore, the binary system requires at least seven host numbers. Because the default subnet mask is 255.255.255.0, The subnet mask is 255.255.255.255.128 and the IP address is 192.168.15.1 ~ 192.168.15.127

A single subnet has 60 hosts. Therefore, the binary system requires at least six host numbers. Because the default subnet mask is 255.255.255.0, The subnet mask is 255.255.255.255.255.192. The IP address is 192.168.15.129 ~ 192.168.15.190

A single subnet contains 48 hosts. Therefore, the binary system requires at least six host numbers. Because the default subnet mask is 255.255.255.0, The subnet mask is 255.255.255.255.255.192. The IP address is 192.168.15.192 ~ 192.168.15.254

Multicast

Although the broadcast communication mode can achieve one-to-many communication needs, because the broadcast is to send messages to all computer users in the subnet, there is no purpose, not only increases the network transmission burden, in addition, the resource consumption is high. The emergence of multicast effectively solves this problem. Multicast is also called multicast. Multicast refers to sending messages from a computer to a computer subset selected on this or the entire network, that is, to the computers that join the specified multicast group. Multicast Groups are open, and each computer can be added to multicast groups at any time or left at any time through programs.

A multicast group is a group of devices that share a multicast address. Similar to IP broadcast, IP multicast uses a special IP address range to represent different multicast groups. The multicast address (Class D address starting with 1110) is a Class d ip address ranging from 224.0.0.0 to 239.255.255.255. Any message sent to the multicast address is sent to all member devices in the group. The Group can be permanent or temporary. Most multicast groups are temporary and only exist when there are members. When creating a new multicast group, you only need to select an address from the address range and construct an object for the address to start sending messages.

When using multicast, pay attention to the TTL (Life Cycle Time to live) value settings. The TTL value is the maximum number of data packets that can be forwarded by the router. When the maximum value is reached, the data packets are discarded. If the default value is used (the default value is 1), it can only be sent in the subnet. You can directly set the TTL value through the TTL attribute of the udpclient object. For example:

Udpclient myudpclient = new udpclient ();

Myudpclient. TTL = 50;

This statement sets the TTL value to 50, that is, up to 50 router forwarding is allowed.

In the udpclient class, use the joinmulticastgroup method to add the udpclient object and TTL to the multicast group, and use dropmulticastgroup to exit the multicast group. For example:

// Create a udpclient instance and set the local port number.

Udpclient = new udpclient (8001 );

Udpclient. joinmulticastgroup (IPaddress. parse ("224.100.0.1 "));

Or:

Udpclient = new udpclient (8001 );

Udpclient. joinmulticastgroup (IPaddress. parse ("224.100.0.1"), 50 );

Among them, 50 is the TTL value.

Ing of multicast IP addresses to MAC addresses

Class D address is the IP address from 224.0.0.0 to 239.255.255.255

224.0.0.0 to 224.0.0.255 are reserved addresses.

224.0.0.1 indicates all Multicast Groups in the subnet

224.0.0.2 indicates all vrouters In the subnet.

224.0.0.5 indicates the OSPF router.

224.0.0.6 indicates the router specified by OSPF

224.0.0.12 indicates the DHCP server

How does a layer-2 MAC address map to a layer-3 IP address?

The first 25 digits of the MAC address are set to 0100.5e, And the last 23 digits correspond to the last 23 digits of the IP address. The first four digits of the multicast IP address are the same, as shown in figure

IP Address: 1110yyyy. yxxxxxxx. XXXXXXXX. XXXXXXXX

MAC address: 0001.20.000000001011110.0xxxxxxx.xxxxxxxx.xxxxxxxx

The following is the same

 

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.