Networking & Routing

What is Prefix?

Also known as: IP Prefix

Definition

A prefix is a contiguous block of IP addresses represented by a base address and a prefix length, used in routing tables to aggregate multiple routes into a single advertisement.

A prefix, also called an IP prefix, is a fundamental unit of routing in IP networks. It defines a contiguous block of IP addresses using a base address and a prefix length, written in CIDR notation such as 192.0.2.0/24. The prefix length indicates the number of fixed bits in the network portion; the remaining bits identify hosts within that block. For IPv4, prefix lengths range from 0 to 32; for IPv6, from 0 to 128.

In BGP, prefixes are the objects exchanged between autonomous systems. A single BGP UPDATE message carries one or more prefixes along with path attributes. Routers maintain a routing table composed of prefixes, each associated with a next hop and a metric. When multiple prefixes overlap (e.g., a longer prefix like 192.0.2.0/25 inside a shorter one like 192.0.2.0/24), the router uses the most specific (longest) match for forwarding decisions.

Prefix aggregation reduces the size of the global routing table. An ISP that owns 203.0.113.0/24 can announce that single prefix instead of 256 separate /32 host routes. This practice, called supernetting, conserves router memory and speeds convergence. However, the Internet relies on a balance: too much aggregation can force traffic to suboptimal paths, while too little causes table bloat. The concept is defined in RFC 4632 for CIDR and RFC 1519 for its predecessor.

Key facts

  • A prefix is written as an IP address followed by a slash and the prefix length, e.g., 10.0.0.0/8.
  • Prefixes are the atomic unit of routing information in BGP and OSPF.
  • Longest prefix match (LPM) is the algorithm routers use to select the most specific route.
  • CIDR replaced classful addressing in 1993, enabling flexible prefix lengths.
  • The global IPv4 BGP table contained over 950,000 prefixes as of early 2025.

How it works in practice

An ISP owns the IPv4 block 198.51.100.0/24. Instead of announcing 256 separate /32 host routes, it announces the single /24 prefix to its upstream provider. A customer with a /28 sub-allocation (198.51.100.16/28) may announce that longer prefix to the ISP, which then propagates it to the Internet. Routers along the path use longest prefix match: traffic to 198.51.100.20 goes via the /28 route, while traffic to 198.51.100.200 uses the /24 route.

Related terms

CIDR BGP Route Aggregation Longest Prefix Match Subnet Supernet

References

More in Networking & Routing

Anycast

Anycast is a network addressing and routing method where a single IP address is assigned to multiple servers, and routers send traffic to the nearest server based on routing protocol metrics.

AS Path

A BGP path attribute that lists the sequence of autonomous system numbers a route has passed through, used for loop detection and path selection.

ASN

A globally unique 16 or 32 bit number assigned to an autonomous system for use in BGP routing between organizations on the Internet.

Autonomous System

An Autonomous System (AS) is a group of IP networks under a single administrative routing policy, identified by a unique ASN (Autonomous System Number) for exterior gateway routing.

BGP

BGP (Border Gateway Protocol) is the path vector routing protocol that networks use to exchange reachability information between autonomous systems on the public internet.

CIDR

CIDR (Classless Inter-Domain Routing) is a method for allocating IP addresses and routing packets using variable-length subnet masks (e.g., /24) instead of fixed classful boundaries.

Hop

A hop is one passage of a packet through a router or other layer-3 forwarding device as it travels from source to destination across an internetwork.

IPv4

IPv4 is the core Internet Protocol using 32-bit addresses, providing roughly 4.3 billion unique identifiers for network interfaces on the global internet.

IPv6

IPv6 is the most recent version of the Internet Protocol, using 128-bit addresses to provide an effectively unlimited number of unique identifiers for networked devices.

Latency

Latency (or round-trip time, RTT) is the time required for a packet to travel from a source to a destination and back, measured in milliseconds, and is a critical metric in network performance.

Who Is Online

In total there are 75 users online: 0 registered, 69 guests and 6 bots.

Bots: AhrefsBot Facebook Majestic Other Bot Other Spider SemrushBot

Users active in the past 15 minutes. Total registered members: 340