(IPv4) Internet Protocol Version 4
- What does (IPv4) Internet Protocol Version 4 mean?
- Internet Protocol Version 4 (IPv4) is the first version of the Internet Protocol developed in the fourth generation and spans a wide area. Along with IPv6, it has become the core of the Internet’s standards-based working methods. IPv4 is still the broadest Internet Layer Protocol so far. As of 2010, the deployment of IPv6 is still in its infancy.
- A connectionless protocol for use over connection layer (internet layer) networks with IPv4 packet switching. It works on the best effort delivery model. These aspects, including information integrity, are addressed by an upper layer transport protocol. (Eg TCP)
- IPv4 uses 32-bit addresses. 32-bit addresses limit the address space to 4,294,967,296 (232) possible single addresses. However, some are dedicated for specific purposes, such as private networks (~ 18 million addresses) or multicast addresses (~ 270 million addresses). This reduces the number of addresses that are likely to be allocated for forwarding on the public internet. Although the inevitable consumption of Classless Inter Domain Routing and Network Address Translation (NAT) has been delayed largely, the IPv4 address incompletion occurs as the addresses are increased to end users, as the network addressing architecture is rearranged through the classful network design.
- The address limit in IPv4 space encourages the development of IPv6, which is the only new solution that has just begun to be used, but a long-lasting solution.
- Address Representations
- IPv4 addresses are written in decimal notation, usually consisting of 4 octet addresses separated by periods and expressed in decimals.
- This is the main format used to transform the following table:
|Impressions||Value||Dotted decimal conversion|
|Dotted Hexadecimal||0xC0.0x00.0x02.0xEB||Each octet is individually converted to hexadecimal format|
|Dotted octal||0300.0000.0002.0353||Each octet is individually converted to octal|
|Hexadecimal||0xC00002EB||Combining Dotted-hexadecimal octets|
|Decimal||3221226219||32-bit number with decimal precision specified|
|Octal||030000001353||32-bit number with octal reg specified|
- Most of these formats should work on all browsers. However, in dot-based format each octet may have any of the different bases. For example, 192.0×00.0002.235 is a valid counterpart of the above addresses.
- The last thing you get is not really a notation. Because it is rarely written in an ASCII character notation. This form is a binary form of binary notation sixteen notation. This difference is only a representation of 0xCF8E83EB and 0xCF8E83EB. This form is used to assign the target and resource fields in a software program
- Classified IP Addressing
- Originally, an IP address consists of two parts: the network identifier represented in the most significant octet of the address, and the host identifier that uses the rest of the address. The second reason is the rest field (English: rest field). This allowed the formation of a maximum of 256 networks (second domain). At that time it was seen as inadequate.
- To overcome this limit, the high order octets of addresses have been redefined to form a cluster network class in a system known as Classful Network (English). The system has defined 5 classes: Class A, B, C, D and E. Classes A, B and C have different bit lengths for new network identification. The address of an address was used to identify the host in a network, meaning that each network class had a different capacity to address the hosts in the beginning. Class D has been reserved for multi-directional publishing, and Class E has been retained for future applications.
- By around the year 1985, it was planned to be re-divided into IP networks. One of these flexible methods is the use of variable-length subnet mask (VLSM). Based on the IETF standard RFC 1517 published in 1993, these categorical systems officially took the place of classless inter-field routing (CIDR), and on the contrary were named classful-based classful. The CIDR was designed to allow any address surface to be re-segmented. Thus, smaller or larger address blocks could be allocated for all users. The hierarchical structure created by CIDR is governed by IANA and RIRs. Each RIR maintains a publicly visible WHOIS database that provides information about its IP address tasks.
- Classless IP Addressing
- We call sub-classification of IP spaces into sub-classes. What subdivision subnets provide us
- 1. Reduce network traffic. In environments where routers are used, there is heavy network traffic and routers create broadcast space. A broadcast domain is one in which clients who are members of a network on the network can communicate with other client devices without reaching the router. As the number of broadcast fields increases, the network traffic in that area will be reduced compared to the structure with a single broadcast area.
- 2. Optimizes network performance.
- 3. Simplifies network management. Detection of problems in isolated networks is easier and more straightforward.
- Subnetting Operation
- When dividing a network into subnets, there are two formulas that we will use frequently. The first is the number of hosts in the subnet and the second is the number of subnets:
- 2 ^ n -2> = number of hosts in a subnet
- 2 ^ m> = number of subnets
- Example: 192.168.0.0 We divide the 255.255.255.0 network into 2 subnets.
- Since I know the number of subnets, I will use the formula “2 ^ m> = number of subnets”. In the case of 2 ^ m> = 2, it is enough to give 1 for m. 1 will be used when calculating the new subnet mask of new networks. This means that 1 bit of host bits can be used. Host bit is the area indicated by 0s in the subnet mask. Network end is indicated by 1’s field.
- Example mask information 255.255.255.0
- 11111111.11111111.11111111.00000000: 255.255.255.0 (Shuanli subnet mask)
- 11111111.11111111.11111111.10000000: 255.255.255.128 (New subnet mask)
- In the new case, the number of host bits was 7. In this case, the number of IPs to be used in each network will be 2 ^ 7-2 = 126. Here, the count is decremented by 2 because one of the IPs is used for the subnet ID, and one of the addresses is used for the broadcast address. It is not possible to give these addresses to a host since the subnet ID and broadcast addresses are specifically reserved for these purposes. How do we find the subnet ID and broadcast address? Use subnet ID, first IP, last IP, broadcast address order to find the subnetting subnet ID and broadcast address.
- Subnet ID + 1 = First IP
- Last IP + 1 = Broadcast Address
- Subnet ID -1 = Broadcast Address
- The difference between the Subnet ID of the first network and the Subnet ID of the second network is 2 ^ n. With this information you can easily find the Subnet ID and Broadcast address.
- In the last case, 2 subnets will be as follows:
|Subnet ID||First IP Address||Last IP Address||Broadcast Address|
- Introduced in 1987. Variable Length Subnet Mask is used to implement subnets of different sizes.
- CIDR and Supernetting
- In 1993, Classless Inter-Domain Routing (CIDR) was introduced. CIDR is used to perform top networking (Supernetting). Top networking allows route aggregation (Route Aggregation). CIDR introduced a prefix notation, also known as a CIDR notation. Prefix / CIDR notation is used in the form of classless IP address 3: Subnetworking, VLSM / Subnets of different sizes, CIDR / Top networking.
- The original system of IP address classes was replaced by CIDR, and the class-based scheme was named classful for comparison purposes. The most basic advantage of CIDR is; Allows any address space to be repartitioned so that smaller or larger address blocks can be allocated to users.
- The hierarchical structure created by the CIDR and controlled by the Internet Assigned Numbers Authority (IANA) and the Regional Internet Registry (RIRs) governs the worldwide implementation of Internet addresses. Each RIR maintains a publicly searchable WHOIS database that provides information about IP address applications. The information from these databases plays a central role in a large number of vehicles seeking to geographically locate IP addresses.
- Special Use Addresses
- Reserved Address Blocks
|CIDR address block||Description||Reference|
|0.0.0.0/8||Existing Network (Applies only as source address)||RFC 1700|
|10.0.0.0/8||Private networks||RFC 1918|
|172.16.0.0/12||Private networks||RFC 1918|
|192.0.0.0/24||Reserved (IANA)||RFC 5735|
|192.0.2.0/24||TEST-NET-1, Documentation and sample code||RFC 5735|
|126.96.36.199/24||instead of IPv4 IPv6||RFC 3068|
|192.168.0.0/16||Private networks||RFC 1918|
|198.18.0.0/15||Network benchmark test||RFC 2544|
|198.51.100.0/24||TEST-NET-2, Documentation and Examples||RFC 5737|
|203.0.113.0/24||TEST-NET-3, Documentation and Examples||RFC 5737|
|188.8.131.52/4||Multicasts (before class D network)||RFC 3171|
|240.0.0.0/4||Reserved (before class E network)||RFC 1700|
- Private Networks
- About three billion addresses in IPv4 are allocated for the use of private networks. These arrays can not be routed outside private networks, and private machines can not communicate directly with public networks. However, they can do this with Network Address Translation.
- Below are 3 series of addresses reserved for private networks (RFC1918)
|Name||Address range||Number of addresses||Class description||Maximum CIDR block|
|24-bit block||10.0.0.0–10.255.255.255||16,777,216||Class One||10.0.0.0/8|
|20-bit block||172.16.0.0–172.31.255.255||1,048,576||16 Sequential sequence of class B block||172.16.0.0/12|
|16-bit block||192.168.0.0–192.168.255.255||65,536||256 Sequential sequence of class C block||192.168.0.0/16|
- Virtual Private Networks
- Packages addressed by private addresses are rejected by all general routers. Therefore, it is not possible to communicate between two private networks via the public internet without special facilities. This is done through Virtual Private Network (VPN). VPNs establish the tunnel function over the public network. So the end points of the tunnel are the private network packets that serve as the router. These routers create or include specially addressed packets along with a generic network heading that can be routed through the public network to the opposite router on the other side of the tunnel, abstracted from global addressing headers, and locally routed to the destination.
- Optionally, the included packet can be encrypted for data security while on the public network.
- Link-Local Addressing
- RFC 5735 defines the 169.254.0.0/16 address block for private use in the local connection address. These addresses apply only to the point-to-point link where the host is connected and to links such as the local network segment. These addresses can not be redirected, and they can not be destination or source packets circulating on the Internet, such as private addresses. Local link addresses are used locally for address auto-configuration when a host can not obtain an IP address from a DHCP server or other internal configuration methods.
- When the address leaves, there is no standard for the mechanisms of address auto-configuration. Microsoft Auto Private IP Addressing – I filled this gap by creating an application called APIPA. According to Microsoft’s marketing power, APIPA has spread to millions of machines and thus the industry has become the Defacto standard. After many years, the IETF has defined an official standard for RFC 3927 functionality, which is referred to as the dynamic configuration of IPv4 local link addresses.
- 127.0.0.0-127.255.255.255 (in the 127.0.0.0/8 CIDR notation) address block is reserved for [localhost] communication. The addresses in this block should never go out of the host computer and the packets sent in this address will be translated as packets received on the same virtual network device Loop or loopback).
- Addresses Ended with 0 or 255
- It is a widespread misconception that addresses that end with a 0 or 255 octet are never assigned to hosts. This is only true for CIDR, which includes at least 24-bit subnet masked networks, C-class networks with older-class addressing schemes, and / 24 / masked networks.
- There are only three possible subnetwork masks in classified addressing (not in effect by the emergence of CIDR) class A, B and C. For example, in the subnet 192.168.5.0/255.255.255.0 (or 192.168.5.0/24) the identifier 192.168.5.0 represents the entire subnet and therefore can not represent an individual device in that subnet at the same time.
- Package structure
- IP packages consist of two parts: the header part and the data part. IP packets do not contain the number of data checksums or any other substates, such as some data link layer protocols. Many errors are detected by cyclic redundancy check pads of packets, which are usually wrapped by IP packets by the data link layer. In addition, the end-to-end TCP layer provides many other errors.
- The IPv4 packet header consists of 14 fields. 13 of these are mandatory, the 14th field (indicated by the red background on the table) is optional and is called the option field. The fields in the header are sorted by the high-order byte first, and the high-order bits are written first in diagrams and discussions. The highest digit bit is set to 0. So the release field is a more accurate definition of the four most significant digits of the first byte.
- IPv4 Heading Level
|4||32||Identity||Flags||Relative Position of the Part|
|8||64||Time To Live||Protocol||Protocol Header Checking Total|
|12||96||Source IP Address|
|16||128||Destination IP Address|
|20||160||Options (if IHL> 5)|
- The first field in the IP packet headers is the four-bit long version field. The value to put in this field for IPv4 is 4. (Represents v4 version 4 in the name of IPv4)
- Internet Header Length (IHL)
- This second field of 4 bits in length is the 32-bit (word) number found in the header. In other words, the value in this field indicates how many 32 bits the header can consist of. The length of the title determines the length of the head since the only area that can vary in length is the field of options. If the length is not a solid of 32, fill bits are added to round to the nearest floor. The minimum value this field can take is 5 (RFC 791). This corresponds to 5 x 32 = 160 bits = 20 bytes. Since this field is 4 bits long, the maximum value that can be reached is 15 (ie 15 × 32 bits = 480 bits = 60 bytes).
- Classified Services Code Point (DSCP)
- In fact, it was originally defined as a Type of Service (ToS or Type of Service) field. However, from RFC 2474, it is defined as Classified Services (DiffServ or Differentiated Services) area. New technologies that require real-time streaming of data, and therefore use the DSCP field, are in use. An example of this is Voice over IP (VoIP), which provides intercepting voice data exchange.
- Explicit Congestion Notification (ECN)
- This area, defined by RFC 3168, provides end-to-end network blockage notification without dropping packets. The ECN that is used on demand may be applied only if two or three points support this feature and you want to use it. It is only effective if it is supported by the network being overlaid.
- Total Length
- The smallest value that this 16-bit field can represent is 20 (20 bytes of header + 0 bytes of data), and the maximum value is 65,535 bytes (the maximum value that a 16-bit number can take). Although the maximum possible length of IP packets is 65,535, the maximum frame length that can be carried by the underlying layer protocols that wrap these packets in the transmission units called frames varies. According to the standard, all hosts must be able to accept all data blocks up to 576 bytes. Nowadays, many hosts can carry much larger packages. However, sometimes some subnets place restrictions on the maximum packet size. In this case, data blocks exceeding this limit need to be segmented and moved. This process is called fragmentation. Since the maximum supported packet size is fixed to the standard that can not be less than 576 bytes, the 576 bytes can be transported without any fragmentation of all packets. In the IPv4 protocol fragmentation can be performed on hosts or routers.
- This field, called the identification field, is used to identify which IP packet the fragmented packets belong to, so that every packet is added and the same number is present in packets that are part of the same package. Some experimental studies have suggested that the identification field should be used for other purposes as well. For example, it has been proposed that this field can be used to facilitate tracking of data blocks containing fake information in the source address field, but such use is prohibited by RFC 6864.
- This three-bit field is used to control and identify packet fragments. The flag bits are water-floated, from high to low, in order:
- Bit 0: Reserved; It should be zero.
- Bit 1: Do not fragment (DF, Do not Fragment)
- Bit 2: Mark More Mark (MF, More Fragments)
- If the DF flag is set but the packet needs to be fragmented in order to be redirected during transmission, the packet is dropped and an error message is sent. This setting can be used when sending packets to a host that does not have a source for the fragmentation process. Another area of use is to measure the maximum packet size that the packet transport path supports. This measurement can be performed by the IP software itself or by the user with some network diagnostic tools such as ping or traceroute. The MF bit is marked as 1 in packages with other parts coming after it, and 0 in last packages. Since unpartitioned packets can also be thought of as their first and last part, the MF bit is 0 in these packets. This bit is set to 1 for all segments except the last segments of the segmented packets. The MF Start position field indicates whether a package with MF bit 0 is a stand-alone package or a piece of a package. This field will be 0 in one-piece packages.
- Fragment Offset
- The unit of the 13-bit length in this area, which specifies the relative position of the part according to the beginning of the original package, is eight bytes (64 bits). This means that the fragment contains the 64-bit portion of the original packet. A maximum of (213 – 1) × 8 = 65,528 bytes can be specified for this field, but when this header is included, the maximum IP packet size (65,535 bytes) is exceeded (65,528 + 20 = 65,548 bytes).
- Time To Live (TTL)
- The life cycle of eight bits prevents packages from staying on forever on the internet. Theoretically, this field specifies the remaining lifetime of the package in seconds, and every node that passes over the path on the path decreases the time it takes to process the packet from the lifetime field. Times shorter than 1 second are rounded to 1 second. Nowadays, packets are transmitted over routers much less than 1 second, so this field is used as a measure of the number of skips. When the routers receive the package, the TTL field is reduced. When the number is zero, the packet is dropped and the ICMP Time Exceeded message is sent to the sender.
- Traceroute software also uses ICMP Time-Out messages from routers to create a list of routers that the package passes from source to destination.
- This field defines which protocol is used in the data part of the IP packets. The Internet Assigned Numbers Authority, which is affiliated to the Internet Assigned Numbers and Names Authority, maintains a list of IP protocol numbers identified by RFC 790.
- Headline Checking Total
- The checksum field of 16 bits in length is used for error checking in the header. When the router receives a packet, the router computes the checksum of the packet header and compares it with the header line. If the values do not match, the router ignores the package. The protocol should be concerned with the errors in the data part and the wrap-around protocol. Both UDP and TCP have checksum. When the router has a packet, the router reduces the TTL field of the packet. It then calculates the new checksum. RFC 1071 describes the calculation of the checksum as follows:
- The checksum field is a 16-bit number obtained by retrieving the complete binary of the summation of all the words of the 16-bit header in the header. When the checksum is computed, the checksum in the header is set to zero.
- For example, let’s take the title data, which is a hexadecimal representation, as follows: 4500003044224000800600008c7c19acae241e2b. This data is an IP packet header with a total length of 20 bytes. On a machine that implements the complementary enhancement of the standard:
- Step 1) 4500 + 0030 + 4422 + 4000 + 8006 + 0000 + 8c7c + 19ac + ae24 + 1e2b = 0002BBCF (32-bit total)
- Step 2) 0002 + BBCF = BBD1 = 1011101111010001 (The sum of the 16-bit integer complement is calculated by adding up the sum of the 32-bit binary summation over 16 bits.) If the total number of digits is less than 16 bits, this operation is repeated)
- Step 3) ~ BBD1 = 0100010000101110 = 442E (individual concatenation of the 16-bit individual concatenation)
- The same algorithm can be used to verify the heading sum of the heading – when the heading sum of a head containing a correct checksum is computed, a completely 0 word is obtained:
- 2BBCF + 442E = 2FFFD. 2 + FFFD = FFFF. The completeness of FFFF = 0.
- Source address
- This field is the IPv4 address of the sender of the packet. Note that this address can be changed by the network address resolver during transport.
- Destination address
- This field is the IPv4 address of the receiver of the packet. Like the source address, this address can also be changed by a network address resolution device during transport.
- The options field is not used very often. Note that the length of the 32-bit words in the IHL header must be large enough to cover all options, and if the total length is not a multiple of 32 bits, the header must be filled with the fill data in the required amount. The options list can be terminated with EOL (Options List Ending, 0x00), but this is only necessary if the end of the options does not otherwise coincide with the end of the heading. The list of options that can be included in the title is as follows:
|Copied||1||Set to 1 if the options need to be copied to all parts of the fragmented packages.|
|Option Class||2||General option category. 0 for “control” options, 2 for “debug and measure”. Functions 1 and 3 are reserved for later selection.|
|Option Number||5||Indicate what your choice is.|
|Option Length||8||Specifies the size of the entire option (including this field). This field may not be available for simple options.|
|Option Data||Variable||Used for parameter-specific data. Simple options may not have this field.|
- Note: If the title length is greater than 5, ie 6 to 15, the option field is used, so it is considered.
- Note: Copied, Option Class and Option Number are sometimes referred to as a single eight-bit field called “Option Type“.
- The use of Loose Source and Record Route (LSRR) and Strict Source and Record Route (SSRR) options is not recommended due to security concerns. Many routers are blocking packets containing these options.