Understanding IP Addressing: IPv4, IPv6, NAT, and CIDR
Differences Do Not Target – Connectionless
Not target (connectionless) characteristics:
- The package contains the source and destination address.
- The router does not need to maintain state information about connections.
- Routing tables change dynamically depending on network traffic.
- Difficult for service and control errors.
Connection-Oriented
Connection-oriented characteristics:
- Carried by the virtual circuit identification number.
- Each virtual circuit requires a space in the routing table.
- Defines a virtual path and continues until it is lost or saturated.
- Easy if there are enough resources for each virtual circuit.
Internet
Interconnection of networks with applications with a common interface independent of the physical structure of the underlying network.
IP Routing on a Host
The incoming packets are analyzed to see if the local host is the recipient:
- If so, the packet is processed and used by the upper layer.
- Otherwise: If the computer is a router, the package is sent as a package to the next hop according to the routing algorithm.
- Otherwise, the packet is discarded.
IPv4 Header
Version (4 bits): Allows coexistence of IPv4 and IPv6.
IHL (4 bits): Length of the header. Number of 32-bit words. The maximum value of the field is 15, so the maximum header length is 60 bytes. The minimum length of the header is 20 bytes.
Type of service (8 bits): An indication of the quality of service this IP datagram will claim.
Length (16 bits): Defines the length of the IP packet. Maximum length is 216 = 65,535.
Field ID (16 bits): Determines which datagram it belongs to in the case of fragmentation.
Bit Reserved
Bit DF (Do Not Fragment): Indicates that the package cannot be broken. The destination host is not able to put together fragments. 1 = cannot be fragmented.
Bit MF (More Fragment): Indicates that there are more fragments. 1 = more chunks, 0 = last fragment.
Fragment Offset (13 bits): Used with fragmented datagrams to help reassembly. The value is the number of parts contained in chunks of 64 bits above (the bytes of the header are not taken into account).
Lifetime (8 bits): Specifies the time in seconds that the package will travel through the network. In fact, it refers to the number of hops. Each router will remove one second from the lifetime; when this value reaches 0, the package is discarded.
Protocol: Indicates the upper layer protocol.
Header Checksum (16 bits):
- Verifies the header only.
- Detects errors.
- Sum of the 16-bit words of the header in addition to 1.
- Should be recalculated per hop (lifetime change).
Source Address and Destination Address (32 bits each):
Options: The options are variable length; each option begins with a 1-byte code indicating the option.
Multicast: Performance
An active process on a host must inform its network cards that it wants to be part of a specific group. The software itself has mapped the multicast address to a physical address to allow receiving in this direction. For a router to decide whether to forward a multicast packet to another network, it uses the IGMP (Internet Group Management Protocol).
CIDR Solution
Assign remaining IP addresses in blocks of variable size independent of classes. CIDR uses the VLSM (Variable Length Subnet Masking) technique to make possible the allocation of variable length prefixes. CIDR uses aggregation of multiple continuous prefixes in supernets, reducing the number of entries in the global routing tables.
Private IP
Relaxes the rule that IP addresses should be unique. Part of the overall address space is reserved for networks used exclusively within an organization and do not require IP connectivity to the Internet (RFC 1597). Addresses are reserved for NAT:
- Class A: 10.0.0.0 to 10.255.255.255
- Class B: 172.16.0.0 to 172.31.255.255
- Class C: 192.168.0.0 to 192.168.255.255
Hosts with a private IP address lack connection to the Internet. All connectivity to external Internet hosts must be provided by the gateway with NAT application.
NAT Objection
- One public IP address identifies a machine, not globally.
- Connection-oriented network.
- You must save the connection information in the NAT tables. If the NAT drops, all connections are lost.
- The network layer is to use a certain protocol layer of the transport. NAT destroys the independence of the layers.
- Internet does not require the use of TCP/UDP. The use of another protocol will fail.
- Some applications insert IP addresses in the message body. If you cannot change these, applications fail (e.g., FTP).
- For a public IP address, you can only have 65,536 connections; these are removed from being booked for 4096.
- RFC 2993 discusses this and other problems with NAT.
IPv6 Objectives
- Managing millions of hosts.
- Reduce the size of routing tables.
- Simplify the protocol.
- Improve security (authentication and confidentiality).
- Type of service.
- Ability to host cell.
- Allow the protocol to evolve.
- Coexistence of old and new protocol.
IPv6 Header
The header is in the first 40 bytes of the package and contains the following data:
- Version (4 bits).
- Traffic Class (8 bits): Priority of the package.
- Flow Label (20 bits): Maintains quality of service. Will establish a pseudo-connection between an origin and destination.
- Length of data field (16 bits).
- Next header (8 bits).
- Hop limit (8 bits).
- Source Address and Destination Address (128 bits each).
Following is the data. It should be indicated that the header is flexible and can contain optional information that is explained later.
IPv6 Extension Header
The headers allow you to extend the IPv6 header flexibly, adding features to allow for gradual and effective evolution. The “Next Header” field indicates the type of the next header; you can add as many headers of any type as you want. So far, there are 8 types of headers. The main header has a fixed size of 40 bytes, and then you can add extension headers of variable length.
Types of IPv6 Addresses
- Unicast addresses identify a single network interface.
- Multicast addresses identify a set of interfaces, generally on different network nodes. When you send a package to a multicast address, all interfaces identified by the address receive the package.
- Anycast addresses also identify a set of network interfaces, generally on different nodes. When a package is sent to an anycast address, only one interface in the group receives the package, usually the closest one.
IPv6 Transition Mechanisms
There are a number of mechanisms that allow coexistence and the gradual migration of both networks and user computers. In general, transitional arrangements may be classified into three groups:
- Dual stack refers to a solution of a dual-level IP stack (RFC 2893), which implements both IPv4 and IPv6 protocol stacks at each network node. Each node of the dual-stack network will have two network addresses, one IPv4 and another IPv6.
- Pros: Easy to deploy and widely supported.
- Cons: The network topology requires two routing tables and two routing processes. Each node in the network needs to have both stacks updated.
- Tunnels allow connection to IPv6 networks across IPv4 networks. This works by encapsulating IPv6 packets in IPv4 packets, taking them as the IP protocol layer. Thus, IPv6 packets can be sent over an IPv4 infrastructure. There are many technologies available for tunnels.
- Translation is required when a single IPv4 node tries to communicate with a single IPv6 node. The mechanisms of translation can be divided into two groups based on whether this information is stored or not.