How to permanently add a route in OS X?
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
add a comment |
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
@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
add a comment |
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
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
macos networking static-routes
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
add a comment |
@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
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Aug 4 '14 at 8:38
pabo
1366
1366
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Jan 23 '18 at 14:32
Maksim Luzik
19919
19919
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
@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