UPnP protocol learning notes-addressing

Source: Internet
Author: User


UPnP protocol learning note-Addressing is step 1 of UPnP network connection. IP addresses are obtained through Addressing, device, and control points. The UPnP Device and control point can only support IPv4, IPv4, and IPv6 at the same time. For each control device or control point, if they do not implement a DHCP server, when they first access the UPnP network, you must use a DHCP client to search for DHCP servers (if they implement DHCP servers themselves, you can assign an IP address to yourself from the address pool ). If a DHCP server exists, such as a hosted network, the device and control point must use the assigned IP address. If the DHCP server is unavailable, such as in an unmanaged network, the device or control point must use Auto-IP to obtain the IP address. The Auto-IP in RFC3927 defined by www.2cto.com defines the device or control point: 1) determines whether the DHCP server is available; 2) selects an IP address in the local IP address set of the link. This address allocation method allows devices or control points to move freely between hosted and unmanaged networks. 1) determine whether to use Auto-IP when the device or control point supports Auto-IP and Dynamic Address Allocation, first, it sends a DHCPDISCOVER message to the DHCP server to request an IP address. The timeout time for the DHCP client to listen to the DHCPOFFER response depends on the specific implementation. If the device or control point receives a DHCPOFFER message within the time-out period, they must continue the Dynamic Address Allocation operation. If no valid DHCPOFFER message is received, they must use Auto-IP to obtain an IP address. 2) Select an IP address. In order to use Auto-IP to automatically configure an IP address, the device or control point uses the algorithm defined by the specific implementation to select an IP address within the range of 169.254/16. Note that, the first and last 256 addresses in this range are retained and cannot be used. The selected IP address must be tested to verify whether the IP address has been used. If the address has been used by another device or control point, select another IP address and repeat the test operation until the number of retries defined in the specific implementation is reached. The address selection mechanism must be random to ensure that the addresses allocated by multiple devices or control points do not conflict. The device or control point uses a pseudo-random algorithm (the address value is distributed between 169.254.1.0 and 169.254.254.255) to minimize the number of devices or control points connected to the UPnP network at the same time and select the same IP address, and reselect the same IP address sequence after the conflict. The MAC address of the device or control point can be used as the seed of the pseudo-random algorithm. Www.2cto.com 3) Test the IP address. In order to test whether the selected IP address conflicts, the device or control point uses the ARP Protocol to detect the IP address. ARP detection is implemented by sending ARP requests with the hardware address and IP address (set to all 0) of the device or control point, and ARP response listening is required. ARP detection can be repeated multiple times to determine whether the IP address is not used. It is recommended that ARP detection be sent four times at intervals of 2 seconds. After the local link IP address is successfully configured, the device or control point must send two free ARP requests at an interval of 2 s and fill in the configured IP address. The two ARP requests aim to refresh the ARP cache tables that have expired on other hosts on the network.
Control devices or control points with persistent storage can record the IP addresses they have selected and use the IP address as the preferred IP address for ARP detection at the next startup. This improves addressing stability, reduce address resolution conflicts. Address conflict detection is not only used in the address test phase, as long as the device or control point is still using the link local IP address, the address conflict detection will continue. At any time, as long as the device or control point receives the IP address of the sender in the ARP packet conflicts with its local IP address, and the hardware address of the sender is different from the local hardware address, the address conflict occurs, the device or control point must make one of the following responses: 1) reconfigure a new local link IP address, as described above; 2) if the device or control point has an activated TCP connection or other reasons, the existing IP address must be kept and no conflicting ARP packet has been received in the recent period (for example, the last 10 s, then the device or control point can choose to try to retain the existing address once. This is achieved by recording the time when the conflicting ARP packet is received, and broadcasting a free ARP request containing the local IP address and hardware address as the source address. However, if a conflicting ARP packet is received within 10 seconds after receiving it, the device or control point must immediately re-assign a new IP address through Auto-IP. The device or control point must use one of the above two methods to respond to the received conflicting ARP packet, rather than ignoring it. If a new IP address is selected, the device or control point must cancel the previous announcement and re-advertise with the new IP address. After the Auto-IP address is successfully configured, all ARP packets (requests or replies) that subsequently contain the IP address as the source address must be sent using link-level broadcast instead of link-level unicast, this is to promptly discover duplicate addresses. Www.2cto.com 4) IP packets with the source address or destination address within the range of 169.254/16 cannot be sent to the router for forwarding. On the contrary, the sender must obtain the destination hardware address through the ARP protocol and send the data packet directly to the destination address on the same link. IP datagram with multicast Destination Address and Auto-IP source address cannot be forwarded outside the local link. The device or control point can assume that all the destination addresses in the range of 169.254/16 are local and direct. IP addresses in the range of 169.254/16/16 cannot be neted. 5) periodically detect available dynamic addresses. devices or control points of IP addresses are automatically configured through the Auto-IP mechanism. You must periodically check whether the DHCP server is available. This can be achieved by sending DHCPDISCOVER messages. As for the detection cycle, it is defined by specific implementation. Once every 5 minutes, the network bandwidth and connectivity maintenance can be balanced. If you receive a DHCPOFFER response message, the device or control point must continue to perform Dynamic Address allocation. Once an IP address is assigned through the DHCP server, the device or control point can release the automatically configured IP address, or you can choose to hold the automatically assigned IP address (for a period of time or indefinitely) to maintain the existing connection. To switch to a new IP address, the device should cancel any notices issued on the old address and re-advertise the new IP address. For a multi-host device with multiple IP addresses, this device should cancel any notifications issued on the old address and re-advertise the device on the new address, it must also be updated on all IP addresses not affected by the local machine. 6) device naming and DNS interaction once a device has a valid IP address in the network, it can be located and accessed in the network. For end users, a friendly device name is easier to use than an IP address. In this case, the device can provide a host name to the DHCP server, from the DHCP server to the DNS server to register the ing between the host name and IP address of the device, and then you can use the host name to access the device. In most cases, the device uses an IP address-based URL link instead of a host name. Www.2cto.com 7) Resolution from name to IP address when a device wants to access another device identified by DNS name, it must submit a DNS query request to the DNS server, to obtain the IP address corresponding to the name. The device can use the DNS Server LIST statically for pre-configuration. You can also use the DHCP server to configure the DNS server list, or send a DHCPINFORM message after the IP address is assigned.
 

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.