Details of the difference between policy-based routing and routing policy

https://blog.csdn.net/weixin_34075551/article/details/89416494?depth_1-utm_source=distribute.pc_relevant_right.none-task&utm_source=distribute.pc_relevant_right.none-task

https://wenku.baidu.com/view/7ef1c076bdd126fff705cc1755270722192e5983.html

https://blog.csdn.net/weixin_34357887/article/details/91514119

On the network equipment maintenance, are now talked about a lot of information on the maintenance of "routing policies" and "Policy Routing" these two terms, but there are a lot of technical personnel engaged in the maintenance of these two terms is not very thorough understanding of, not accurately grasp the connections and differences between the two. This paper briefly analyze the concept between the two, and introduce some examples, I hope you get a better understanding from the instances.
First, routing policy
Routing policy, routes and is received policy. In fact, the routing protocol itself is a routing strategy, because the same network structure, different routing protocols because of different mechanisms to achieve different cost calculation rules, such as the priority of different definitions may produce different routing tables, these are the most basic of. Usually what we call routing strategy means that, on top of the normal routing protocol, we according to certain rules, by changing certain parameters or set up some way to change the routing control production, publishing, the result of choice, attention, change is the result (ie routing table), the rules have not changed, but the application of these rules.
Here are some examples to illustrate.
Examples of parameter changes: e.g., the router between router A and B are dual link (AB1 and AB2 respectively) and the same bandwidth, is running the OSPF routing protocol, but not the same as the stability of the two links, the company would like to set AB1 the main circuit, when the main circuit (AB1) when it fails using the alternate circuit (AB2), the default setting if taken, the two load balancing circuit, this time can take AB1 and AB2 are provided circuits COST ( overhead) value, the value of cOST piecemeal circuit AB1 or AB2 cOST circuit provided large value, OSPF will produce two different routing overhead, lower cOST (cost) is, the cost of the route, the higher the priority, AB1 precedence router circuit. COST can not change value, and the bandwidth of the two circuits (BandWidth) inconsistent set larger than the bandwidth provided AB2 AB1 is generated in accordance with OSPF discovery and routing rules, AB1 overhead (COST) will be lower than the AB2 , the router will also give priority circuit AB1.
Changing the control example, substantially is to use route filtering policy, perform some operation on routes matching that rule routing policy, for example, the most common operation is rejected (the deny) and allowed (Permit), followed by adjustment on the basis of allowing the Some of these routing parameters, such as COST value, and so on, there are strategies commonly used ACL (Acess control list access control list), ip-prefix, AS-PATH, route-policy and so on. Most of the BGP routing strategies and protocols used in conjunction with, the part of the route and to receive notices principles.
For example, AS1 AS2 19.1.1.1/32 not to publish this segment, you can set the ACL list, set on RTB (Huawei router for example):
[the RTB] Number The acl-1 match the Order Auto
[the RTB-acl-Basic -1] Source 19.1.1.1 the deny rule 0
[ACL-RTB---Basic. 1] Source the permit the any rule
[RTB-] BGP. 1
[BGP-RTB-] Use the peer AS-2.2.2.2 Number 2
[BGP-RTB-] Import-route OSPF
[RTB-bgp] peer 2.2.2.2 filter -policy 1 export
if B has released the route to C, but C did not want to receive this route, you can set the C:
[the RTC] Number the acl-1 match the Order Auto
[RTC- . 1-Basic-ACL] Source 19.1.1.1 the deny rule 0
[ACL-the RTC. 1-Basic-] Source the permit the any rule
[the RTC] BGP 2
[the RTC-BGP] Use the peer AS-Number 2.2.2.1. 1
[the RTC-BGP] Use the peer 2.2.2.1 filter-policy 1 import
Another example of ip-prefix:
E.g. RTB does not advertise routes to the network 19.1.1.0/24 the RTC, may be provided
[RTB] IP-IP prefix the deny 19.1.1.0 Test index 10 24
[RTB] Test index IP prefix IP-20 is the permit the any
[RTB] . 1 BGP
[BGP-RTB-] Use the peer AS-2.2.2.2 Number 2
[BGP-RTB-] Import-OSPF route
[BGP-RTB-] Direct Import-route
[BGP-RTB-] Use the peer IP-prefix 2.2.2.2 Test Export
ip-prefix match is exact, if you want to achieve fuzzy matching, can be achieved by the latter parameter less-equal or greater-equal, e.g. ip ip-prefix test index 10 deny 19.1.1.0 24 less-equal 31 from 19.1, it says .1.0 / 24,19.1.1.0 / 25,19.1.1.0 / 26 until 19.1.1.0/31 can match, otherwise this is just to match only purpose of this network is 19.1.1.0/24 a route, and 19.1.1.0 / 25 does not satisfy this condition, specifically refer to the manual command, not explained in detail here.
Mentioned above are prohibited routes and run, following about a more flexible way of setting a routing policy: route-policy and apply the if-match match, where not only can be set to allow or disallow certain routes, but also to allow routing set its properties.
Running between RTB and RTC is IBGP protocol, RTA between RTB, and RTC are running EBGP protocol. Router_ID by A, B, C, D from small to large. Under normal circumstances, the communication between the RTA to do RTB RTD will choose transit, RTD to RTB RTA communications will choose, by default, all parameters are the same, BGP will choose router_ID smaller path. RTD now want to go all communications between the RTA RTB, and the communication between the RTA to RTD through RTC, namely two routers in RTB responsible for communication between the outlet and the router autonomous region outside the router, and specialize in RTC imported communication outside the autonomous region router and the router, we can use as-path route-policy is to achieve, to do on RTB:
[rtb]-route the Test Policy in permit the Node 10
[rtb-route-Policy] the Apply as-path 300 400 // add a false path, the as-path increase
[rtb-bgp] peer 1.1.1.1 route -policy test export / / use strategies to release routing information when RTA
Thus when the release BGP routes B to A, AS-Path increase of the routes, according to the BGP routing rules, AS-Path preferred shorter route, so that when the RTD to RTA communication, preferred short AS-Path the route of the RTC, RTA and RTD in the choice of the route of choice is still time to RTB, because of the RTD, the impact of routing parameters have not changed anything. In fact, it can also be used to change the Med value is set, here exemplified by routing policy.
This method is particularly flexible and can set a variety of parameters apply statement, except as-path, as well as ip next hop (the next hop set), local-preference (local export priority), cost (overhead), origin (origin from igp, egp or incomplete), tag (tag).
Second, policy-based routing
2.2.2.2/30
2.2.2.1/30
1.1.1.2/30
the RTB
1.1.1.1/30
10.10.10.0/24
policy routing in the case of the routing table has been created, not forwarded in accordance with the existing routing table, but according to need, select certain other routing traffic ways.
PC2
PC1
switch
RTA
As shown, the communication between the RTA and RTB have two links, one above the main circuit is used, 1000M bandwidth, the following is a standby circuit, the bandwidth of 10M, 10M now substantially free, most communications are gone main spend away, PC1 (10.10.10.10/24) is a particularly important customer, he sent the required information is transmitted immediately, according to our case, we can send him alone traffic use the following the method of the standby circuit.
Map intervlan permitpc1 IP-rule 10.10.10.10 the any 0.0.0.0
Flow-Action Next2 the redirect IP 2.2.2.2
EACL ABC permitpc1 Next2
Applications then issued using the access-group eacl abc 10.10.10.0/24 on ports and the network attached.
This is a typical application of a policy-based routing. This application is selected according to the source address of the forwarding path, may also (for example, TCP and UDP run separate different circuit) according to the protocol type, an application (e.g., certain applications require real-time transmission of video, the stream may be used alone rstp a circuit run), packet size, etc., or a combination thereof disposed forwarding conditions. In fact, the acl rules are applied to the data forwarding rule rule-map example with the ACL, not here in lifting more of the familiar ACL technicians know.
Here flow-action do the action redirect is next provided one, using the flow-action may also be QoS related operations, for example, cos or car operation data packets match the queue, then operation according to the traffic model rule settings, in particular see the command reference Manual.
Third, the connections and differences
contact:
The two sides are to forward packets and performs policy routing, we are changing some parameters or controls to set different forwarding paths according to certain rules.
the difference:
Routing policy is based on some rules, change the rules of the use of certain policy parameters affecting routes, reception or routing route discovery and change the outcome of the final change is the contents of the routing table. Is an effect when the route discovery.
Despite the current PBR is the best route, but do not use the current forwarding path routing table for some particular host (or application protocol) and use another forwarding path alone. In the packet forwarding action occurs when, without changing a routing table.
PBR has higher priority than the routing policy, when the router receives the packet and forwards, and will give priority to match according to the rules PBR, if they can match the then forwarded based on PBR, otherwise in accordance with the routing table forwarding path for forwarding.
Summarize a little talk is, routing policy routing discovery rules, policy-based routing is a packet forwarding rule. In fact, the "policy routing" as "forward strategy", it is easier to understand and differentiate. Because the underlying forwarding, routing at the top, so forwarding higher priority than the priority of the route, this also can understand through. In fact, there are two types and levels of tables in the routers, a routing table (routing-table), and the other is forwarding (forwording-table). Forwarding is mapped by the routing table over, policy routing direct effect was published in turn, routing strategies direct effect on the routing table.
Fourth, the advantages and disadvantages
Rules communication network is the first route, only forward. Since routing policy only have an effect when the route found in the routing table after generating stable, if the network does not change, the routing table usually does not change, this time, routing policies do not apply will not take up resources. The PBR is the effect occurs when forwarding router after the initial creation of routing tables, the workload in basic packet forwarding, if there is no policy routing, router, as long as the analysis of the destination address of each packet, then the routing table match can determine the next hop; but if there PBR PBR has been in use state, if the policy routing is particularly complex, the router determines additional information to the source address of the packet, protocol or application according to the rules, this will It has been take up a lot of resources, so unless a last resort, try using a routing policy, rather than policy-based routing. Network optimization time to consider this, if the policy routing is particularly complex, the network can be simple to achieve as much as possible to decompose decomposition cancellation policy routing, or routers heavy burden.

Guess you like

Origin www.cnblogs.com/jodyccf/p/12502372.html