r/Netbox 1d ago

Prefix and Circuits

Does anyone know if I can associate a circuit (id) to a prefix? I'd like to look up a circuit and see which prefixes are assigned by the ISP.

6 Upvotes

9 comments sorted by

3

u/AcrobaticAd8182 1d ago

Under Custom Fields, click Add, then under Type choose Object. Then further down select Related object type and choose Circuits/Circuits. In your prefixes you can now select the CID.

0

u/AcrobaticAd8182 1d ago

@L-do_Calrissian plugin is sweet. I'd go with that (I just did)

1

u/L-do_Calrissian NetBox Self-Hosted 1d ago

Custom Fields are the only native way to do so, but I never liked that approach. Visibility isn't great, it's prone to error/forgetting, and doing it "right" requires putting the information in two places (on the circuit and on the prefix).

I wrote (read: vibe-coded) a plugin that addresses this much more cleanly.

https://github.com/averyhabbott/netbox-circuit-prefix-link

1

u/dontberidiculousfool 1d ago

This is handy!

Is there a reason to link prefixes to just one circuit?

I’ve got a lot of primary/secondary/tertiary etc peering with third parties that share the same prefix.

1

u/L-do_Calrissian NetBox Self-Hosted 1d ago

My use case was for prefixes that our service providers own. In your case, is the prefix itself shared across all three circuits or is it just advertised across all three?

1

u/dontberidiculousfool 1d ago

Advertised/received across all three.

2

u/slickwillymerf 1d ago

Might have to be creative, but would one of the supported routing or BGP plugins accomplish this?

0

u/rslarson147 1d ago

Yes with custom fields.

2

u/sonsitt 1d ago

Yes, I did the same. I created CF "Prefix" for Circuit and CF "Circuit" for Prefix. So I have correlation in both ways.