Forgive me if this is a dumb question but I'm relatively new to the carrier networking world. We own a block of IP addresses, say a /18 and we advertise various /20s, /24s, /23s, etc all over the world. I want to know "what's available" from our space as in if there are portions that we are not advertising.

What I could do is download a text dump of the entire BGP routing table and grep for the /18, /19s, /20s, ... , /24s and see if there are any matches but there has to be a better way.

We use Juniper so I popped into a router and ran show route protocol bgp FIRST_IP_OF_18 but it only gave me a route to the first thing we advertise.

  • 2
    If you do not have an IPAM database, this is going to be a painful process. The company should really have been tracking this in IPAM all along, and there is probably such a thing the company has that you have not been told about.
    – Ron Maupin
    Commented May 19, 2020 at 19:55
  • @RonMaupin - We do have one but I'm operating under the assumption that it's not up to date as I'm auditing it. It seems pretty straight forward. If we are advertising various subnets shouldn't these be reflected in the BGP tables? Commented May 19, 2020 at 19:56
  • Yes, but it could be a problem sorting it all out and figuring what is an aggregate being advertised vs. what is an actual network being advertised. Aggregates will advertise a full block, even if there is only one network up in that block, so you may not be advertising but one of many networks in the aggregate.
    – Ron Maupin
    Commented May 19, 2020 at 20:00
  • @RonMaupin Not sure what you mean by "Aggregates will advertise a full block". If were not advertising hte whole /18 but rather a /20 here, /24 there you're saying some routers will just see the /18? Commented May 19, 2020 at 20:10
  • Say you are using one /24 block. You could advertise the aggregate, say /20, either both the aggregate and the individual network, or just the aggregate only. The aggregate will be advertised as long as at least one of the networks in the aggregate is in the router's routing (not BGP) table. Assuming the aggregate being advertised means that all the networks in the aggregate are in use is a mistake. The aggregate looks like it is a /20 network is in use, but there may be only one or a few of the networks in that /20 aggregate that are actually being used.
    – Ron Maupin
    Commented May 19, 2020 at 20:18

2 Answers 2


You can get the BGP information you want as follows, substituting for the neighbor IP of your transit provider(s):

> show route advertising-protocol bgp terse 

inet.0: 802360 destinations, 1406516 routes (802358 active, 2 holddown, 1 hidden)
  Prefix          Nexthop          MED     Lclpref    AS path
*         Self                                    I
*      Self                                    I

However, as other posts have suggested, you need an IPAM. It is likely you are announcing your supernets to transit providers even if you may not be using all addresses within those supernets.

You really need to look at your internal routing protocol information. Do you have all your address space routed internally within your network to destination customers or VLANs? This will give you a more specific view of your situation than your external advertisements.

Finally, I hope you won't take this the wrong way, but, you should get some help. If you're looking for available IPs by asking basic questions about how your routers work (and not the right questions) you're in pretty far over your head.

  • 1
    No offense taken! This is how I'm learn and now am less far over my head ;). Appreciate the response. Commented May 20, 2020 at 12:45

You shouldn't need to dump the entire global BGP routing table. All of this can be gleaned from looking at the BGP configuration on your router(s). If you're lazy, or just in a serious rush, lookup your AS# on any number of looking glasses. (bgp.he.net is an easy web based one.)

You should be announcing your entire block, in addition to any more specifics. Failing to do so is asking for people to steal your "unused" address space.

If you're trying to do a full internal audit of used vs. available address space, looking at what the rest of the world is seeing (BGP) is only part of the picture. You'll have to look at the configuration of every router to see what is being referenced. Just because it isn't currently in the routing table doesn't mean it's available.

(I've been the one tasked with doing such an audit. It's messy; and much scripting was involved.)

  • The looking glass by AS is exactly what I was looking for. How do I do that exact same command on a Juniper router (as that's essentially what the looking glass is doing) Commented May 20, 2020 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.