I'm sorry if its a simple question, but its a really big problem for me at the moment. We have a project to program a router network in Quagga, and I did that (though with some problems since we only did OSPF in class), but I can't figure out how to assign cost to RIP and BGP. From what I can tell, from the quagga.pdf on the nongnu website, they don't have cost only distance, which I'm not sure is the same thing.

If is possible to use cost, I'd appreciate any help in how to do it, cause I'm stumped at the moment.

  • Removed the off-topic question soliciting opinion-based answers. – Ron Maupin Jan 29 '17 at 19:52

So there's a decision tree that just about any router goes through when determining routes. The respective routing protocols (RIP, BGP, OSPF, IS-IS, static) run their own algorithms to determine the ideal path to a given prefix. If the router is presented the same route (i.e. identical network and prefix length) then the administrative distance is consulted. This is the relative priority of the various routing protocols on the box, and in most implementations the lowest value wins.

So - my understanding from Quagga is that it treats RIP routes as having a default administrative distance of 120. If you don't specify a different AD on a static route it will end up with a value of 1. As such, a static route will normally take precedent over a RIP route. In turn, if you set up a static route with an AD of 200 (for example) it will only be used if the equivalent RIP route leaves the table (this is known as a floating static route).

In your example the situation is that routes received via BGP may have one of two different AD's - one for internal BGP routes (this is 200 by default in Cisco - would assume something similar for Quagga) and another for externals (usually much lower - 20 in Cisco).

You can adjust the AD in Quagga manually. Take a look at the manual and specifically consider the distance command under each routing protocol definition. You can see these rules in effect when you look at the routing table, where the format is usually something like x.y.z.q/nn [AA/MMMM] where AA = administrative distance and MMMM = the metric within the protocol.

As an aside - and I hope this is obvious from what I've written above - the longest prefix match is always the most important factor. A /32 received in RIP with an AD of 120 will trump an overlapping /24 from eBGP with an AD of 20. This is just basic routing, though.

Also - in almost every properly designed networking scenario there is no need to adjust AD. If this seems like the only way to approach the design I would strongly consider re-approaching the design altogether as there's lots of potential for operational issues, routing loops and the like when AD is not consistently applied.

Hope this helps.

| improve this answer | |
  • Thanks, i guess i'll ask how others did it or the professor, its not up to me really, we clearly have in the project description to assign costs and when i asked about it she said costs exit for rip and bgp, my professor might have misunderstood me, but still i had to try and ask here. – Pandryl Jan 29 '17 at 20:12

How do you define cost in Quagga for BGP and RIP?

Simply put, you don't.

You are comparing apples to oranges. OSPF, a link-state routing protocol, uses cost, but neither RIP nor BGP use cost. RIP is a distance-vector protocol that uses the hop count as its metric, and BGP uses a variety of properties to determine the direction to send traffic.

I would politely suggest that, because you had to ask this question, you simply do not have the skills to properly configure BGP. BGP is a very complex protocol, and you really need to understand it. It connects different ASes (Autonomous Systems) that are managed by different entities, each of which maintains its own routing policies. BGP can suggest something to a different AS, but the other AS is completely free to ignore that and route how it wants to route.

| improve this answer | |
  • Honestly i'd agree, as i said we only did ospf and nothing too complex at that, but i managed to connect the ASes and different rip domains, just the cost remains. Do you have any suggestion on what to use instead of cost i asked the professor how do i add cost to bgp and rip she said to read quagga.pdf and that she can't remember the command. One colleague suggested using route map, but i don't know which metric to set, should i just type cost and assign a value, would that even work? – Pandryl Jan 29 '17 at 19:57
  • There is no cost for BGP. If you want to try to influence routing, there are multiple steps involved. You could try AS prepending, or MED, but, as I wrote, the other AS is free to completely ignore this. Look at BGP Best Path Selection Algorithm. None of that even means anything if the other AS wants to do things its own way. – Ron Maupin Jan 29 '17 at 20:02
  • What about for rip? – Pandryl Jan 29 '17 at 20:03
  • RIP simply uses the hop count (how many routers away). Cost is a concept used by link-state routing protocols, but RIP is a distance-vector protocol. RIP is designed to be simple, and the hop limit is very small. – Ron Maupin Jan 29 '17 at 20:06

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.