Prefixes vs Routes vs Network

Is there any distinctive difference between routes and prefixes, can these terms be used interchangeably:

Do routers learn and/or advertises prefixes or routes or a network? and in what format?

Hello Alpha

This is an excellent question, as these terms are often used interchangeably and in different contexts.

Strictly speaking, the definitions of these terms are as follows:

  • A network is defined by a network address and a subnet mask. For example, 192.168.5.0/24 is a particular network. It is defined as a set of addresses, in this particular case, 192.168.5.0 to 192.168.5.255 (including both network and broadcast addresses). This network actually physically exists somewhere on the infrastructure, and is directly connected to a particular routed port (of a router or switch) which acts as its default gateway.
  • A prefix is the leftmost portion of an IP address that is defined by the subnet mask. As the word prefix indicates, it is the first X number of bits of the network. In the above example, the prefix is 192.168.5 which is the first 24 bits. We also call the /24 part of the notation “the prefix”. In other words, this network has a prefix of 24, which also means the first 24 bits are defined as the prefix of this network. We never write it out as simply 192.168.5 but we include the zero at the end and say 192.168.5.0/24 is the prefix. A prefix is found within the routing table and composes part of the route.
  • A route is a particular entry in the routing table. A route is composed of a prefix, and either a next hop IP, an exit interface, or both. The route contains all the information necessary to know where to send a packet that has a destination of a particular network.

So a network and a prefix look the same, but mean something slightly different in a different context. A route contains a prefix within it to get to a particular network.

However, these terms are often interchanged, and are not used with such a strict discernment of what each one is. This is why you will have to figure out what is being said by the context in which it is expressed.

I hope this has been helpful!

Laz

1 Like