Chapter 2 - The Internet Address Architecture
2.1 Introduction
This chapter deals with IP addresses.
Every device connected to the Internet has at least one IP address.
IP addresses are assigned to devices when they are connected to the global Internet. And the IP addresses should be coordinated so as to not duplicate other addresses in use on the network. This is the same in private networks.
Groups of IP addresses are allocated to users and organizations. The addresses can then be assigned to devices.
Individual users get IP addresses from Internet Service Providers (ISPs).
2.2 Expressing IP Addresses
IPv4 addresses are 32-bit long, and are often represented in dotted-quad notaion or dotted-decimal notation.
IPv6 addresses are 128-bit long. The conventional notation adopted for IPv6 addresses is a series of four hexadecimal numbers called blocks or fields separated by colons. An example IPv6 address containing eight blocks would be written as 5f05:2000:80ad:5800:0058:0800:2023:1d71. A number of agreed-upon simplifications have been standardized for expressing IPv6 addresses [RFC4291]:
- Leading zeros of a block need not be written. In the preceding example, the address could have been written as 5f05:2000:80ad:5800:58:800:2023:1d71.
- Blocks of all zeros can be omitted and replaced by the notation ::. For example, the IPv6 address 0:0:0:0:0:0:0:1 can be written more compactly as ::1. Similarly, the address 2001:0db8:0:0:0:0:0:2 can be written more compactly as 2001:db8::2. To avoid ambiguities, the :: notation may be used only once in an IPv6 address.
- Embedded IPv4 addresses represented in the IPv6 format can use a form of hybrid notation in which the block immediately preceding the IPv4 portion of the address has the value ffff and the remaining part of the address is formatted using dotted-quad. For example, the IPv6 address ::ffff:10.0.0.1 represents the IPv4 address 10.0.0.1. This is called an IPv4-mapped IPv6 address.
- A conventional notation is adopted in which the low-order 32 bits of the IPv6 address can be written using dotted-quad notation. The IPv6 address ::0102:f001 is therefore equivalent to the address ::1.2.240.1. This is called an IPv4-compatible IPv6 address. Note that IPv4-compatible addresses are not the same as IPv4-mapped addresses; they are compatible only in the sense that they can be written down or manipulated by software in a way similar to IPv4 addresses. This type of addressing was originally required for transition plans between IPv4 and IPv6 but is now no longer required [RFC4291].
Bracket characters, [ and ], can be used to surround the IPv6 address in URLs. For example:
http://[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]:443/
refers to port number 443 on IPv6 host 2001:0db8:85a3:08d3:1319:8a2e:0370:7344 using the HTTP/TCP/IPv6 protocols.
[RFC5952] imposes some rules to narrow the range of options while remaining compatible with [RFC4291]:
- Leading zeros must be suppressed (e.g., 2001:0db8::0022 becomes 2001:db8::22).
- The :: construct must be used to its maximum possible effect (most zeros suppressed) but not for only 16-bit blocks. If multiple blocks contain equallength runs of zeros, the first is replaced with ::.
- The hexadecimal digits a through f should be represented in lowercase.
2.3 Basic IP Address Structure
2.3.1 Classful Addressing
Internet’s address structure was defined to let every unicast IP address to have a network portion, to identify the network on which the interface using the IP address was to be found, and a host portion, used to identify the particular host on the network given in the network portion.
An Internet address can be devided into net number and host number.
IP addresses are given out to different sites based on their number of hosts. The partitioning of the address space involved five classes. Each class represented a different trade-off in the number of bits of a 32-bit IPv4 address devoted to the network number versus the number of bits devoted to the host number.
The first and last address in IP address pool cannot be used.
The structure of an IP datagram header is as follows. An IP header is alway 20 bytes in size.
Version is a 4-bit field indicating the version of IP protocol the data is using.
Header Length is a 4-bit field indicating the whole length of the header.
Service Type is an 8-bit field specifying details about quality of service, or QoS (which IP datagram is more important than the others), technologies.
Total Length is a 16-bit field indicating the total length of the IP datagram the header is attached to. The maximum size of a single IP datagram is 65535. If exceeded, the IP datagram is then split into many indicidual packets.
Identification is a 16-bit field used to group messages together. As stated above, when a IP datagram exceeds the maximum size, identification field can tell the receiver which packets are belong to the same transmission.
Flag is a 4-bit field indicating if a datagram is allowed to be fragmented, or that the datagram has already been fragmented. Fragmentation is the process of taking a single IP datagram and splitting it up into several smaller datagrams.
Fragment Offset is a 12-bit field contains the value used by the receiving end to take all the fragmented parts and put them all together in the correct order.
TTL is an 8-bit field indicating how many router hops a datagram can traverse before it’s thrown away.
Protocol is an 8-bit field that contains data about what transport layer protocol is being used. Most common ones are TCP or UDP.
Header Checksum is a 16-bit field that contains the checksum of the contents of the entire IP datagram header. Because TTL will change on every hop, the checksum changes every time TTL changes.
Source IP Address is a 32-bit field that contains the source IP of the datagram.
Destination IP Address is a 32-bit field that contains the destination IP of the datagram to be send to.
Options is a 16-bit field used to set special characteristics for datagrams primarily used for testing purposes.
Padding is a 16-bit field is a series of zeros used to ensure the header is the correct total size.
The forming of the datagram with header is called Encapsulation.
The payload of the IP datagram is a TCP or UDP data packet.
2.3.2 Subnet Addressing
Problem arose when the Internet began to grow. It was inconvenient to allocate a new network number to any new network segment that was to be attached to the Internet. To address the problem, it was natural to consider a way that a site attached to the Internet could be allocated a network number centrally that could then be subdivided locally by site administrators.
The approach adopted to support this capability is called subnet addressing [RFC0950].
The site may further divide the host portion of its base address allocation into a subnetwork (subnet) number and a host number.
For performing network subnetting, refer to other online matetials for clarification.
2.3.3 Subnet Masks
The subnet mask is an assignment of bits used by a host or router to determine how the network and subnetwork information is partitioned.
Subnet masks for IP are the same length as the corresponding IP addresses (32 bits for IPv4 and 128 bits for IPv6).
Subnet masks are configured in a host or router either statically or using dinamic system such as the Dynamic Host COnfiguration Protocol (DHCP).
Subnet masks constitue with 1s and 0s, with 1s at higher bits and 0s at lower bits. Subnet masks can then be expressed in shorthand as slash/number of 1 bits.
Subnet masks help routers and hosts determine where the network/subnetwork portion of an IP address ends and the host part starts. Bit set to 1 means the corresponding bit in an IP