Generally a router id will be set to highest loopback address if present or the highest ip address of physical interface. But most vendors provide a way to configure a specific value example:- " ip router-id 18.104.22.168". My question here is is there any restrictions for value of router-id that can be configured? any RFC recommendations ? Can i configure "255.255.255.255" as my ip router-id ?
I manually set my router-ids as the management IP address I use to get into the router. To me, it just makes sense and makes getting into a neighbor seamless.
Over at CCIEZone, they have a really thorough way of distinguishing routers on a network. I wish I would have discovered this sooner.
Courtesy of cciezone.com
There is no restriction to what the router-id is, so
You didn't specify a protocol, so the answer is "it depends". If you're not using MPLS TE anywhere, the value of the Router ID doesn't seem to matter for OSPF, OSPFv3, BGP, ISIS or LDP. Technically in these cases, you can assign "255.255.255.255" as the 32-bit portion of the Router ID.
While these protocols are not strictly considered a routing protocol, you cannot divorce underlying IGP choices from your ability to deploy MPLS TE. Therefore, if you are using MPLS TE with OSPF TE Extensions, CR-LDP, etc... then it's recommended to assign your Router IDs as an address on the same router.
Overall Guidance: Keep it simple for your coworkers and future service deployments
While IGPs allow you to chose any value for Router IDs, you shouldn't make life harder than necessary. While you could theoretically assign Router-1's Router ID to be a Loopback address on Router 2, don't do that unless you already plan to make a bad reputation for yourself.
Anyone who has to support the infrastructure after you will hate the aforementioned decision. Furthermore, you'd be making implementation of some MPLS TE services much harder, because people would have to reassign the Router IDs to get several of the MPLS TE services up.
RFC 1142, (ISIS) - A variable length field, from 1 to 8 octets
RFC 2328, Section 5 (OSPF) - A 32-bit number
Only defines the Router ID as a 32-bit number, thus any 32-bit number can be used:
RFC 4271, Section 4.2 (BGP) - A 4-octet unsigned integer
The BGP ID is defined as a "4-octet unsigned integer" in the OPEN message.
RFC 2740, Section 2.2 (OSPFv3) - a 32-bit number
Explicitly disallows any relationship between the addresses in the protocol (IPv6) and the Router ID, which is only a 32-bit number.
RFC 4577, Section 4.2.2 (OSPF for BGP/MPLS IP VPNs) - A 32-bit number (valid OSPF RID)
RFC 5036, Section 3.1 (LDP) - 6 bytes, 4 of the bytes should be a valid IGP Router ID
RFC 3480, Section 2 (CR-LDP) - A stable IP address that is always reachable
Defines a Router ID as "a stable IP address of an LSR that is always reachable if there is any connectivity to the LSR." Thus it pretty much has to be a loopback address
RFC 3630, Section 2.4.1 (OSPF-TE) - A stable IP address of the advertising router
RFC 3630, Section 2.4.1 (OSPF-TE), requires a "stable IP address of the advertising router"
Most routing protocols will use the router ID for various means but you should avoid thinking of this as an IP address. The router ID is actually an arbitrary 32-bit number so yes you can assign anything you wish to as long as you avoid duplicate IDs between devices.