How can I make changes to the network routing metric permanently
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
I'm able change my network routing metrics with ifmetric
, for example ifmetric enp0s3 1
.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 1 0 0 enp0s3
0.0.0.0 192.168.237.1 0.0.0.0 UG 100 0 0 enp0s8
When I reboot though, the metric for enp0s3 reverts to 101. How can I make this change permanent or have it set automatically at boot time?
ubuntu networking routing network-interface
add a comment |Â
up vote
5
down vote
favorite
I'm able change my network routing metrics with ifmetric
, for example ifmetric enp0s3 1
.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 1 0 0 enp0s3
0.0.0.0 192.168.237.1 0.0.0.0 UG 100 0 0 enp0s8
When I reboot though, the metric for enp0s3 reverts to 101. How can I make this change permanent or have it set automatically at boot time?
ubuntu networking routing network-interface
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I'm able change my network routing metrics with ifmetric
, for example ifmetric enp0s3 1
.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 1 0 0 enp0s3
0.0.0.0 192.168.237.1 0.0.0.0 UG 100 0 0 enp0s8
When I reboot though, the metric for enp0s3 reverts to 101. How can I make this change permanent or have it set automatically at boot time?
ubuntu networking routing network-interface
I'm able change my network routing metrics with ifmetric
, for example ifmetric enp0s3 1
.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 1 0 0 enp0s3
0.0.0.0 192.168.237.1 0.0.0.0 UG 100 0 0 enp0s8
When I reboot though, the metric for enp0s3 reverts to 101. How can I make this change permanent or have it set automatically at boot time?
ubuntu networking routing network-interface
edited Feb 14 '17 at 17:32
Rui F Ribeiro
34.1k1268113
34.1k1268113
asked Feb 14 '17 at 17:19
marathon
269315
269315
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
4
down vote
If you are using NetworkManager, the proper way to change the metric for the default route is to modify the connection associated with interface enp0s3 in this way:
nmcli connection modify <connection-name> ipv4.route-metric 1
and then re-activate the connection:
nmcli connection up <connection-name>
You can find the value for <connection-name>
in the output of nmcli connection
.
add a comment |Â
up vote
3
down vote
The correct way to do this, in Debian and derivatives, is to write a file in /etc/NetworkManager/dispatcher.d (call it whatever you like), with the following content:
#!/bin/sh
# Change the metric of the default route only on interface enp0s3
IF=$1
STATUS=$2
MY_METRIC=1
if [ "$IF" = "enp0s3" ]
then
case "$STATUS" in
up)
ip route del default dev $IF
ip route add default via $DHCP4_ROUTERS dev $IF metric $MY_METRIC
;;
*)
;;
esac
fi
This way, your customization will not be overwritten upon each update.
In order to check this, stop the Network Manager, kill the dhclient and flush the IP address of the interface, then restart network manager.
You can find documentation here.
add a comment |Â
up vote
1
down vote
You should be able to make it permanent in /etc/dhcpd.conf
where you can set an interface metric like this.
interface enp0s3;
metric 1;
Um, I don't think so. What is the os? Also try and see if this exists/etc/conf.d/dhcpcd
â Pythonic
Feb 14 '17 at 17:58
tried creating this file with your settings - it did not work. Ubuntu 16.10. Thanks though.
â marathon
Feb 15 '17 at 4:24
didn't work with me either
â Guerlando OCs
Jul 4 at 17:52
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
If you are using NetworkManager, the proper way to change the metric for the default route is to modify the connection associated with interface enp0s3 in this way:
nmcli connection modify <connection-name> ipv4.route-metric 1
and then re-activate the connection:
nmcli connection up <connection-name>
You can find the value for <connection-name>
in the output of nmcli connection
.
add a comment |Â
up vote
4
down vote
If you are using NetworkManager, the proper way to change the metric for the default route is to modify the connection associated with interface enp0s3 in this way:
nmcli connection modify <connection-name> ipv4.route-metric 1
and then re-activate the connection:
nmcli connection up <connection-name>
You can find the value for <connection-name>
in the output of nmcli connection
.
add a comment |Â
up vote
4
down vote
up vote
4
down vote
If you are using NetworkManager, the proper way to change the metric for the default route is to modify the connection associated with interface enp0s3 in this way:
nmcli connection modify <connection-name> ipv4.route-metric 1
and then re-activate the connection:
nmcli connection up <connection-name>
You can find the value for <connection-name>
in the output of nmcli connection
.
If you are using NetworkManager, the proper way to change the metric for the default route is to modify the connection associated with interface enp0s3 in this way:
nmcli connection modify <connection-name> ipv4.route-metric 1
and then re-activate the connection:
nmcli connection up <connection-name>
You can find the value for <connection-name>
in the output of nmcli connection
.
answered Mar 5 '17 at 22:17
bengal
712
712
add a comment |Â
add a comment |Â
up vote
3
down vote
The correct way to do this, in Debian and derivatives, is to write a file in /etc/NetworkManager/dispatcher.d (call it whatever you like), with the following content:
#!/bin/sh
# Change the metric of the default route only on interface enp0s3
IF=$1
STATUS=$2
MY_METRIC=1
if [ "$IF" = "enp0s3" ]
then
case "$STATUS" in
up)
ip route del default dev $IF
ip route add default via $DHCP4_ROUTERS dev $IF metric $MY_METRIC
;;
*)
;;
esac
fi
This way, your customization will not be overwritten upon each update.
In order to check this, stop the Network Manager, kill the dhclient and flush the IP address of the interface, then restart network manager.
You can find documentation here.
add a comment |Â
up vote
3
down vote
The correct way to do this, in Debian and derivatives, is to write a file in /etc/NetworkManager/dispatcher.d (call it whatever you like), with the following content:
#!/bin/sh
# Change the metric of the default route only on interface enp0s3
IF=$1
STATUS=$2
MY_METRIC=1
if [ "$IF" = "enp0s3" ]
then
case "$STATUS" in
up)
ip route del default dev $IF
ip route add default via $DHCP4_ROUTERS dev $IF metric $MY_METRIC
;;
*)
;;
esac
fi
This way, your customization will not be overwritten upon each update.
In order to check this, stop the Network Manager, kill the dhclient and flush the IP address of the interface, then restart network manager.
You can find documentation here.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
The correct way to do this, in Debian and derivatives, is to write a file in /etc/NetworkManager/dispatcher.d (call it whatever you like), with the following content:
#!/bin/sh
# Change the metric of the default route only on interface enp0s3
IF=$1
STATUS=$2
MY_METRIC=1
if [ "$IF" = "enp0s3" ]
then
case "$STATUS" in
up)
ip route del default dev $IF
ip route add default via $DHCP4_ROUTERS dev $IF metric $MY_METRIC
;;
*)
;;
esac
fi
This way, your customization will not be overwritten upon each update.
In order to check this, stop the Network Manager, kill the dhclient and flush the IP address of the interface, then restart network manager.
You can find documentation here.
The correct way to do this, in Debian and derivatives, is to write a file in /etc/NetworkManager/dispatcher.d (call it whatever you like), with the following content:
#!/bin/sh
# Change the metric of the default route only on interface enp0s3
IF=$1
STATUS=$2
MY_METRIC=1
if [ "$IF" = "enp0s3" ]
then
case "$STATUS" in
up)
ip route del default dev $IF
ip route add default via $DHCP4_ROUTERS dev $IF metric $MY_METRIC
;;
*)
;;
esac
fi
This way, your customization will not be overwritten upon each update.
In order to check this, stop the Network Manager, kill the dhclient and flush the IP address of the interface, then restart network manager.
You can find documentation here.
edited Feb 15 '17 at 5:37
answered Feb 14 '17 at 23:12
MariusMatutiae
3,22911122
3,22911122
add a comment |Â
add a comment |Â
up vote
1
down vote
You should be able to make it permanent in /etc/dhcpd.conf
where you can set an interface metric like this.
interface enp0s3;
metric 1;
Um, I don't think so. What is the os? Also try and see if this exists/etc/conf.d/dhcpcd
â Pythonic
Feb 14 '17 at 17:58
tried creating this file with your settings - it did not work. Ubuntu 16.10. Thanks though.
â marathon
Feb 15 '17 at 4:24
didn't work with me either
â Guerlando OCs
Jul 4 at 17:52
add a comment |Â
up vote
1
down vote
You should be able to make it permanent in /etc/dhcpd.conf
where you can set an interface metric like this.
interface enp0s3;
metric 1;
Um, I don't think so. What is the os? Also try and see if this exists/etc/conf.d/dhcpcd
â Pythonic
Feb 14 '17 at 17:58
tried creating this file with your settings - it did not work. Ubuntu 16.10. Thanks though.
â marathon
Feb 15 '17 at 4:24
didn't work with me either
â Guerlando OCs
Jul 4 at 17:52
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You should be able to make it permanent in /etc/dhcpd.conf
where you can set an interface metric like this.
interface enp0s3;
metric 1;
You should be able to make it permanent in /etc/dhcpd.conf
where you can set an interface metric like this.
interface enp0s3;
metric 1;
answered Feb 14 '17 at 17:39
Pythonic
379313
379313
Um, I don't think so. What is the os? Also try and see if this exists/etc/conf.d/dhcpcd
â Pythonic
Feb 14 '17 at 17:58
tried creating this file with your settings - it did not work. Ubuntu 16.10. Thanks though.
â marathon
Feb 15 '17 at 4:24
didn't work with me either
â Guerlando OCs
Jul 4 at 17:52
add a comment |Â
Um, I don't think so. What is the os? Also try and see if this exists/etc/conf.d/dhcpcd
â Pythonic
Feb 14 '17 at 17:58
tried creating this file with your settings - it did not work. Ubuntu 16.10. Thanks though.
â marathon
Feb 15 '17 at 4:24
didn't work with me either
â Guerlando OCs
Jul 4 at 17:52
Um, I don't think so. What is the os? Also try and see if this exists
/etc/conf.d/dhcpcd
â Pythonic
Feb 14 '17 at 17:58
Um, I don't think so. What is the os? Also try and see if this exists
/etc/conf.d/dhcpcd
â Pythonic
Feb 14 '17 at 17:58
tried creating this file with your settings - it did not work. Ubuntu 16.10. Thanks though.
â marathon
Feb 15 '17 at 4:24
tried creating this file with your settings - it did not work. Ubuntu 16.10. Thanks though.
â marathon
Feb 15 '17 at 4:24
didn't work with me either
â Guerlando OCs
Jul 4 at 17:52
didn't work with me either
â Guerlando OCs
Jul 4 at 17:52
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f344974%2fhow-can-i-make-changes-to-the-network-routing-metric-permanently%23new-answer', 'question_page');
);
Post as a guest
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
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
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