Usually, when using BGP, you can choose (or your device chooses four you) a router ID from one of your assigned public IP addresses.

Now, let's admit you only run IPv6. As the router ID is still a 32 bits number, it can not be copied from a loopback's address.

The draft-dupont-durand-idr-ipv6-bgp-routerid-01 brings a start of an answer, suggesting to use your AS number suffixed with a locally allocated part. But that works only for 16 bits AS numbers.

So, how to choose a RID for your devices ? Randomly ? If so, how would devices react in case of collision (both ends of a BGP session use the same RID) ?

PS : the issue also concerns OSPF, but then you only have to design a coherent RID allocation scheme. Which you can not do when using BGP to peer with other ASes.


Autonomous-System-Wide Unique BGP Identifier for BGP-4 answers your question. Basically BGP Identifier need only to be unique within your AS since 2011.


Color me unsure on this answer...

router-ids only really need to be unique within the OSPF space, as you mentioned.

Within BGP, my understanding is that they are only used to detect a new peering session being created when one already exists...to which I guess the solution is to tear down the old one.

If the peering sessions come in on different transport addresses, then even if the router-ids presented are the same, they will be seen as different sessions because they're coming from different transport addresses (IPv6 addresses in your scenario).

So...I guess the answer would be to pick your router-ids for OSPF (v3 presumably) and its probably not the end of the world if your router-id ends up duplicating the router-id that another (third party) peer uses with an external AS peer


Assuming you really aren't running v4 at all, not even a loopback then the method I'd suggest would be to simply allocate a sequential number per router and use that, no need to segment it at all, and you might have an existing inventory number that might work (although consider how that might work in the context of an RMA).

Most notably this makes IS-IS much nicer to use than hand-padding an IPv4 address.

If you (for some odd reason) had a network where only some devices were IPv6 only you might want to offset the manual numbers so they won't be confused with real IPv4 addresses. Using 240/8 is one idea (I'd suggest against 255/8 or even 254/8 to help avoid a tired ops brain paged at 3am from wondering why a router id is set to a broadcast address).


My suggestion would be to adapt your AS number by treating it as a 32 bit AS (if it isn't already) - zero the upper 8 bits and OR with 0xE0000000 (makes it look like multicast space). For simplicity of explanation, I'll use hexadecimal (no really, that makes it easier to see the boundaries)

e.g. if your AS number is 717232 (0x000AF1B0) you get initially 0xE00AF1B0 and you can increment the upper-most octet for each BGP speaker in your AS 0xE00AF1B0, 0xE10AF1B0 etc.

Converting to decimal? easy, split the hex up and break out your favourite prograamer's calculator: E0.A.F1.B0 ->, E1.A.F1.B0 ->, etcetera.

Of course, there's an infinite number of methods you could devise to handle this situation, the key point is just to be proactive about avoiding duplicates. Within BGP, you must ensure that neighbours do not have the same router ID, however, you can peer two separate routers with the same ID to a third one, just bear in mind that routerid is used as a tie breaker for bestpath selection.


IPv4 loopback interface? I know Cisco IOS will use the highest address (32bit number) as the router ID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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