Persist ip route and ip rule configurations for Policy Based Routing (iproute2)
Currently running on Fedora Server 23, I've been searching for the right way to persist commands such as:
ip route add default via 10.0.2.1 dev ens32 table EXAMPLE_TABLE
ip rule add from 10.1.2.50 lookup EXAMPLE_TABLE prio 1000
either through nmcli (ideally) or through some other, similarly, sane way.
I've seen examples like lodging it on the route-ifname file but that don't seem to execute the default rule correctly.
If you run ip route show table EXAMPLE_TABLE
after a reboot you'll realize it doesn't stick - at least in my experience.
Any insights into this would be lovely, thank you.
centos fedora networkmanager iproute nmcli
add a comment |
Currently running on Fedora Server 23, I've been searching for the right way to persist commands such as:
ip route add default via 10.0.2.1 dev ens32 table EXAMPLE_TABLE
ip rule add from 10.1.2.50 lookup EXAMPLE_TABLE prio 1000
either through nmcli (ideally) or through some other, similarly, sane way.
I've seen examples like lodging it on the route-ifname file but that don't seem to execute the default rule correctly.
If you run ip route show table EXAMPLE_TABLE
after a reboot you'll realize it doesn't stick - at least in my experience.
Any insights into this would be lovely, thank you.
centos fedora networkmanager iproute nmcli
My recollection is that every line inroute-(device)
will generate aip route add (contents of line here)
and every line inrule-(device)
will generate aip rule add (contents of line here)
, but it's possible that NetworkManager has different ideas.
– Ulrich Schwarz
Dec 7 '15 at 20:36
Sadly the route-(device) file seems to completely ignore the table parameter. :(
– Canha
Dec 7 '15 at 21:14
add a comment |
Currently running on Fedora Server 23, I've been searching for the right way to persist commands such as:
ip route add default via 10.0.2.1 dev ens32 table EXAMPLE_TABLE
ip rule add from 10.1.2.50 lookup EXAMPLE_TABLE prio 1000
either through nmcli (ideally) or through some other, similarly, sane way.
I've seen examples like lodging it on the route-ifname file but that don't seem to execute the default rule correctly.
If you run ip route show table EXAMPLE_TABLE
after a reboot you'll realize it doesn't stick - at least in my experience.
Any insights into this would be lovely, thank you.
centos fedora networkmanager iproute nmcli
Currently running on Fedora Server 23, I've been searching for the right way to persist commands such as:
ip route add default via 10.0.2.1 dev ens32 table EXAMPLE_TABLE
ip rule add from 10.1.2.50 lookup EXAMPLE_TABLE prio 1000
either through nmcli (ideally) or through some other, similarly, sane way.
I've seen examples like lodging it on the route-ifname file but that don't seem to execute the default rule correctly.
If you run ip route show table EXAMPLE_TABLE
after a reboot you'll realize it doesn't stick - at least in my experience.
Any insights into this would be lovely, thank you.
centos fedora networkmanager iproute nmcli
centos fedora networkmanager iproute nmcli
edited Dec 7 '15 at 23:08
Canha
asked Dec 7 '15 at 19:05
CanhaCanha
1267
1267
My recollection is that every line inroute-(device)
will generate aip route add (contents of line here)
and every line inrule-(device)
will generate aip rule add (contents of line here)
, but it's possible that NetworkManager has different ideas.
– Ulrich Schwarz
Dec 7 '15 at 20:36
Sadly the route-(device) file seems to completely ignore the table parameter. :(
– Canha
Dec 7 '15 at 21:14
add a comment |
My recollection is that every line inroute-(device)
will generate aip route add (contents of line here)
and every line inrule-(device)
will generate aip rule add (contents of line here)
, but it's possible that NetworkManager has different ideas.
– Ulrich Schwarz
Dec 7 '15 at 20:36
Sadly the route-(device) file seems to completely ignore the table parameter. :(
– Canha
Dec 7 '15 at 21:14
My recollection is that every line in
route-(device)
will generate a ip route add (contents of line here)
and every line in rule-(device)
will generate a ip rule add (contents of line here)
, but it's possible that NetworkManager has different ideas.– Ulrich Schwarz
Dec 7 '15 at 20:36
My recollection is that every line in
route-(device)
will generate a ip route add (contents of line here)
and every line in rule-(device)
will generate a ip rule add (contents of line here)
, but it's possible that NetworkManager has different ideas.– Ulrich Schwarz
Dec 7 '15 at 20:36
Sadly the route-(device) file seems to completely ignore the table parameter. :(
– Canha
Dec 7 '15 at 21:14
Sadly the route-(device) file seems to completely ignore the table parameter. :(
– Canha
Dec 7 '15 at 21:14
add a comment |
1 Answer
1
active
oldest
votes
The easiest way I know of to persist the default route is to add the default route destination to the /etc/sysconfig/network-scripts/ifcfg-<device>
file as the value for GATEWAY. This creates that default route every time that interface is brought up, the other routes are persisted through the route-<device>
files in the same directory.
Unfortunately this doesn't work if you are using policy based routing...
– Canha
Dec 7 '15 at 22:33
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f247977%2fpersist-ip-route-and-ip-rule-configurations-for-policy-based-routing-iproute2%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
The easiest way I know of to persist the default route is to add the default route destination to the /etc/sysconfig/network-scripts/ifcfg-<device>
file as the value for GATEWAY. This creates that default route every time that interface is brought up, the other routes are persisted through the route-<device>
files in the same directory.
Unfortunately this doesn't work if you are using policy based routing...
– Canha
Dec 7 '15 at 22:33
add a comment |
The easiest way I know of to persist the default route is to add the default route destination to the /etc/sysconfig/network-scripts/ifcfg-<device>
file as the value for GATEWAY. This creates that default route every time that interface is brought up, the other routes are persisted through the route-<device>
files in the same directory.
Unfortunately this doesn't work if you are using policy based routing...
– Canha
Dec 7 '15 at 22:33
add a comment |
The easiest way I know of to persist the default route is to add the default route destination to the /etc/sysconfig/network-scripts/ifcfg-<device>
file as the value for GATEWAY. This creates that default route every time that interface is brought up, the other routes are persisted through the route-<device>
files in the same directory.
The easiest way I know of to persist the default route is to add the default route destination to the /etc/sysconfig/network-scripts/ifcfg-<device>
file as the value for GATEWAY. This creates that default route every time that interface is brought up, the other routes are persisted through the route-<device>
files in the same directory.
answered Dec 7 '15 at 19:08
JohnJohn
11.6k11931
11.6k11931
Unfortunately this doesn't work if you are using policy based routing...
– Canha
Dec 7 '15 at 22:33
add a comment |
Unfortunately this doesn't work if you are using policy based routing...
– Canha
Dec 7 '15 at 22:33
Unfortunately this doesn't work if you are using policy based routing...
– Canha
Dec 7 '15 at 22:33
Unfortunately this doesn't work if you are using policy based routing...
– Canha
Dec 7 '15 at 22:33
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f247977%2fpersist-ip-route-and-ip-rule-configurations-for-policy-based-routing-iproute2%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
My recollection is that every line in
route-(device)
will generate aip route add (contents of line here)
and every line inrule-(device)
will generate aip rule add (contents of line here)
, but it's possible that NetworkManager has different ideas.– Ulrich Schwarz
Dec 7 '15 at 20:36
Sadly the route-(device) file seems to completely ignore the table parameter. :(
– Canha
Dec 7 '15 at 21:14