Which IPv6 address corresponds to the loopback address 127.0 0.1 of IPv4

IPv6 Address Formats

An IPv6 address is 128 bits long and is written as eight groups of four hexadecimal digits (base 16 digits represented by the numbers 0-9 and the letters A-F). Each group is separated by a colon (:). For example, FC00:0000:130F:0000:0000:09C0:876A:130B is a complete and valid IPv6 address.

For convenience, IPv6 addresses can be written in a compressed format. Taking the IPv6 address FC00:0000:130F:0000:0000:09C0:876A:130B as an example:

  • Any leading zeroes in a group can be omitted. The example address now becomes FC00:0:130F:0:0:9C0:876A:130B.
  • A double colon (::) can be used when two or more consecutive groups contain all zeros. The example address now becomes FC00:0:130F::9C0:876A:130B.

An IPv6 address can contain only one double colon (::). Otherwise, a computer cannot determine the number of zeros in a group when restoring the compressed address to the original 128-bit address.

IPv6 Address Structure

IPv6 addresses have two parts:

  • Network prefix: Corresponds to the network ID of an IPv4 address. It is comprised of n bits.

  • Interface identifier (interface ID): Corresponds to the host ID of an IPv4 address. It is comprised of 128-n bits.

If the first 3 bits of an IPv6 unicast address are not 000, the interface ID must contain 64 bits. If the first 3 bits are 000, there is no such limitation.

You can manually configure the interface ID, generate it through system software, or generate it in IEEE 64-bit Extended Unique Identifier (EUI-64) format. Generating an interface ID in EUI-64 format is the most common practice.

IEEE EUI-64 standards convert an interface MAC address into an IPv6 interface ID. Figure 8-1 shows a 48-bit MAC address. When used as an interface ID, the first 24 bits (expressed by c) are a vendor identifier, and the last 24 bits (expressed by m) are an extension identifier. If the higher seventh bit is 0, the MAC address is locally unique. During conversion, EUI-64 inserts FFFE between the vendor identifier and extension identifier. The higher seventh bit also changes from 0 to 1 to indicate that the interface ID is globally unique.

For example, if the MAC address is 000E-0C82-C4D4, the interface ID is 020E:0CFF:FE82:C4D4 after the conversion.

Converting MAC addresses into IPv6 interface IDs reduces the configuration workload. When using stateless address autoconfiguration, you only need an IPv6 network prefix to obtain an IPv6 address. One defect of this method, however, is that an IPv6 address is easily calculable based on a MAC address, and could therefore be used for malicious attacks.

IPv6 Address Types

IPv6 addresses can be classified as unicast, multicast, or a new class called anycast. Unlike IPv4, there is no broadcast IPv6 address. Instead, a multicast address can be used as a broadcast address.

IPv6 Unicast Address

An IPv6 unicast address identifies an interface. Since each interface belongs to a node, the IPv6 unicast address of any interface can identify the relevant node. Packets sent to an IPv6 unicast address are delivered to the interface identified by that address.

IPv6 defines multiple types of unicast addresses, including the unspecified address, loopback address, global unicast address, link-local address, and unique local address.

  • Unspecified address

    The IPv6 unspecified address is 0:0:0:0:0:0:0:0/128 or ::/128, indicating that an interface or a node does not have an IP address. It can be used as the source IP address of some packets, such as Neighbor Solicitation (NS) messages, in duplicate address detection. Devices do not forward packets with an unspecified address as the source IP address.

  • Loopback address

    The IPv6 loopback address is 0:0:0:0:0:0:0:1/128 or ::1/128. Similar to the IPv4 loopback address 127.0.0.1, the IPv6 loopback address is used when a node needs to send IPv6 packets to itself. This IPv6 loopback address is usually used as the IP address of a virtual interface, such as a loopback interface. The loopback address cannot be used as the source or destination IP address of packets needing to be forwarded.

  • Global unicast address

    An IPv6 global unicast address is an IPv6 address with a global unicast prefix, which is similar to an IPv4 public address. IPv6 global unicast addresses support route prefix summarization, helping limit the number of global routing entries.

    Figure 8-2 shows a global unicast address consisting of a global routing prefix, subnet ID, and interface ID.

    Figure 8-2  Global unicast address format

    These components are described as follows:

    Global routing prefix: is assigned by a service provider to an organization. A global routing prefix is comprised of at least 48 bits. Currently, the first 3 bits of every assigned global routing prefix is 001.

    Subnet ID: is used by organizations to construct a local network (site). Similar to an IPv4 subnet number, there are a maximum of 64 bits for both the global routing prefix and subnet ID.

    Interface ID: identifies a device (host).

  • Link-local address

    Link-local addresses are used only in communication between nodes on the same local link. A link-local address uses a link-local prefix of FE80::/10 as the first 10 bits (1111111010 in binary) and an interface ID as the last 64 bits.

    When IPv6 runs on a node, a link-local address that consists of a fixed prefix and an interface ID in EUI-64 format is automatically assigned to each interface of the node. This mechanism enables two IPv6 nodes on the same link to communicate without any configuration, making link-local addresses widely used in neighbor discovery and stateless address configuration.

    Devices do not forward IPv6 packets with the link-local address as a source or destination address to devices on different links.

    Figure 8-3 shows the link-local address format.

    Figure 8-3  Link-local address format

  • Unique local address

    Unique local addresses are used only within a site. Site-local addresses, according to RFC 3879, have been replaced by unique local addresses.

    Unique local addresses are similar to IPv4 private addresses. Any organization that does not obtain a global unicast address from a service provider can use a unique local address. However, they are routable only within a local network, not the Internet as a whole.

    Figure 8-4 shows the unique local address format.

    Figure 8-4  Unique local address format

    These components are described as follows:

    Prefix: is fixed as FC00::/7.

    L: is set to 1 if the address is valid within a local network. The value 0 is reserved for future expansion.

    Global ID: indicates a globally unique prefix, which is pseudo-randomly allocated (for details, see RFC 4193).

    Subnet ID: identifies a subnet within the site.

    Interface ID: identifies an interface.

    A unique local address has the following features:

    • Has a globally unique prefix that is pseudo-randomly allocated with a high probability of uniqueness.
    • Allows private connections between sites without creating address conflicts.
    • Has a well-known prefix (FC00::/7) that allows for easy route filtering at site boundaries.
    • Does not conflict with any other addresses if it is accidentally routed offsite.
    • Functions as a global unicast address to applications.
    • Is independent of Internet Service Providers (ISPs).

IPv6 Multicast Address

Like IPv4 multicast addresses, IPv6 multicast addresses identify groups of interfaces, which usually belong to different nodes. A node may belong to any number of multicast groups. Packets sent to an IPv6 multicast address are delivered to all the interfaces identified by the multicast address. For example, the multicast address FF02::1 indicates all nodes within the link-local scope, and FF02::2 indicates all routers within the link-local scope.

An IPv6 multicast address is composed of a prefix, a flag, a scope, and a group ID (global ID).

  • Prefix: is fixed as FF00::/8.
  • Flag: is 4 bits long. The high-order 3 bits are reserved and must be set to 0s. The last bit 0 indicates a permanently-assigned, well-known multicast address allocated by the Internet Assigned Numbers Authority (IANA). The last bit 1 indicates a non-permanently-assigned (transient) multicast address.
  • Scope: is 4 bits long. It limits the scope where multicast data flows are sent on the network. Figure 8-5 shows the field values and meanings.
  • Group ID (global ID): is 112 bits long. It identifies a multicast group. RFC 2373 does not define all the 112 bits as a group ID but recommends using the low-order 32 bits as the group ID and setting all of the remaining 80 bits to 0s. In this case, each multicast group ID maps to a unique Ethernet multicast MAC address (for details, see RFC 2464).

Figure 8-5 shows the IPv6 multicast address format.

Figure 8-5  IPv6 multicast address format

  • Solicited-node Multicast Address

    A solicited-node multicast address is generated using an IPv6 unicast or anycast address of a node. When a node has an IPv6 unicast or anycast address, a solicited-node multicast address is generated for the node, and the node joins the multicast group that corresponds to its IPv6 unicast or anycast address. Each unicast or anycast address corresponds to a single solicited-node multicast address, which is often used in neighbor discovery and duplicate address detection.

    IPv6 does not support broadcast addresses or Address Resolution Protocol (ARP). In IPv6, Neighbor Solicitation (NS) packets are used to resolve IP addresses to MAC addresses. When a node needs to resolve an IPv6 address to a MAC address, it sends an NS packet in which the destination IP address is the solicited-node multicast address corresponding to the IPv6 address.

    The solicited-node multicast address consists of the prefix FF02::1:FF00:0/104 and the last 24 bits of the corresponding unicast address.

IPv6 Anycast Address

An anycast address identifies a group of network interfaces, which usually belong to different nodes. Packets sent to an anycast address are delivered to the nearest interface that is identified by the anycast address, depending on the routing protocols.

Anycast addresses implement redundancy backup and load balancing functions when multiple hosts or nodes are provided with the same services. Currently, a unicast address is assigned to more than one interface to make a unicast address become an anycast address. When sending data packets to anycast addresses, senders cannot determine which of the assigned devices will receive the packets. Which device receives the packets depends on the routing protocols running on the network. Anycast addresses are used in stateless applications, such as Domain Name Service (DNS).

IPv6 anycast addresses are allocated from the unicast address space. Mobile IPv6 applications also use anycast addresses.

IPv6 anycast addresses can be assigned only to routing devices but not hosts. Anycast addresses cannot be used as the source IP addresses of IPv6 packets.

  • Subnet-router Anycast Address

    RFC 3513 predefines a subnet-router anycast address. Packets sent to a subnet-router anycast address are delivered to the nearest device on the subnet identified by the anycast address, depending on the routing protocols. All devices must support subnet-router anycast addresses. A subnet-router anycast address is used when a node needs to communicate with any of the devices on the subnet identified by the anycast address. For example, a mobile node needs to communicate with one of the mobile agents on the home subnet.

    In a subnet-router anycast address, the n-bit subnet prefix identifies a subnet, and the remaining bits are padded with 0s. Figure 8-6 shows the subnet-router anycast address format.

    Figure 8-6  Subnet-router anycast address format

What is the loopback IP address 127.0 0.1 used for?

The IP address 127.0. 0.1 is called a loopback address. Packets sent to this address never reach the network but are looped through the network interface card only. This can be used for diagnostic purposes to verify that the internal path through the TCP/IP protocols is working.

Is IPv4 address 127.0 0.1 a special address?

The IP address 127.0. 0.1 is a special-purpose IPv4 address and is called the localhost or loopback address. All computers use this address as their own, but it doesn't let computers communicate with other devices as a real IP address does.

Which IPv6 address is used as the loopback address?

The most commonly used IP address on the loopback network is 127.0. 0.1 for IPv4 and ::1 for IPv6. The standard domain name for the address is localhost.

Why is 127 called loopback address?

No datagram “sent” to a network 127 address should ever appear on any network anywhere. 0 and 127 were the only reserved Class A networks by 1981. 0 was used for pointing to a specific host, so that left 127 for loopback.