{"id":11828,"date":"2023-04-02T12:57:25","date_gmt":"2023-04-02T19:57:25","guid":{"rendered":"https:\/\/www.xh86.me\/?p=11828"},"modified":"2023-04-02T12:57:25","modified_gmt":"2023-04-02T19:57:25","slug":"%e5%8d%8e%e4%b8%89%e4%ba%a4%e6%8d%a2%e6%9c%ba%e7%ad%96%e7%95%a5%e8%b7%af%e7%94%b1%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.xh86.me\/?p=11828","title":{"rendered":"\u534e\u4e09\u4ea4\u6362\u673a\u7b56\u7565\u8def\u7531\u914d\u7f6e"},"content":{"rendered":"<p>\u534e\u4e09\u4ea4\u6362\u673a\uff08H3C\uff09\u7684\u7b56\u7565\u8def\u7531\uff08Policy-Based Routing, PBR\uff09\u5141\u8bb8\u60a8\u6839\u636e\u7279\u5b9a\u6761\u4ef6\uff08\u5982\u6e90 IP \u5730\u5740\u3001\u76ee\u7684 IP \u5730\u5740\u6216\u670d\u52a1\u7c7b\u578b\uff09\u8def\u7531 IP \u6570\u636e\u5305\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u57fa\u4e8e\u534e\u4e09\u4ea4\u6362\u673a\u7684\u7b56\u7565\u8def\u7531\u914d\u7f6e\u793a\u4f8b\uff1a<\/p>\n<p>kotlin<br \/>\nCopy code<br \/>\n! \u5b9a\u4e49\u8bbf\u95ee\u63a7\u5236\u5217\u8868\uff08ACL\uff09\u4ee5\u5339\u914d\u8981\u7b56\u7565\u8def\u7531\u7684\u6d41\u91cf<br \/>\nacl number 3000<br \/>\nrule 5 permit ip source 192.168.1.0 0.0.0.255<br \/>\nrule 10 permit ip source 192.168.2.0 0.0.0.255<\/p>\n<p>! \u5b9a\u4e49\u8def\u7531\u7b56\u7565\uff08traffic classifier\uff09\u4ee5\u5339\u914d ACL<br \/>\ntraffic classifier PBR_CLASSIFIER<br \/>\nif-match acl 3000<\/p>\n<p>! \u5b9a\u4e49\u8def\u7531\u884c\u4e3a\uff08traffic behavior\uff09\u4ee5\u8bbe\u7f6e\u7b56\u7565\u8def\u7531\u89c4\u5219<br \/>\ntraffic behavior PBR_BEHAVIOR<br \/>\nredirect ip-nexthop 10.0.0.2<\/p>\n<p>! \u5b9a\u4e49\u8def\u7531\u7b56\u7565\uff08traffic policy\uff09\u4ee5\u5173\u8054\u7b56\u7565\u5206\u7c7b\u5668\u548c\u884c\u4e3a<br \/>\ntraffic policy PBR_POLICY<br \/>\nclassifier PBR_CLASSIFIER behavior PBR_BEHAVIOR<\/p>\n<p>! \u5c06\u8def\u7531\u7b56\u7565\u5e94\u7528\u5230\u8f93\u5165\u63a5\u53e3<br \/>\ninterface GigabitEthernet1\/0\/1<br \/>\ntraffic-policy PBR_POLICY inbound<\/p>\n<p>! \u914d\u7f6e\u5176\u4ed6\u6240\u9700\u63a5\u53e3\u548c\u8def\u7531<br \/>\ninterface GigabitEthernet1\/0\/2<br \/>\nip address 10.0.0.1 255.255.255.0<\/p>\n<p>interface GigabitEthernet1\/0\/3<br \/>\nip address 192.168.1.1 255.255.255.0<\/p>\n<p>interface GigabitEthernet1\/0\/4<br \/>\nip address 192.168.2.1 255.255.255.0<\/p>\n<p>ip route-static 0.0.0.0 0.0.0.0 10.0.0.2<br \/>\n\u5728\u6b64\u793a\u4f8b\u914d\u7f6e\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a\u7f16\u53f7\u4e3a 3000 \u7684\u8bbf\u95ee\u63a7\u5236\u5217\u8868\uff08ACL\uff09\uff0c\u7528\u4e8e\u5339\u914d\u6765\u81ea 192.168.1.0\/24 \u548c 192.168.2.0\/24 \u7f51\u7edc\u7684 IP \u6d41\u91cf\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3a PBR_CLASSIFIER \u7684\u8def\u7531\u7b56\u7565\uff0c\u5e76\u5c06\u5176\u4e0e\u5148\u524d\u5b9a\u4e49\u7684 ACL \u8fdb\u884c\u5173\u8054\u3002\u6211\u4eec\u8fd8\u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3a PBR_BEHAVIOR \u7684\u8def\u7531\u884c\u4e3a\uff0c\u5e76\u8bbe\u7f6e\u4e86\u4e0b\u4e00\u8df3 IP \u5730\u5740\u4e3a 10.0.0.2\uff0c\u4ee5\u4fbf\u5c06\u5339\u914d\u7684\u6d41\u91cf\u5bfc\u5411\u8be5\u7279\u5b9a\u8def\u7531\u3002<\/p>\n<p>\u7136\u540e\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3a PBR_POLICY \u7684\u8def\u7531\u7b56\u7565\uff0c\u5e76\u5c06\u5176\u4e0e PBR_CLASSIFIER \u548c PBR_BEHAVIOR \u8fdb\u884c\u5173\u8054\u3002\u6700\u540e\uff0c\u6211\u4eec\u5c06\u8def\u7531\u7b56\u7565\u5e94\u7528\u5230 GigabitEthernet1\/0\/1 \u63a5\u53e3\uff0c\u4ee5\u4fbf\u5728\u63a5\u6536\u5230\u6d41\u91cf\u65f6\u6267\u884c\u7b56\u7565\u8def\u7531\u3002\u6211\u4eec\u8fd8\u914d\u7f6e\u4e86\u5176\u4ed6\u63a5\u53e3\u548c\u9ed8\u8ba4\u8def\u7531\u4ee5\u5b8c\u6210\u6574\u4e2a\u793a\u4f8b\u914d\u7f6e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u534e\u4e09\u4ea4\u6362\u673a\uff08H3C\uff09\u7684\u7b56\u7565\u8def\u7531\uff08Policy-Based Routing, PBR\uff09\u5141\u8bb8\u60a8\u6839\u636e\u7279\u5b9a\u6761\u4ef6\uff08\u5982\u6e90  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,2],"tags":[],"class_list":["post-11828","post","type-post","status-publish","format-standard","hentry","category-19","category-network"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/11828","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11828"}],"version-history":[{"count":1,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/11828\/revisions"}],"predecessor-version":[{"id":11829,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/11828\/revisions\/11829"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}