How to permanently add a route in OS X?












3














I have a Mac Pro and the problem is that it is not connecting to systems in other VLANs.
This can be temporarily archived by



sudo route -n add -net <IP>/mask  <Gateway>


However it vanishes in the next laptop restart. How can I add the route permanently?










share|improve this question
























  • @Jens Don't forget to fix titles, too.
    – slhck
    Jul 25 '14 at 8:56










  • Possible duplicate of apple.stackexchange.com/questions/307221/…
    – Jesse P.
    Sep 4 '18 at 3:01
















3














I have a Mac Pro and the problem is that it is not connecting to systems in other VLANs.
This can be temporarily archived by



sudo route -n add -net <IP>/mask  <Gateway>


However it vanishes in the next laptop restart. How can I add the route permanently?










share|improve this question
























  • @Jens Don't forget to fix titles, too.
    – slhck
    Jul 25 '14 at 8:56










  • Possible duplicate of apple.stackexchange.com/questions/307221/…
    – Jesse P.
    Sep 4 '18 at 3:01














3












3








3


2





I have a Mac Pro and the problem is that it is not connecting to systems in other VLANs.
This can be temporarily archived by



sudo route -n add -net <IP>/mask  <Gateway>


However it vanishes in the next laptop restart. How can I add the route permanently?










share|improve this question















I have a Mac Pro and the problem is that it is not connecting to systems in other VLANs.
This can be temporarily archived by



sudo route -n add -net <IP>/mask  <Gateway>


However it vanishes in the next laptop restart. How can I add the route permanently?







macos networking static-routes






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 25 '14 at 8:56









slhck

159k47442465




159k47442465










asked Jul 25 '14 at 8:28









Sri Ram

1612




1612












  • @Jens Don't forget to fix titles, too.
    – slhck
    Jul 25 '14 at 8:56










  • Possible duplicate of apple.stackexchange.com/questions/307221/…
    – Jesse P.
    Sep 4 '18 at 3:01


















  • @Jens Don't forget to fix titles, too.
    – slhck
    Jul 25 '14 at 8:56










  • Possible duplicate of apple.stackexchange.com/questions/307221/…
    – Jesse P.
    Sep 4 '18 at 3:01
















@Jens Don't forget to fix titles, too.
– slhck
Jul 25 '14 at 8:56




@Jens Don't forget to fix titles, too.
– slhck
Jul 25 '14 at 8:56












Possible duplicate of apple.stackexchange.com/questions/307221/…
– Jesse P.
Sep 4 '18 at 3:01




Possible duplicate of apple.stackexchange.com/questions/307221/…
– Jesse P.
Sep 4 '18 at 3:01










2 Answers
2






active

oldest

votes


















0














Found an article which suggests adding something like this



ifconfig en2 inet 11.22.33.5 netmask 255.255.255.252
route -n add 11.22.33.64/26 111.222.333.6


to /etc/rc.common. Apparently the preceding ifconfig line is necessary, though I don't know why.






share|improve this answer





























    0














    I myself didn't manage to make it work with the solution that pabo provided.
    I ended up running it in the crontab:



    env EDITOR=nano crontab -e



    add the script line:



    @reboot sh /path/to/your/script.sh



    make sure that if you need sudo rights, you would need to disable password for sudo use for your script. More info here:



    https://apple.stackexchange.com/questions/264663/shutdown-no-tty-present-and-no-askpass-program-specified



    Additionally, if you are using some build in commands in mac, like for example route you need to specify full path of the binary file. Here is example of script.sh file:



    sudo /sbin/route add 192.168.64.0/16 192.168.100.1






    share|improve this answer





















      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%2f787903%2fhow-to-permanently-add-a-route-in-os-x%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Found an article which suggests adding something like this



      ifconfig en2 inet 11.22.33.5 netmask 255.255.255.252
      route -n add 11.22.33.64/26 111.222.333.6


      to /etc/rc.common. Apparently the preceding ifconfig line is necessary, though I don't know why.






      share|improve this answer


























        0














        Found an article which suggests adding something like this



        ifconfig en2 inet 11.22.33.5 netmask 255.255.255.252
        route -n add 11.22.33.64/26 111.222.333.6


        to /etc/rc.common. Apparently the preceding ifconfig line is necessary, though I don't know why.






        share|improve this answer
























          0












          0








          0






          Found an article which suggests adding something like this



          ifconfig en2 inet 11.22.33.5 netmask 255.255.255.252
          route -n add 11.22.33.64/26 111.222.333.6


          to /etc/rc.common. Apparently the preceding ifconfig line is necessary, though I don't know why.






          share|improve this answer












          Found an article which suggests adding something like this



          ifconfig en2 inet 11.22.33.5 netmask 255.255.255.252
          route -n add 11.22.33.64/26 111.222.333.6


          to /etc/rc.common. Apparently the preceding ifconfig line is necessary, though I don't know why.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 4 '14 at 8:38









          pabo

          1366




          1366

























              0














              I myself didn't manage to make it work with the solution that pabo provided.
              I ended up running it in the crontab:



              env EDITOR=nano crontab -e



              add the script line:



              @reboot sh /path/to/your/script.sh



              make sure that if you need sudo rights, you would need to disable password for sudo use for your script. More info here:



              https://apple.stackexchange.com/questions/264663/shutdown-no-tty-present-and-no-askpass-program-specified



              Additionally, if you are using some build in commands in mac, like for example route you need to specify full path of the binary file. Here is example of script.sh file:



              sudo /sbin/route add 192.168.64.0/16 192.168.100.1






              share|improve this answer


























                0














                I myself didn't manage to make it work with the solution that pabo provided.
                I ended up running it in the crontab:



                env EDITOR=nano crontab -e



                add the script line:



                @reboot sh /path/to/your/script.sh



                make sure that if you need sudo rights, you would need to disable password for sudo use for your script. More info here:



                https://apple.stackexchange.com/questions/264663/shutdown-no-tty-present-and-no-askpass-program-specified



                Additionally, if you are using some build in commands in mac, like for example route you need to specify full path of the binary file. Here is example of script.sh file:



                sudo /sbin/route add 192.168.64.0/16 192.168.100.1






                share|improve this answer
























                  0












                  0








                  0






                  I myself didn't manage to make it work with the solution that pabo provided.
                  I ended up running it in the crontab:



                  env EDITOR=nano crontab -e



                  add the script line:



                  @reboot sh /path/to/your/script.sh



                  make sure that if you need sudo rights, you would need to disable password for sudo use for your script. More info here:



                  https://apple.stackexchange.com/questions/264663/shutdown-no-tty-present-and-no-askpass-program-specified



                  Additionally, if you are using some build in commands in mac, like for example route you need to specify full path of the binary file. Here is example of script.sh file:



                  sudo /sbin/route add 192.168.64.0/16 192.168.100.1






                  share|improve this answer












                  I myself didn't manage to make it work with the solution that pabo provided.
                  I ended up running it in the crontab:



                  env EDITOR=nano crontab -e



                  add the script line:



                  @reboot sh /path/to/your/script.sh



                  make sure that if you need sudo rights, you would need to disable password for sudo use for your script. More info here:



                  https://apple.stackexchange.com/questions/264663/shutdown-no-tty-present-and-no-askpass-program-specified



                  Additionally, if you are using some build in commands in mac, like for example route you need to specify full path of the binary file. Here is example of script.sh file:



                  sudo /sbin/route add 192.168.64.0/16 192.168.100.1







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 23 '18 at 14:32









                  Maksim Luzik

                  19919




                  19919






























                      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%2f787903%2fhow-to-permanently-add-a-route-in-os-x%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-я гвардейская общевойсковая армия

                      Алькесар