TCP/IP Concepts   «Prev  Next»
 Lesson 7 IP address Conventions Objective What is the Structure of an IP Address?

# Structure of an IP Address

Question: How is the structure of an IP address different in IPV6 when compared to IPV4?
The structure of an IP address in IPv6 significantly differs from IPv4 in terms of address length, format, and representation, reflecting the evolution of the Internet and the need for more available addresses.
1. Address Length: An IPv4 address is 32 bits long, divided into four 8-bit fields. This design yields approximately 4.3 billion unique addresses. In contrast, an IPv6 address is 128 bits long, segmented into eight 16-bit fields, offering a vastly larger address space. Theoretically, IPv6 can provide about 3.4 x 10^38 unique IP addresses.
2. Address Representation: IPv4 addresses are expressed in decimal notation, with each 8-bit field represented by a decimal number ranging from 0 to 255, separated by periods (dot-decimal format). For example, 192.0.2.1 is a valid IPv4 address.
IPv6 addresses, on the other hand, are represented in hexadecimal notation, with each 16-bit field represented by a four-digit hexadecimal number, separated by colons. For instance, 2001:0db8:85a3:0000:0000:8a2e:0370:7334 is a valid IPv6 address.
3. Address Compression: IPv6 includes two methods for compressing the representation of addresses: leading zero compression and zero-segment compression.
1. Leading Zero Compression: Any leading zeroes in each 16-bit field can be removed. For example, the address 2001:0db8:85a3:0000:0000:8a2e:0370:7334 can be compressed to 2001:db8:85a3:0:0:8a2e:370:7334.
2. Zero-segment Compression: One sequence of consecutive 16-bit fields consisting entirely of zeroes in an address can be replaced with "::". Using this method, the above address can be further compressed to 2001:db8:85a3::8a2e:370:7334.
4. Address Types: Both IPv4 and IPv6 have the concept of different types of addresses (like unicast, multicast, and anycast addresses). However, the IPv6 address architecture introduces new types of addresses and deprecates some from IPv4. For example, IPv6 does not include broadcast addresses, commonly used in IPv4, as the functionality of sending a packet to all nodes on a network can be achieved using multicast addresses.
5. Embedded IPv4 Addresses: IPv6 also allows for the embedding of IPv4 addresses within its structure to aid the transition from IPv4. These are typically represented in a format that includes the IPv4 address at the end of the IPv6 address, for example, ::FFFF:192.0.2.1.

IPv6 offers a more complex, but more capable, address structure compared to IPv4. The vastly expanded address space, along with other enhancements, allows for the continued growth and evolution of the Internet.

## Fundamental Notions of IP Addressing

Before discussing TCP/IP configuration in detail, we should briefly recall the fundamental notions of IP addressing and netmasks [1]. Every machine on a TCP/IP network must have a unique 32-bit identifying number called its IP, or Internet Protocol address. IP addresses are usually written in the familiar “dotted decimal” form:
```xxx.yyy.zzz.www
```

where `xxx`, `yyy`, `zzz`, and `www` are integers between 0 and 255, each corresponding to one byte of the 32-bit address.

An IP address has two parts, 1) a network address and 2) a host address. This division simplifies routing.
A routing machine can make decisions about where to send information based on the network portion of the address, without looking at the full IP address. This ability leaves fewer possibilities to consider, so the decision may be made faster.

### How the address is divided

How the IP address is divided between host and network portions depends partly on local policy and partly on Internet rules.
The rule part is reflected in the classification of IP addresses into Class A, Class B, and Class C addresses based on their first byte. As the table below shows, Class A addresses use the first byte for the network address, and the remaining bytes for the host address; and Class C addresses use the first three bytes as network address, with the last byte as host address.

 Type First Byte Range Number of Bytes for Network Number of Bytes for Host Class A 0-127 1 3 Class B 128-191 2 2 Class C 192-222 3 1 Reserved 223-255 N/A N/A

### Standard Conventions

Several standard conventions govern the use of IP addresses:
1. An IP address with all host bits set to zero refers to an entire network. For example, the address 192.133.17.12 is a Class C address (because the first byte is 192, which falls in the Class C range). Then the network address is 192.133.17.0, which is obtained by setting all host bits to zero.
2. An IP address with all host bits set to one is the broadcast address for that network. The broadcast address is used to speak simultaneously to all hosts on that network. For example, the address 192.133.17.255 (which has all eight host bits set to one) is the broadcast address for the 192.133.17.0 network.
3. The address 127.0.0.1 is reserved by TCP/IP. It is called the “loopback” address, and always refers to the local machine. Thus, any connection to 127.0.0.1 loops back to its origin.
4. The address 0.0.0.0 refers to the first configured interface on a machine.