Chapter 7: IPv4 addressing
This introduction places IPv4 addressing in the context of Layer 3 routing and explains why IPv4 remains important alongside IPv6.
After this chapter you will be able to
- Layer 3 forwarding information. Distinguish the header information routers and switches use for forwarding decisions: routers use Layer 3 information, while switches use Layer 2 information.
- IPv4 header fields and role. Explain that the IPv4 header contains source and destination addresses as well as other fields that help enable end-to-end packet delivery. Contrast its 14 fields, including the optional Options field, with the simpler Ethernet header and trailer.
- Variable IPv4 header length. Explain why the IPv4 header can be 20 to 60 bytes long and identify the optional Options field as the cause of that variation.
- IP Version Field Values. Explain what the Version field indicates and identify the values given for IPv4 and IPv6.
- IPv4 header length encoding. Explain why the IPv4 header needs an IHL field and interpret its value as a header length, including what values above 5 imply about the Options field.
- Quality of Service purpose. Explain why the section connects DSCP and ECN to Quality of Service, using delay-sensitive traffic as an example.
- Total Length and IHL distinction. Explain that the 16-bit Total Length field gives the length of the entire IPv4 packet, including its header and payload, in bytes, while IHL gives the header length alone in 4-byte increments.
- MTU and packet fragmentation. Explain that the MTU sets a maximum packet size, that an oversized packet may be fragmented along its path, and that the destination host reassembles the fragments.
- Fragment identification and position. Describe how the Identification and Fragment Offset fields help the destination reassemble fragments, including fragments that arrive out of order.
- Fragmentation flag meanings. Distinguish the Don’t Fragment and More Fragments bits, including what happens to an oversized packet when DF is set and how MF marks the final fragment.
- TTL and packet loops. Explain how routers use the TTL field when forwarding a packet and why this prevents a looping packet from circulating indefinitely.
- IPv4 Protocol field meaning. Explain that the 8-bit Protocol field identifies the kind of message encapsulated in an IPv4 packet, and give examples of its assigned values.
- Header Checksum error coverage. Explain that the 16-bit Header Checksum field checks for errors only in the IPv4 header, whereas the Ethernet FCS checks the entire frame.
- Source and destination address fields. Explain what the Source Address and Destination Address fields contain and state the length of each field.
- Options field and header length. Explain that the IPv4 Options field may be absent or occupy up to 40 bytes, so the IPv4 header needs a field that indicates its length.
- Decimal digits and place values. Explain why decimal is called base 10 and how a digit’s position determines its value, using an example such as 100 or 1,009.
- Binary digits and place values. Explain why binary is base 2 and how each bit’s position determines its value.
- Binary-to-decimal value calculation. Apply bit place values to convert an eight-bit binary number to decimal.
- Decimal-to-binary bit selection. Apply subtraction or addition of descending bit values to convert a decimal number from 0 to 255 into eight-bit binary.
- IPv4 and MAC address roles. Distinguish an IPv4 address, a 32-bit Layer 3 host identifier used to address a message to its final recipient, from a MAC address used to address a message to the next hop.
- Router Layer 3 forwarding. Explain why routers are called Layer 3 devices, in contrast to Layer 2 switches: routers make forwarding decisions using the destination IP address in a message’s Layer 3 header.
- Network and host portions. Explain that devices in the same LAN share the network portion of their IPv4 addresses but have distinct host portions, while a router connects LANs with different network portions.
- Prefix length notation. Explain that a /X prefix length states how many bits, counting from the left, form an IPv4 address's network portion; use /24 to identify the remaining eight host bits.
- Netmask bit meanings. Explain how a 32-bit netmask identifies network bits with 1s and host bits with 0s, and relate the examples /16 and 255.255.0.0.
- Router interface IPv4 configuration. Describe how to assign an IPv4 address and netmask to a Cisco router interface and enable it. Explain why assigning the address alone does not make the interface ready to forward traffic.
- Interface status and address verification. Explain how to check router interfaces before and after configuration using show ip interface brief, and how to check an interface’s prefix length using show ip interface.
- Forwarding between connected LANs. Trace, at the level shown here, how R1 carries a packet from PC1 in LAN 1 to PC3 in LAN 2, distinguishing the packet’s destination IP address from the MAC addresses used on each link.
- Network and broadcast addresses. Explain how the network and broadcast addresses are identified from the host bits, and why neither can be assigned to a host.
- Maximum usable host count. Calculate the maximum number of host addresses from the number of host bits and explain why two addresses are subtracted.
- Usable address range. Describe how to find the first and last usable addresses, and apply the method to an address with an octet-aligned prefix.
- IPv4 class identification. Describe how the leading bits identify IPv4 address classes A through E, and distinguish the host-address classes from the reserved classes.
- Classful prefix size tradeoff. Explain the fixed prefix lengths of classes A, B, and C and how network-portion size affects the number of networks and addresses in each network.
What it builds on
- Frame switching (chapter 6) · Switches forward frames using Layer 2 information.
- The Ethernet header and trailer (chapter 6) · The Ethernet header and trailer used for comparison.
- Binary: Bits and bytes (chapter 3) · The meaning of bits and bytes.
- Routers (chapter 2) · Assumes the basic role of routers in a network.
- Type/Length (chapter 6) · Introduces the Ethernet header field used for the comparison.
- Ping (chapter 6) · Introduces ping, which the section identifies as a component of ICMP.
- Frame Check Sequence (chapter 6) · The Ethernet Frame Check Sequence as an error-checking field.
- Destination and source (chapter 6) · Introduces source and destination fields in Ethernet frames.
Section by section
Introduction
This introduction places IPv4 addressing in the context of Layer 3 routing and explains why IPv4 remains important alongside IPv6.
- Layer 3 forwarding information: Distinguish the header information routers and switches use for forwarding decisions: routers use Layer 3 information, while switches use Layer 2 information.
Why it matters: This distinction places IPv4 addressing at the network layer rather than the Ethernet layer. - Continuing importance of IPv4: Explain why IPv4 remains important to study even though IPv6 was introduced to replace it.
Why it matters: Knowing why both protocols matter helps explain why IPv4 remains a central networking skill.
Key terms: Layer 2 header, Layer 3 header, routers, switches, IPv4, IPv6, IPv4 address pool
7.1 The IPv4 header
Introduces the IPv4 header’s role, shows how to read its layout, and explains why its length varies.
- IPv4 header fields and role: Explain that the IPv4 header contains source and destination addresses as well as other fields that help enable end-to-end packet delivery. Contrast its 14 fields, including the optional Options field, with the simpler Ethernet header and trailer.
Why it matters: This gives you a way to place IPv4 addresses in the packet header without treating them as the header’s only purpose. - Reading the header diagram: Describe how to read Figure 7.1 from left to right and top to bottom, and explain its 32-bit rows and zero-based bit and byte numbering.
Why it matters: Reading the layout correctly helps you locate fields without mistaking zero-based positions for counts. - Variable IPv4 header length: Explain why the IPv4 header can be 20 to 60 bytes long and identify the optional Options field as the cause of that variation.
Why it matters: It explains why the diagram does not imply that every IPv4 header has the same size.
Key terms: IPv4 header, Layer 3, Source Address, Destination Address, Options field, bit, byte, 32 bits
7.1.1 The Version field
This section explains how the four-bit Version field identifies the IP version indicated by a packet header.
- IP Version Field Values: Explain what the Version field indicates and identify the values given for IPv4 and IPv6.
Why it matters: The field tells you which IP version the header identifies.
Key terms: Version field, IPv4, IPv6, 0b, 0d
7.1.2 The IHL field
Explains how the IHL field expresses the variable length of an IPv4 header.
- IPv4 header length encoding: Explain why the IPv4 header needs an IHL field and interpret its value as a header length, including what values above 5 imply about the Options field.
Why it matters: IHL lets you determine where a variable-length IPv4 header ends.
Key terms: Internet Header Length (IHL), Options field, 4-byte increments
7.1.3 The DSCP and ECN fields
This subsection identifies the DSCP and ECN fields in the IPv4 header and explains their role in prioritizing delay-sensitive traffic.
- DSCP and ECN fields: Describe the sizes of the DSCP and ECN fields and how their combined byte relates to the older Type of Service name.
Why it matters: These names identify what the former Type of Service byte contains now. - Quality of Service purpose: Explain why the section connects DSCP and ECN to Quality of Service, using delay-sensitive traffic as an example.
Why it matters: Prioritizing voice and video helps avoid the poor quality that delays can cause in calls.
Key terms: Differentiated Services Code Point (DSCP), Explicit Congestion Notification (ECN), Type of Service, Quality of Service (QoS), delay-sensitive network traffic, voice and video traffic
7.1.4 The Total Length field
Explains what the IPv4 Total Length field measures and how it differs from the IHL field.
- Total Length and IHL distinction: Explain that the 16-bit Total Length field gives the length of the entire IPv4 packet, including its header and payload, in bytes, while IHL gives the header length alone in 4-byte increments.
Why it matters: The two fields measure different parts of a packet and use different units.
Key terms: Total Length field, IHL field, IPv4 header, payload
7.1.5 The Identification, Flags, and Fragment Offset fields
Explains when IPv4 packets are fragmented and how three header fields identify, control, and position their fragments.
- MTU and packet fragmentation: Explain that the MTU sets a maximum packet size, that an oversized packet may be fragmented along its path, and that the destination host reassembles the fragments.
Why it matters: This explains why one original packet can reach its destination as several fragments. - Fragment identification and position: Describe how the Identification and Fragment Offset fields help the destination reassemble fragments, including fragments that arrive out of order.
Why it matters: These fields tell the destination which pieces belong together and where they fit. - Fragmentation flag meanings: Distinguish the Don’t Fragment and More Fragments bits, including what happens to an oversized packet when DF is set and how MF marks the final fragment.
Why it matters: The flags distinguish a prohibition on fragmentation from an indication that more pieces follow.
Key terms: maximum transmission unit (MTU), fragmentation, fragments, Identification field, Fragment Offset field, Flags field, Don’t Fragment (DF) bit, More Fragments (MF) bit
7.1.6 The TTL field
Explains how the IPv4 TTL field causes routers to drop packets that might otherwise loop indefinitely.
- TTL and packet loops: Explain how routers use the TTL field when forwarding a packet and why this prevents a looping packet from circulating indefinitely.
Why it matters: TTL ensures that a packet caught in a network loop will eventually be discarded.
Key terms: Time To Live (TTL) field, router, loop
7.1.7 The Protocol field
Explains how the IPv4 header’s Protocol field identifies the message carried inside a packet.
- IPv4 Protocol field meaning: Explain that the 8-bit Protocol field identifies the kind of message encapsulated in an IPv4 packet, and give examples of its assigned values.
Why it matters: The field lets you tell which kind of message an IPv4 packet carries.
Key terms: Protocol field, EtherType field, ICMP, TCP, UDP, OSPF
7.1.8 The Header Checksum field
Explains what the IPv4 Header Checksum checks and contrasts its scope with the Ethernet FCS.
- Header Checksum error coverage: Explain that the 16-bit Header Checksum field checks for errors only in the IPv4 header, whereas the Ethernet FCS checks the entire frame.
Why it matters: The distinction keeps you from assuming the IPv4 checksum checks the entire packet.
Key terms: Header Checksum, IPv4 header, FCS, Ethernet frame
7.1.9 The Source Address and Destination Address fields
Identifies the IPv4 header fields that hold the sender’s and intended recipient’s addresses.
- Source and destination address fields: Explain what the Source Address and Destination Address fields contain and state the length of each field.
Why it matters: These fields identify who sent an IPv4 packet and whom it is meant for.
Key terms: Source Address field, Destination Address field, IPv4 address
7.1.10 The Options field
This subsection explains the IPv4 Options field and why its variable length makes a header-length field necessary.
- Options field and header length: Explain that the IPv4 Options field may be absent or occupy up to 40 bytes, so the IPv4 header needs a field that indicates its length.
Why it matters: It explains why a packet must state how long its IPv4 header is.
Key terms: Options field, IPv4 header, header length
7.2 The binary number system
Introduces binary and binary–decimal conversion as prerequisites for understanding IPv4 addresses, then leads into a review of decimal numbers.
7.2.1 Decimal
Explains how decimal numbers use ten digits and place values that increase tenfold from right to left.
- Decimal digits and place values: Explain why decimal is called base 10 and how a digit’s position determines its value, using an example such as 100 or 1,009.
Why it matters: Place value makes it possible to read numbers with more than one digit and provides a basis for comparing decimal with binary.
Key terms: decimal, base 10, digits, ones position, tens position, hundreds position
7.2.2 Binary
This section explains binary place values and teaches how to convert eight-bit numbers between binary and decimal for IPv4 addressing.
- Binary digits and place values: Explain why binary is base 2 and how each bit’s position determines its value.
Why it matters: Place values are the basis for converting numbers in either direction. - Eight-bit IPv4 conversion range: State why this section focuses on eight-bit conversions and what decimal values eight bits can represent.
Why it matters: This sets the size of the numbers you need to convert for IPv4 addresses. - Binary-to-decimal value calculation: Apply bit place values to convert an eight-bit binary number to decimal.
Why it matters: It lets you read the decimal value represented by an IPv4 address’s bits. - Decimal-to-binary bit selection: Apply subtraction or addition of descending bit values to convert a decimal number from 0 to 255 into eight-bit binary.
Why it matters: Choosing bit values quickly is useful when working with IPv4 addresses and subnetting.
Key terms: binary, base 2, bit, least-significant bit, most-significant bit, IPv4 addresses, 8 bits, 256 possible values, binary to decimal, bits set to 1
7.3 IPv4 addressing
Introduces IPv4 addresses as Layer 3 host identifiers and contrasts their end-to-end addressing role with MAC addresses and Layer 2 switching.
- IPv4 and MAC address roles: Distinguish an IPv4 address, a 32-bit Layer 3 host identifier used to address a message to its final recipient, from a MAC address used to address a message to the next hop.
Why it matters: The distinction helps you explain why a message uses both IP and MAC addressing. - Router Layer 3 forwarding: Explain why routers are called Layer 3 devices, in contrast to Layer 2 switches: routers make forwarding decisions using the destination IP address in a message’s Layer 3 header.
Why it matters: This identifies the address information a router uses when deciding where to forward a message.
Key terms: IPv4 address, Layer 3, MAC addresses, next hop, Layer 2 devices, Layer 3 devices, destination IP address, Layer 3 header
7.3.1 The structure of an IPv4 address
Explains how IPv4 addresses are written and how their network and host portions are identified using prefix lengths or netmasks.
- Dotted decimal IPv4 notation: Describe how a 32-bit IPv4 address is written in dotted decimal notation by splitting it into four 8-bit octets and converting each octet to decimal.
Why it matters: This notation lets you read the addresses used throughout the IPv4 examples. - Network and host portions: Explain that devices in the same LAN share the network portion of their IPv4 addresses but have distinct host portions, while a router connects LANs with different network portions.
Why it matters: The network and host distinction explains why addresses in one LAN resemble one another but differ from addresses in another LAN. - Prefix length notation: Explain that a /X prefix length states how many bits, counting from the left, form an IPv4 address's network portion; use /24 to identify the remaining eight host bits.
Why it matters: A prefix length tells you where an address's network portion ends and its host portion begins. - Netmask bit meanings: Explain how a 32-bit netmask identifies network bits with 1s and host bits with 0s, and relate the examples /16 and 255.255.0.0.
Why it matters: Netmasks are another way to read the network–host boundary and are the form used when configuring IPv4 addresses in Cisco IOS.
Key terms: IPv4 address, octet, dotted decimal notation, network portion, host portion, LAN, router interface, prefix length, /X, network prefix
7.3.2 Configuring IPv4 addresses on a router
This section shows how to configure and verify IPv4 addresses on Cisco router interfaces, then explains how the configured router forwards packets between two directly connected LANs.
- Router interface IPv4 configuration: Describe how to assign an IPv4 address and netmask to a Cisco router interface and enable it. Explain why assigning the address alone does not make the interface ready to forward traffic.
Why it matters: An address on a disabled interface is not enough to carry traffic. - Interface status and address verification: Explain how to check router interfaces before and after configuration using show ip interface brief, and how to check an interface’s prefix length using show ip interface.
Why it matters: Verification distinguishes an assigned address from an operational interface and catches an incorrect prefix length. - Forwarding between connected LANs: Trace, at the level shown here, how R1 carries a packet from PC1 in LAN 1 to PC3 in LAN 2, distinguishing the packet’s destination IP address from the MAC addresses used on each link.
Why it matters: It connects interface addressing to the practical purpose of routing between the two LANs.
Key terms: interface configuration mode, ip address ip-address netmask, no shutdown, netmask, show ip interface brief, Status, Protocol, administratively down, show ip interface, prefix length
7.3.3 Attributes of an IPv4 network
Explains how to identify an IPv4 network’s boundary addresses, calculate its maximum host count, and find its usable address range.
- Network and broadcast addresses: Explain how the network and broadcast addresses are identified from the host bits, and why neither can be assigned to a host.
Why it matters: These two addresses mark the limits of a network and determine which addresses remain available to hosts. - Maximum usable host count: Calculate the maximum number of host addresses from the number of host bits and explain why two addresses are subtracted.
Why it matters: The host-bit count tells you how many devices can receive addresses in a network. - Usable address range: Describe how to find the first and last usable addresses, and apply the method to an address with an octet-aligned prefix.
Why it matters: This lets you turn an IPv4 address and prefix into the range that hosts can actually use.
Key terms: network address, broadcast address, host portion, maximum number of hosts, host bits, first usable address, last usable address, usable address range, prefix length
7.3.4 IPv4 address classes
Explains how IPv4 address classes identify address ranges, assign fixed prefix lengths, and trade the number of networks against the number of addresses per network.
- IPv4 class identification: Describe how the leading bits identify IPv4 address classes A through E, and distinguish the host-address classes from the reserved classes.
Why it matters: The leading bits tell you which classful addressing rules apply to an address. - Classful prefix size tradeoff: Explain the fixed prefix lengths of classes A, B, and C and how network-portion size affects the number of networks and addresses in each network.
Why it matters: This tradeoff explains why the three host-address classes accommodated differently sized networks. - Classful addressing and its limits: Explain why the original all-/8 approach was changed and distinguish classful from classless prefix lengths.
Why it matters: It puts the class rules in context without mistaking them for a restriction on modern prefix lengths. - Reserved loopback address range: Describe the two reserved first-octet ranges given here and what happens when a message is sent to a loopback address.
Why it matters: A loopback test checks the local device rather than connectivity across the network.
Key terms: class A, class B, class C, class D, class E, prefix length, netmask, network portion, host portion, classful networks
7.4 Summary
Where this is used later
- The basics of routing (chapter 9) · The basics of routing develop how routers make forwarding decisions.
- The need for IPv6 (chapter 20) · The need for IPv6 builds on the limited available IPv4 address pool.
- IPv6 header (chapter 20) · Provides a point of comparison when studying the IPv6 header.
- (chapter intro) (chapter 20) · Introduces the Version field in an IP header.
- The need for STP (chapter 14) · Introduces the IPv4 TTL field.
- TCP and UDP (chapter 22) · Provides context for recognizing TCP and UDP as messages identified by IPv4 Protocol field values.
- Subnetting /24 address blocks (chapter 11) · Working with binary place values when subnetting IPv4 addresses.
- What is subnetting? (chapter 11) · Binary bits and their effect on counts
Concepts explained in this chapter
- prefix lengthA prefix length is the number of leading bits in an IP address that constitute its network portion, written in slash notation such as /24.
- netmaskA netmask is a 32-bit value paired with an IPv4 address to identify which address bits belong to the network portion and which belong to the host portion.
- host portionA host bit is an IPv4 address bit belonging to the host portion rather than the network portion.
- IP addressAn IP address is a network-layer identifier assigned to a host or interface for packet delivery across interconnected networks.
- broadcast addressA broadcast address is the last IPv4 address in a network, with every host-portion bit set to one, for delivery to all hosts in that network.
- maximum transmission unitMTU, or maximum transmission unit, is the largest packet size that an interface can forward without requiring fragmentation at that interface.
- network portionThe network portion is the leading part of an IP address that identifies the network to which the addressed host belongs.
- interface configuration modeInterface configuration mode is a Cisco IOS command-line mode in which settings for a specific network interface can be configured.
- ip address commandThe ip address command is a Cisco IOS interface-configuration command that assigns an IPv4 address and netmask to an interface.
- no shutdown commandThe Cisco IOS no shutdown command removes the shutdown state from an interface and enables it.
- show ip interfaceshow ip interface is a Cisco IOS command that displays detailed IP configuration and operational information for interfaces.
- show ip interface briefshow ip interface brief is a Cisco IOS command that displays concise IPv4 addressing and operational status information for interfaces.
- headerAn IPv4 header is the network-layer protocol header that carries IPv4 addressing and control fields for delivering an IPv4 packet.
- first usable addressThe first usable address is the first IPv4 address after the network address that can be assigned to a host.
- last usable addressThe last usable address is the IPv4 address immediately before the broadcast address that can be assigned to a host.
- maximum host countThe maximum host count is the number of IPv4 addresses in a network that remain assignable after excluding the network and broadcast addresses.
- network addressA network address is the first IPv4 address in a network, with all host bits set to zero, and cannot be assigned to a host.
- dotted decimal notationDotted decimal notation is the representation of a 32-bit IPv4 address as four decimal octets separated by periods.
- octetAn octet is a group of exactly eight bits, especially one of the four 8-bit groups in an IPv4 address.
- binary representationBinary language is a computer representation system composed of sequences of 0s and 1s that encode data and computational information.
- ipv4 address classClass A is an IPv4 address class whose first octet ranges from 0 through 127 and whose default network prefix length is /8.
- class bClass B is an IPv4 address class whose first octet ranges from 128 through 191 and whose default network prefix length is /16.
- class cClass C is an IPv4 address class whose first octet ranges from 192 through 223 and whose default network prefix length is /24.
- classful networkingClassful networking is an IPv4 addressing architecture based on the fixed network boundaries and default prefix lengths of address classes A, B, and C.
- classless networkingClassless networking is an IPv4 addressing system in which prefix lengths are not restricted by address class.
- options fieldThe Options field is an optional, variable-length field in an IPv4 header that carries additional IPv4 header information.
- interface commandThe Cisco IOS interface command enters interface configuration mode for the specified interface.
- destination address fieldAn IPv6 destination address field is a 128-bit IPv6 header field containing the destination IPv6 address of the packet.
- source address fieldAn IPv6 source address field is a 128-bit IPv6 header field containing the source IPv6 address of the packet.
- IPv4An IPv4 address is a 32-bit network-layer address used to identify a source or destination in IPv4 communication.
- ipv4 fragmentation fieldsThe IPv4 fragment offset field is a 13-bit header field that indicates a fragment's position within its original packet.
- binary-to-decimal conversionBinary-to-decimal conversion is the process of calculating a decimal value by summing the positional values of the set bits in a binary number.
- decimal-to-binary conversionDecimal-to-binary conversion is the process of representing a decimal value as a sequence of binary digits using positional subtraction or addition.
- quality of serviceQuality of Service is the classification and prioritization of network traffic to provide differentiated service levels.
- time to liveTime to live is an 8-bit IPv4 packet-header field whose value limits the number of router hops a packet may traverse before being discarded.
- ipv4 networkAn IPv4 address block is a contiguous range of IPv4 addresses represented by a common network prefix.
- usable address rangeA usable address range is the consecutive set of host-assignable IPv4 addresses between a network's first and last usable addresses.
- decimal numeral systemThe decimal number system is a base-10 positional numeral system that uses the digits 0 through 9.
- network loopA Layer 2 loop is a cyclic forwarding path at the data-link layer that can cause frames to circulate repeatedly through switches.
- frame check sequenceAn FCS, or Frame Check Sequence, is an Ethernet trailer field used to detect errors in an entire frame.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
