CCNA online course

IP Address Types: IPv4 and IPv6 Addressing Explained

Learn IPv4 and IPv6 address types, CIDR, private and public ranges, unicast, multicast, DHCP, SLAAC, special-use addresses, and troubleshooting.

An IP address is a Layer 3 logical address assigned to a network interface. It allows devices to identify sources and destinations across an IP network. Routers examine destination IP addresses and forward packets between networks.

An IP address is different from a physical MAC address. A MAC address identifies an interface on a local Ethernet network and normally operates at Layer 2. An IP address is logical, can change when a device moves networks, and supports routing across multiple networks. Ethernet delivery commonly uses MAC addresses for the next local hop, while routers use IP addresses to make forwarding decisions.

For background, review the OSI Reference Model and computer network fundamentals.

Purpose of IP Addressing

IP addressing provides two related pieces of information:

  • The network prefix identifies the IP network.
  • The host portion identifies an interface within that network.

When a host sends traffic, it compares the destination with its own network prefix. If the destination is local, it attempts direct delivery. If the destination is remote, it sends the packet to its default gateway, which is usually a router interface on the local subnet.

IPv4 Address Structure

IPv4 uses a 32-bit address. It is usually written as four 8-bit octets in dotted-decimal notation, such as 192.168.10.34. Each octet has a value from 0 through 255.

A subnet mask separates network bits from host bits. The equivalent CIDR notation, or classless prefix notation, states how many leading bits belong to the network. For example, 192.168.10.34/24 uses 24 network bits and 8 host bits. Its subnet mask is 255.255.255.0.

NotationMeaning
192.168.10.34IPv4 address in dotted-decimal notation
255.255.255.0Subnet mask; the first 24 bits are network bits
/24CIDR prefix length; 24 leading bits identify the network

With a typical /24 subnet, 192.168.10.0 is the network address, 192.168.10.1 through 192.168.10.254 are usable host addresses, and 192.168.10.255 is the broadcast address.

Finding Network, Host, and Broadcast Values

For 192.168.10.34/24:

  • Network: 192.168.10.0
  • Usable hosts: 192.168.10.1 through 192.168.10.254
  • Broadcast: 192.168.10.255

For 172.16.8.130/25, the final octet is divided into blocks of 128. The address belongs to the second block:

  • Network: 172.16.8.128
  • Usable hosts: 172.16.8.129 through 172.16.8.254
  • Broadcast: 172.16.8.255

For an ordinary IPv4 subnet, do not assign the network or broadcast address to a host. A subnet with n host bits normally has 2^n - 2 usable host addresses, although special prefix lengths and point-to-point designs can have different rules.

Historical IPv4 Address Classes

Classful addressing divided IPv4 into fixed classes based mainly on the first octet. This system is important for exams and historical context, but modern networks use CIDR and variable-length prefixes instead of relying on Classes A, B, and C.

ClassFirst-Octet RangeAddress RangeHistorical Default Prefix or MaskPrimary Purpose
A1–1261.0.0.0–126.255.255.255/8, 255.0.0.0Large unicast networks
B128–191128.0.0.0–191.255.255.255/16, 255.255.0.0Medium-sized unicast networks
C192–223192.0.0.0–223.255.255.255/24, 255.255.255.0Small unicast networks
D224–239224.0.0.0–239.255.255.255Not applicableMulticast
E240–255240.0.0.0–255.255.255.255Not applicableReserved or experimental use

Class A excludes 127.0.0.0/8, which is reserved for loopback. Classful boundaries waste address space because every Class A, B, or C network had a fixed default size. CIDR permits prefixes such as /20, /27, and /30, making address allocation and route aggregation more efficient.

IPv4 Delivery Types

Delivery TypeDestination ScopeExampleKey Behavior
UnicastOne interface192.168.10.20One sender communicates with one destination
BroadcastAll hosts in a local IPv4 broadcast domain255.255.255.255Routers normally do not forward it
MulticastSubscribed members of a group224.0.0.5One sender can reach multiple interested receivers
AnycastOne suitable instance from a group of interfacesCommonly implemented with IPv6 addressesRouting selects a reachable or nearest instance

Unicast is the usual one-to-one communication model. Broadcast is one-to-all within a local IPv4 broadcast domain. Multicast is one-to-many, but only hosts that join or listen to the group should receive the traffic. Anycast is a routing concept: several interfaces use the same address, and routing delivers traffic to one appropriate instance. Anycast is widely used with IPv6 services and infrastructure.

IPv4 Special-Use and Scope-Based Addresses

Address or PrefixTypeRoutable on Public InternetTypical UseNotes
10.0.0.0/8PrivateNoEnterprise and home LANsRFC 1918 range
172.16.0.0/12PrivateNoInternal networksIncludes 172.16.0.0 through 172.31.255.255
192.168.0.0/16PrivateNoHome and small-office LANsRFC 1918 range
127.0.0.0/8LoopbackNoTesting the local host127.0.0.1 is commonly used
169.254.0.0/16Link-local, APIPANoSelf-assignment after IPv4 configuration failureValid only on the local link
224.0.0.0/4MulticastNot as ordinary unicastMulticast groupsIncludes 224.0.0.5
0.0.0.0Unspecified or default route contextNoUnknown local source or default routeNot a normal host destination
255.255.255.255Limited broadcastNoAll hosts on the local IPv4 broadcast domainNot forwarded by routers
192.0.2.0/24DocumentationNoExamples and technical documentsTEST-NET-1
198.51.100.0/24DocumentationNoExamples and technical documentsTEST-NET-2
203.0.113.0/24DocumentationNoExamples and technical documentsTEST-NET-3

Network and Broadcast Addresses

The network address has all host bits set to zero. It identifies the subnet and is used in routing tables. The directed broadcast address has all host bits set to one, such as 192.168.10.255 for 192.168.10.0/24. It targets all hosts in a particular subnet, although routers commonly disable directed-broadcast forwarding to reduce abuse.

The limited broadcast address, 255.255.255.255, targets all IPv4 hosts on the local broadcast domain and is not routed to another network. Broadcast traffic is therefore constrained by routers and VLAN boundaries.

Identifying IPv4 Addresses

  • 10.25.4.8, 172.20.10.5, and 192.168.50.25 are private RFC 1918 addresses.
  • 8.8.8.8 is not in an RFC 1918 range; it is an example of a publicly used address.
  • 127.0.0.1 is loopback.
  • 169.254.25.10 is IPv4 link-local.
  • 224.0.0.5 is multicast.
  • 255.255.255.255 is limited broadcast.

Publicly routable addresses must be globally unique within the Internet routing system and must be allocated and advertised appropriately. Reserved, private, loopback, link-local, multicast, and documentation ranges should not be treated as ordinary public unicast addresses.

Private and Public IPv4 Addressing

Private addresses are intended for internal use and are not globally routed on the public Internet. The RFC 1918 ranges are:

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16

Organizations use these ranges inside LANs, data centers, and enterprise networks. Because private addresses are not unique across all organizations, a router commonly uses NAT, or Network Address Translation, to translate private source addresses to a public address. PAT extends this idea by using transport-layer port numbers so many internal hosts can share one public IPv4 address.

For example, clients in 192.168.1.0/24 can send Internet traffic to a gateway. The gateway translates their private source addresses to an allocated public IPv4 address before forwarding the traffic. NAT is useful for IPv4 address conservation, but it is not a complete security solution; firewalls and appropriate filtering are still required.

Static and Dynamic IP Address Assignment

MethodProtocol VersionHow Address Is AssignedBest-Fit Use CasesLimitations or Considerations
Static assignmentIPv4 or IPv6Manually configured on the deviceRouters, servers, management interfaces, and infrastructureManual errors and duplicate-address risk
DHCPIPv4DHCP server leases configuration to a clientEnd-user devices and frequently changing clientsRequires reachable DHCP service and suitable scope
DHCP reservationIPv4, and related identity-based designs in IPv6Server reserves an address for a device identity, commonly its MAC addressPrinters, servers, and devices needing predictable addressesDepends on the reservation database and client identity
SLAACIPv6Host forms an address from a router advertisement prefixAutomatic IPv6 host addressingAdditional settings may require DHCPv6 or other mechanisms
DHCPv6IPv6DHCPv6 supplies addresses and/or configuration optionsManaged enterprise IPv6 configurationBehavior depends on router-advertisement flags and client support

Static configuration gives administrators direct control but becomes difficult to maintain at scale. DHCP reduces manual work and can supply an address, subnet mask, default gateway, and DNS settings. A DHCP reservation combines centralized management with a predictable address.

Unmanaged static assignments can duplicate an address already leased by DHCP. Exclude infrastructure addresses from DHCP pools, document static assignments, and use reservations where practical.

IPv6 Address Structure and Notation

IPv6 uses 128-bit addresses. They are written as eight groups of hexadecimal digits separated by colons, for example 2001:0db8:0001:0010:0000:0000:0000:0020.

Leading zeros in any group may be removed, so the previous address becomes 2001:db8:1:10:0:0:0:20. One consecutive sequence of all-zero groups may be replaced by ::, but this compression can be used only once in an address. Therefore, the fully compressed form is 2001:db8:1:10::20.

IPv6 uses a prefix length, such as /64, instead of an IPv4-style dotted-decimal mask. A typical LAN receives a /64 prefix: the first 64 bits identify the subnet and the remaining 64 bits identify the interface. For example, 2001:db8:1:10::20/64 has the subnet prefix 2001:db8:1:10::/64.

IPv6 Address Types

IPv6 TypePrefix or AddressScopeTypical UseKey Notes
Global unicastCommonly 2000::/3GlobalInternet-routable IPv6 communicationMust be allocated and routed appropriately
Unique localfc00::/7, commonly fd00::/8Organization or sitePrivate internal addressingNot intended for public Internet routing
Link-localfe80::/10Local linkNeighbor Discovery, router communication, and local operationRouters do not forward it; an interface identifier may be needed when using it
Multicastff00::/8Defined by the multicast scope fieldOne-to-many group communicationIPv6 uses multicast instead of broadcast
AnycastUses an address assigned to multiple interfacesRouting-dependentNearest service instance or redundant gatewayNo separate anycast syntax; routing behavior provides the distinction
Loopback::1Local hostTesting the IPv6 protocol stackEquivalent conceptually to IPv4 loopback
Unspecified::NoneIndicating that an address is not yet knownNot assigned as a normal host address

IPv6 has no broadcast address. Functions that might use IPv4 broadcast are implemented with multicast, especially link-local multicast groups. An IPv4-mapped IPv6 address, such as ::ffff:192.0.2.10, represents an IPv4 address in software APIs and transition mechanisms. It does not make the underlying endpoint a native IPv6 host.

Recognizing IPv6 Addresses

  • 2001:db8:1:10::20/64 has global-unicast-style addressing, although 2001:db8::/32 is reserved for documentation.
  • fd12:3456:789a::10/64 is unique local.
  • fe80::1 is link-local.
  • ff02::1 is multicast to all nodes on the local link.
  • ::1 is loopback.
  • :: is unspecified.

IPv6 Address Assignment

Router Advertisements are ICMPv6 messages that announce prefixes, default-router information, and address-configuration instructions. With SLAAC, a host uses an advertised prefix and generates its own interface identifier. A host also normally creates a link-local address for local IPv6 operations.

DHCPv6 can provide addresses, DNS information, and other configuration. Networks may use SLAAC and DHCPv6 together: router advertisements can tell hosts to form addresses with SLAAC while obtaining additional options from DHCPv6. Static IPv6 addresses remain appropriate for routers, servers, and infrastructure that require predictable addressing.

Link-local addresses support Neighbor Discovery and communication with local routers. They are not suitable for reaching a remote network because routers do not forward link-local traffic.

Cisco IOS Configuration and Verification

Example IPv4 interface configuration:

configure terminal
interface GigabitEthernet0/0
ip address 192.168.10.1 255.255.255.0
no shutdown

Example IPv6 interface configuration:

configure terminal
ipv6 unicast-routing
interface GigabitEthernet0/0
ipv6 address 2001:db8:10:1::1/64
no shutdown

Verify interface addresses and operational state:

show ip interface brief
show ipv6 interface brief
show running-config interface GigabitEthernet0/0

Test local reachability and inspect routing:

ping 192.168.10.1
ping ipv6 2001:db8:10:1::1
show ip route
show ipv6 route

On hosts, common inspection commands include:

ipconfig /all
ip addr
ip -6 addr

Troubleshooting IP Address Problems

169.254.x.x Address and No Remote Connectivity

An address in 169.254.0.0/16 commonly means the IPv4 client self-assigned an APIPA link-local address after failing to obtain a DHCP lease. Check physical connectivity, the switch port and VLAN, DHCP server availability, DHCP relay configuration, and whether the DHCP scope has free addresses. Correct the problem and renew the lease.

Duplicate-Address Alerts

Intermittent connectivity or duplicate-address warnings can result from two static devices using the same address, a static address overlapping a DHCP pool, or an incorrect reservation. Compare device configuration with DHCP scopes and reservations. Use ARP information and the switch MAC address table to locate conflicting devices. Reserve infrastructure addresses outside dynamic pools.

Local Access Works but Remote Access Fails

Check the host address, mask or prefix, and default gateway. The gateway must belong to the same local subnet. Test the gateway first, then inspect the gateway interface and routing table. An incorrect subnet mask can make a remote destination appear local or a local destination appear remote.

IPv6 Has Only a Link-Local Address

An IPv6 host with only a fe80:: address may be missing router advertisements, a global prefix, or required DHCPv6 service. Verify that IPv6 routing is enabled, the router interface has an appropriate prefix, router advertisements are not blocked, DHCPv6 settings match the advertised flags, and a valid IPv6 default route exists.

IPv4 Broadcast Does Not Cross a LAN

IPv4 routers normally do not forward broadcasts. Confirm that the source and intended recipients are in the same VLAN and broadcast domain. If communication must cross routed boundaries, use unicast, multicast where supported, or an application design that uses a relay.

Operational and Security Considerations

  • Do not assign IPv4 network or broadcast addresses to ordinary hosts.
  • Do not route private, loopback, link-local, or documentation ranges across the public Internet.
  • Filter spoofed source addresses at network boundaries using appropriate ingress and egress controls.
  • Remember that IPv4 broadcast traffic is constrained to a local broadcast domain and can consume considerable bandwidth.
  • Use multicast only when the network infrastructure and applications support it and the traffic is required.
  • Do not assume that a private address is automatically secure; apply firewall policy, authentication, and segmentation.
  • Document static addresses and reservations to prevent conflicts.

Exam-Ready Summary

  • IPv4 is 32 bits and normally uses dotted-decimal notation; IPv6 is 128 bits and uses hexadecimal colon-separated notation.
  • CIDR identifies a network with a prefix length such as /24 or /64.
  • The default gateway forwards traffic from the local subnet toward remote networks.
  • Unicast is one-to-one, broadcast is IPv4 one-to-all locally, multicast is one-to-many by group, and anycast selects one suitable instance.
  • RFC 1918 private IPv4 ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16.
  • 127.0.0.0/8 is IPv4 loopback; 169.254.0.0/16 is IPv4 link-local; 255.255.255.255 is limited broadcast.
  • IPv6 global unicast commonly uses 2000::/3, unique local uses fc00::/7, link-local uses fe80::/10, and multicast uses ff00::/8.
  • IPv6 uses multicast instead of broadcast, and ::1 is loopback while :: is unspecified.
  • DHCP automates IPv4 configuration; SLAAC and DHCPv6 provide IPv6 configuration choices.