21

I'm looking for a list of CIDR blocks for "The Internet", i.e. everything from 0.0.0.0 to 223.255.255.255, excluding RFC1918 address space of 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 (yes, I know there are lots of little nets in there that are special, like 192.0.0.0/24, but I really don't care about them). I figure this list must exist somewhere on the Internet, but my google-fu is failing me, so I figured I'd ask here before generating the range myself.

Edit: I forgot a really important part of this question: I need it in the fewest possible number of entries.

And if you want to know what I'm doing with this, we are entering static flow-mods to work around some nasty issues in an OpenFlow controlled network that currently has a significant amount of badness happening, and we need to reduce the number of flow entries temporarily so we don't exceed the available space in the flow tables and cause everything to come crashing down for a few minutes while it reestablishes a connection to the controller.

Paul
  • 2,755
  • 6
  • 24
  • 35
Jed Daniels
  • 7,172
  • 2
  • 33
  • 41

6 Answers6

64

Let me show my working here...

You need a minimal number of CIDR blocks to cover:

  • 0.0.0.0-9.255.255.255
  • 11.0.0.0-172.15.255.255
  • 172.32.0.0-192.167.255.255
  • 192.169.0.0-223.255.255.255

To turn these ranges into minimal CIDR blocks, you can just use netmask (the swiss army knife of addressing), like so:

$ netmask -c 0.0.0.0:9.255.255.255
    0.0.0.0/5
    8.0.0.0/7
$ netmask -c 11.0.0.0:172.15.255.255
   11.0.0.0/8
   12.0.0.0/6
   16.0.0.0/4
   32.0.0.0/3
   64.0.0.0/2
  128.0.0.0/3
  160.0.0.0/5
  168.0.0.0/6
  172.0.0.0/12
$ netmask -c 172.32.0.0:192.167.255.255
 172.32.0.0/11
 172.64.0.0/10
172.128.0.0/9
  173.0.0.0/8
  174.0.0.0/7
  176.0.0.0/4
  192.0.0.0/9
192.128.0.0/11
192.160.0.0/13
$ netmask -c 192.169.0.0:223.255.255.255
192.169.0.0/16
192.170.0.0/15
192.172.0.0/14
192.176.0.0/12
192.192.0.0/10
  193.0.0.0/8
  194.0.0.0/7
  196.0.0.0/6
  200.0.0.0/5
  208.0.0.0/4

Hey presto, Bob's your Auntie's live-in lover.

womble
  • 95,029
  • 29
  • 173
  • 228
4

Bogon space, and non-bogon space CIDR blocks are available in the bogon report:

http://www.cidr-report.org/bogons/

Steve-o
  • 829
  • 6
  • 12
3

I have no idea what you're planning on using this for, but here you go:

http://bgp.potaroo.net/as2.0/bgptable.txt

Just a total dump of the BGP routing table.

Jason Berg
  • 18,954
  • 6
  • 38
  • 55
3

Yes. You are looking for the IANA IPv4 Address Space Registry.

The IPv4 Address that are on the Internet are the ones who start of with one of the numbers what are Allocated in that table.

Ricardo Polo Jaramillo
  • 2,039
  • 1
  • 18
  • 35
0

I know it's an old question and old answer... But I found it useful when searching for a way to define all non private networks used for local communication.
See: https://en.wikipedia.org/wiki/Reserved_IP_addresses

10.0.0.0/8
172.16.0.0/12 
192.168.0.0/16

I just extend the answer by @womble all the way up to 255.255.255.255, instead of stopping at 223.255.255.255.

0.0.0.0-9.255.255.255
11.0.0.0-172.15.255.255
172.32.0.0-192.167.255.255
192.169.0.0-255.255.255.255

The result with netmask:

$ netmask -c 0.0.0.0:9.255.255.255
    0.0.0.0/5
    8.0.0.0/7
$ netmask -c 11.0.0.0:172.15.255.255
    11.0.0.0/8
    12.0.0.0/6
    16.0.0.0/4
    32.0.0.0/3
    64.0.0.0/2
    128.0.0.0/3
    160.0.0.0/5
    168.0.0.0/6
    172.0.0.0/12
$ netmask -c 172.32.0.0:192.167.255.255
    172.32.0.0/11
    172.64.0.0/10
    172.128.0.0/9
    173.0.0.0/8
    174.0.0.0/7
    176.0.0.0/4
    192.0.0.0/9
    192.128.0.0/11
    192.160.0.0/13
$ netmask -c 192.169.0.0:255.255.255.255
    192.169.0.0/16
    192.170.0.0/15
    192.172.0.0/14
    192.176.0.0/12
    192.192.0.0/10
    193.0.0.0/8
    194.0.0.0/7
    196.0.0.0/6
    200.0.0.0/5
    208.0.0.0/4
    224.0.0.0/3
Sam
  • 350
  • 1
  • 4
  • 16
-2

Not with the fewest possible entries; but I think it's a comprehensive list.

0.0.0.0/1
0.0.0.0/5
8.0.0.0/7
11.0.0.0/8
12.0.0.0/6
16.0.0.0/4
32.0.0.0/3
64.0.0.0/2
128.0.0.0/1
128.0.0.0/2
128.0.0.0/3
160.0.0.0/5
168.0.0.0/6
172.0.0.0/12
172.128.0.0/9
172.32.0.0/11
172.64.0.0/10
173.0.0.0/8
174.0.0.0/7
176.0.0.0/4
192.0.0.0/2
192.0.0.0/9
192.128.0.0/11
192.160.0.0/13
192.169.0.0/16
192.170.0.0/15
192.172.0.0/14
192.176.0.0/12
192.192.0.0/10
193.0.0.0/8
194.0.0.0/7
196.0.0.0/6
200.0.0.0/5
208.0.0.0/4
224.0.0.0/3
  • 3
    Just `0.0.0.0/1` and `128.0.0.0/1` is enough to span all of IPv4 address space. Also notice that you have answered a very old question which is now somewhat outdated. The question does not mention how it wants RFC 6598 addresses treated (which makes sense because the question was written before the publication of that RFC). Additionally nobody in their right mind consider IPv4 address space to be all of the internet anymore. – kasperd Jan 19 '19 at 09:33