Significance of priority in “ip rule” command












1














What is the significance of the prio option in ip rule add/del command? Does a higher priority for a rule give it preference over other rules in the table?



I saw this piece of code online, without any comments to it. I'm curious to know what it does:



ip rule del prio 32766 from "" dev "" fwmark 0 table main

ip rule del prio 32767 from "" dev "" fwmark 0 table default

ip rule add prio 4294967293UL from "" dev "" fwmark 0 table 1

ip rule add prio 4294967294UL from "" dev "" fwmark 0 table main

ip rule add prio 4294967295UL from "" dev "" fwmark 0 table default









share|improve this question













migrated from stackoverflow.com Nov 21 '11 at 19:38


This question came from our site for professional and enthusiast programmers.




















    1














    What is the significance of the prio option in ip rule add/del command? Does a higher priority for a rule give it preference over other rules in the table?



    I saw this piece of code online, without any comments to it. I'm curious to know what it does:



    ip rule del prio 32766 from "" dev "" fwmark 0 table main

    ip rule del prio 32767 from "" dev "" fwmark 0 table default

    ip rule add prio 4294967293UL from "" dev "" fwmark 0 table 1

    ip rule add prio 4294967294UL from "" dev "" fwmark 0 table main

    ip rule add prio 4294967295UL from "" dev "" fwmark 0 table default









    share|improve this question













    migrated from stackoverflow.com Nov 21 '11 at 19:38


    This question came from our site for professional and enthusiast programmers.


















      1












      1








      1







      What is the significance of the prio option in ip rule add/del command? Does a higher priority for a rule give it preference over other rules in the table?



      I saw this piece of code online, without any comments to it. I'm curious to know what it does:



      ip rule del prio 32766 from "" dev "" fwmark 0 table main

      ip rule del prio 32767 from "" dev "" fwmark 0 table default

      ip rule add prio 4294967293UL from "" dev "" fwmark 0 table 1

      ip rule add prio 4294967294UL from "" dev "" fwmark 0 table main

      ip rule add prio 4294967295UL from "" dev "" fwmark 0 table default









      share|improve this question













      What is the significance of the prio option in ip rule add/del command? Does a higher priority for a rule give it preference over other rules in the table?



      I saw this piece of code online, without any comments to it. I'm curious to know what it does:



      ip rule del prio 32766 from "" dev "" fwmark 0 table main

      ip rule del prio 32767 from "" dev "" fwmark 0 table default

      ip rule add prio 4294967293UL from "" dev "" fwmark 0 table 1

      ip rule add prio 4294967294UL from "" dev "" fwmark 0 table main

      ip rule add prio 4294967295UL from "" dev "" fwmark 0 table default






      linux networking ip






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '11 at 14:01







      user983356











      migrated from stackoverflow.com Nov 21 '11 at 19:38


      This question came from our site for professional and enthusiast programmers.






      migrated from stackoverflow.com Nov 21 '11 at 19:38


      This question came from our site for professional and enthusiast programmers.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          The priority determines the order in which the rules are checked (from lowest number to highest). The first rule which matches the packet is used.



          The maximum priority is 32767 though, so those big priority numbers don't make sense.






          share|improve this answer

















          • 4




            "The first rule which matches the packet is used." this is not completely correct. The rules are in fact checked in the order specified by priority, but a rule which has its conditions satisfied may in fact not provide a result, and more rules are checked. The prime example of this is when a rule specifies a "lookup" (or "table"), but there is no route in that routing table matching the destination.
            – Ambroz Bizjak
            Apr 27 '12 at 21:05











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f359923%2fsignificance-of-priority-in-ip-rule-command%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown
























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The priority determines the order in which the rules are checked (from lowest number to highest). The first rule which matches the packet is used.



          The maximum priority is 32767 though, so those big priority numbers don't make sense.






          share|improve this answer

















          • 4




            "The first rule which matches the packet is used." this is not completely correct. The rules are in fact checked in the order specified by priority, but a rule which has its conditions satisfied may in fact not provide a result, and more rules are checked. The prime example of this is when a rule specifies a "lookup" (or "table"), but there is no route in that routing table matching the destination.
            – Ambroz Bizjak
            Apr 27 '12 at 21:05
















          0














          The priority determines the order in which the rules are checked (from lowest number to highest). The first rule which matches the packet is used.



          The maximum priority is 32767 though, so those big priority numbers don't make sense.






          share|improve this answer

















          • 4




            "The first rule which matches the packet is used." this is not completely correct. The rules are in fact checked in the order specified by priority, but a rule which has its conditions satisfied may in fact not provide a result, and more rules are checked. The prime example of this is when a rule specifies a "lookup" (or "table"), but there is no route in that routing table matching the destination.
            – Ambroz Bizjak
            Apr 27 '12 at 21:05














          0












          0








          0






          The priority determines the order in which the rules are checked (from lowest number to highest). The first rule which matches the packet is used.



          The maximum priority is 32767 though, so those big priority numbers don't make sense.






          share|improve this answer












          The priority determines the order in which the rules are checked (from lowest number to highest). The first rule which matches the packet is used.



          The maximum priority is 32767 though, so those big priority numbers don't make sense.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 27 '12 at 18:51









          mgorven

          2,32911623




          2,32911623








          • 4




            "The first rule which matches the packet is used." this is not completely correct. The rules are in fact checked in the order specified by priority, but a rule which has its conditions satisfied may in fact not provide a result, and more rules are checked. The prime example of this is when a rule specifies a "lookup" (or "table"), but there is no route in that routing table matching the destination.
            – Ambroz Bizjak
            Apr 27 '12 at 21:05














          • 4




            "The first rule which matches the packet is used." this is not completely correct. The rules are in fact checked in the order specified by priority, but a rule which has its conditions satisfied may in fact not provide a result, and more rules are checked. The prime example of this is when a rule specifies a "lookup" (or "table"), but there is no route in that routing table matching the destination.
            – Ambroz Bizjak
            Apr 27 '12 at 21:05








          4




          4




          "The first rule which matches the packet is used." this is not completely correct. The rules are in fact checked in the order specified by priority, but a rule which has its conditions satisfied may in fact not provide a result, and more rules are checked. The prime example of this is when a rule specifies a "lookup" (or "table"), but there is no route in that routing table matching the destination.
          – Ambroz Bizjak
          Apr 27 '12 at 21:05




          "The first rule which matches the packet is used." this is not completely correct. The rules are in fact checked in the order specified by priority, but a rule which has its conditions satisfied may in fact not provide a result, and more rules are checked. The prime example of this is when a rule specifies a "lookup" (or "table"), but there is no route in that routing table matching the destination.
          – Ambroz Bizjak
          Apr 27 '12 at 21:05


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f359923%2fsignificance-of-priority-in-ip-rule-command%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Сан-Квентин

          8-я гвардейская общевойсковая армия

          Алькесар