BGP uses Classless Inter-Domain Routing (CIDR) notation for masks. When advertising routes, BGP will include prefixes in it's advertisements. A prefix is the network IP address plus the mask in CIDR notation.
Below are tables showing how IP masks and CIDR masks are related. In every IP address, certain bits are used to identify the network, and certain bits are used for host. The mask allows the receiver to tell which bits are network, and which are host. Ones are used to mark the Network bits, and zeroes are used to mark the Host bits.
CLASS 'A' NETWORKS | |
BINARY | 11111111.00000000.00000000.00000000 |
DECIMAL | 255.0.0.0 |
CIDR | /8 |
CLASS 'B' NETWORKS | |
BINARY | 11111111.11111111.00000000.00000000 |
DECIMAL | 255.255.0.0 |
CIDR | /16 |
CLASS 'C' NETWORKS | |
BINARY | 11111111.11111111.11111111.00000000 |
DECIMAL | 255.255.255.0 |
CIDR | /24 |
You will note that the number in the CIDR mask notation is equal to the number of 1's in the binary mask. The same holds true for subnets:
1/2 CLASS 'C' NETWORK | |
BINARY | 11111111.11111111.11111111.10000000 |
DECIMAL | 255.255.255.128 |
CIDR | /25 |
And for supernets as well:
2 CLASS 'C' NETWORKS | |
BINARY | 11111111.11111111.11111110.00000000 |
DECIMAL | 255.255.254.0 |
CIDR | /23 |
So for CIDR notation, the number after the slash is equal to the number of network bits (1's) in theymask.