sysctl unable to apply settings on boot
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
3
down vote
favorite
I followed a tutorial similar to this https://www.niftiestsoftware.com/2011/08/28/making-all-network-traffic-for-a-linux-user-use-a-specific-network-interface/
And started noticing that after a reboot the sysctl system settings weren't applied anymore, specifically these settings from /etc/sysctl.d/999-vpn.conf
(also tried putting them in the 99-sysctl.conf
file):
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.enx002427fe2be7.rp_filter = 2
This is the error in my syslog:
systemd-sysctl[289]: Couldn't write '2' to 'net/ipv4/conf/enx002427fe2be7/rp_filter', ignoring: No such file or directory
enx002427fe2be7
is the network interface name from my USB Network adapter that I use, and I'm guessing that the reason this fails is maybe because it hasnt been initialized yet when the sysctl
command runs.
So to fix this I tried an upstart
script, but even with exec sleep 60 && sysctl --system
this didn't seem to work.
Manually running sysctl --system
fixes it, but I'd rather have this automated.
What would be a proper way to fix this?
Using Ubuntu 16.04 LTS Server edition
networking server
add a comment |Â
up vote
3
down vote
favorite
I followed a tutorial similar to this https://www.niftiestsoftware.com/2011/08/28/making-all-network-traffic-for-a-linux-user-use-a-specific-network-interface/
And started noticing that after a reboot the sysctl system settings weren't applied anymore, specifically these settings from /etc/sysctl.d/999-vpn.conf
(also tried putting them in the 99-sysctl.conf
file):
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.enx002427fe2be7.rp_filter = 2
This is the error in my syslog:
systemd-sysctl[289]: Couldn't write '2' to 'net/ipv4/conf/enx002427fe2be7/rp_filter', ignoring: No such file or directory
enx002427fe2be7
is the network interface name from my USB Network adapter that I use, and I'm guessing that the reason this fails is maybe because it hasnt been initialized yet when the sysctl
command runs.
So to fix this I tried an upstart
script, but even with exec sleep 60 && sysctl --system
this didn't seem to work.
Manually running sysctl --system
fixes it, but I'd rather have this automated.
What would be a proper way to fix this?
Using Ubuntu 16.04 LTS Server edition
networking server
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I followed a tutorial similar to this https://www.niftiestsoftware.com/2011/08/28/making-all-network-traffic-for-a-linux-user-use-a-specific-network-interface/
And started noticing that after a reboot the sysctl system settings weren't applied anymore, specifically these settings from /etc/sysctl.d/999-vpn.conf
(also tried putting them in the 99-sysctl.conf
file):
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.enx002427fe2be7.rp_filter = 2
This is the error in my syslog:
systemd-sysctl[289]: Couldn't write '2' to 'net/ipv4/conf/enx002427fe2be7/rp_filter', ignoring: No such file or directory
enx002427fe2be7
is the network interface name from my USB Network adapter that I use, and I'm guessing that the reason this fails is maybe because it hasnt been initialized yet when the sysctl
command runs.
So to fix this I tried an upstart
script, but even with exec sleep 60 && sysctl --system
this didn't seem to work.
Manually running sysctl --system
fixes it, but I'd rather have this automated.
What would be a proper way to fix this?
Using Ubuntu 16.04 LTS Server edition
networking server
I followed a tutorial similar to this https://www.niftiestsoftware.com/2011/08/28/making-all-network-traffic-for-a-linux-user-use-a-specific-network-interface/
And started noticing that after a reboot the sysctl system settings weren't applied anymore, specifically these settings from /etc/sysctl.d/999-vpn.conf
(also tried putting them in the 99-sysctl.conf
file):
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.enx002427fe2be7.rp_filter = 2
This is the error in my syslog:
systemd-sysctl[289]: Couldn't write '2' to 'net/ipv4/conf/enx002427fe2be7/rp_filter', ignoring: No such file or directory
enx002427fe2be7
is the network interface name from my USB Network adapter that I use, and I'm guessing that the reason this fails is maybe because it hasnt been initialized yet when the sysctl
command runs.
So to fix this I tried an upstart
script, but even with exec sleep 60 && sysctl --system
this didn't seem to work.
Manually running sysctl --system
fixes it, but I'd rather have this automated.
What would be a proper way to fix this?
Using Ubuntu 16.04 LTS Server edition
networking server
asked May 20 at 18:42
![](https://i.stack.imgur.com/EVKXr.jpg?s=32&g=1)
![](https://i.stack.imgur.com/EVKXr.jpg?s=32&g=1)
xorinzor
739
739
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
A few things come to my mind:
- ubuntu 16.04 uses
systemd
by default instead ofupstart
. So you could try to write asystemd
unit instead of anupstart
script If you use
/etc/network/interfaces
to manage your network, you could add a line like the following to your interface:up sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
and remove the corresponding line from your
/etc/sysctl.d/999-vpn.conf
file.If you use
NetworkManager
there is/etc/NetworkManager/dispatcher.d/
where you can put scripts to execute after a connection is made. Of course in your script you should check that the interface that is brought up is actually your USB adapter.if [ "$1" == 'enx002427fe2be7' ] && [ "$2" == 'up' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiAlternatively you could put that script in
/etc/network/if-up.d/
. This should work for both,ifupdown
andNetworkManager
. (Source: https://askubuntu.com/a/14139/726877). In that case you don't need theup
line in/etc/network/interfaces
.if [ "$IFACE" == 'enx002427fe2be7' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiThese are just different ways to do the same thing: add the
sysctl
setting for the network adapter when the network adapter is brought up and therefore available but no sooner.
Thanks! very detailed and informative answer, it worked perfectly as well. I'll award the bounty when the site lets me
â xorinzor
May 24 at 10:25
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
A few things come to my mind:
- ubuntu 16.04 uses
systemd
by default instead ofupstart
. So you could try to write asystemd
unit instead of anupstart
script If you use
/etc/network/interfaces
to manage your network, you could add a line like the following to your interface:up sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
and remove the corresponding line from your
/etc/sysctl.d/999-vpn.conf
file.If you use
NetworkManager
there is/etc/NetworkManager/dispatcher.d/
where you can put scripts to execute after a connection is made. Of course in your script you should check that the interface that is brought up is actually your USB adapter.if [ "$1" == 'enx002427fe2be7' ] && [ "$2" == 'up' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiAlternatively you could put that script in
/etc/network/if-up.d/
. This should work for both,ifupdown
andNetworkManager
. (Source: https://askubuntu.com/a/14139/726877). In that case you don't need theup
line in/etc/network/interfaces
.if [ "$IFACE" == 'enx002427fe2be7' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiThese are just different ways to do the same thing: add the
sysctl
setting for the network adapter when the network adapter is brought up and therefore available but no sooner.
Thanks! very detailed and informative answer, it worked perfectly as well. I'll award the bounty when the site lets me
â xorinzor
May 24 at 10:25
add a comment |Â
up vote
3
down vote
accepted
A few things come to my mind:
- ubuntu 16.04 uses
systemd
by default instead ofupstart
. So you could try to write asystemd
unit instead of anupstart
script If you use
/etc/network/interfaces
to manage your network, you could add a line like the following to your interface:up sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
and remove the corresponding line from your
/etc/sysctl.d/999-vpn.conf
file.If you use
NetworkManager
there is/etc/NetworkManager/dispatcher.d/
where you can put scripts to execute after a connection is made. Of course in your script you should check that the interface that is brought up is actually your USB adapter.if [ "$1" == 'enx002427fe2be7' ] && [ "$2" == 'up' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiAlternatively you could put that script in
/etc/network/if-up.d/
. This should work for both,ifupdown
andNetworkManager
. (Source: https://askubuntu.com/a/14139/726877). In that case you don't need theup
line in/etc/network/interfaces
.if [ "$IFACE" == 'enx002427fe2be7' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiThese are just different ways to do the same thing: add the
sysctl
setting for the network adapter when the network adapter is brought up and therefore available but no sooner.
Thanks! very detailed and informative answer, it worked perfectly as well. I'll award the bounty when the site lets me
â xorinzor
May 24 at 10:25
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
A few things come to my mind:
- ubuntu 16.04 uses
systemd
by default instead ofupstart
. So you could try to write asystemd
unit instead of anupstart
script If you use
/etc/network/interfaces
to manage your network, you could add a line like the following to your interface:up sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
and remove the corresponding line from your
/etc/sysctl.d/999-vpn.conf
file.If you use
NetworkManager
there is/etc/NetworkManager/dispatcher.d/
where you can put scripts to execute after a connection is made. Of course in your script you should check that the interface that is brought up is actually your USB adapter.if [ "$1" == 'enx002427fe2be7' ] && [ "$2" == 'up' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiAlternatively you could put that script in
/etc/network/if-up.d/
. This should work for both,ifupdown
andNetworkManager
. (Source: https://askubuntu.com/a/14139/726877). In that case you don't need theup
line in/etc/network/interfaces
.if [ "$IFACE" == 'enx002427fe2be7' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiThese are just different ways to do the same thing: add the
sysctl
setting for the network adapter when the network adapter is brought up and therefore available but no sooner.
A few things come to my mind:
- ubuntu 16.04 uses
systemd
by default instead ofupstart
. So you could try to write asystemd
unit instead of anupstart
script If you use
/etc/network/interfaces
to manage your network, you could add a line like the following to your interface:up sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
and remove the corresponding line from your
/etc/sysctl.d/999-vpn.conf
file.If you use
NetworkManager
there is/etc/NetworkManager/dispatcher.d/
where you can put scripts to execute after a connection is made. Of course in your script you should check that the interface that is brought up is actually your USB adapter.if [ "$1" == 'enx002427fe2be7' ] && [ "$2" == 'up' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiAlternatively you could put that script in
/etc/network/if-up.d/
. This should work for both,ifupdown
andNetworkManager
. (Source: https://askubuntu.com/a/14139/726877). In that case you don't need theup
line in/etc/network/interfaces
.if [ "$IFACE" == 'enx002427fe2be7' ] ; then
sysctl net.ipv4.conf.enx002427fe2be7.rp_filter=2
fiThese are just different ways to do the same thing: add the
sysctl
setting for the network adapter when the network adapter is brought up and therefore available but no sooner.
answered May 23 at 22:55
![](https://i.stack.imgur.com/k9JBf.jpg?s=32&g=1)
![](https://i.stack.imgur.com/k9JBf.jpg?s=32&g=1)
Lienhart Woitok
808211
808211
Thanks! very detailed and informative answer, it worked perfectly as well. I'll award the bounty when the site lets me
â xorinzor
May 24 at 10:25
add a comment |Â
Thanks! very detailed and informative answer, it worked perfectly as well. I'll award the bounty when the site lets me
â xorinzor
May 24 at 10:25
Thanks! very detailed and informative answer, it worked perfectly as well. I'll award the bounty when the site lets me
â xorinzor
May 24 at 10:25
Thanks! very detailed and informative answer, it worked perfectly as well. I'll award the bounty when the site lets me
â xorinzor
May 24 at 10:25
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1038460%2fsysctl-unable-to-apply-settings-on-boot%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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