Reproducing a set of ip commands in netplan
![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
5
down vote
favorite
I recently upgraded to ubuntu 18.04 from 16.04 and am trying to figure out how to get my ip route
and ip rule
commands that I used to put in /etc/network/interfaces
working under netplan.
These are the commands that I'm trying to reproduce, that I previously ran in /etc/network/interfaces
:
sudo ip rule add table 129 from 192.168.1.160
sudo ip route add table 129 to 204.8.230.0/24 dev enp0s3
sudo ip route add table 129 to 192.168.1.0/24 dev enp0s3
sudo ip route add table 129 default via 192.168.1.1
This is my first pass at the netplan config in /etc/netplan/01-netcfg.yaml
:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routes:
- from: 192.168.1.160
to: 204.8.230.0/24
via: 192.168.1.1
- from: 192.168.1.160
to: 192.168.1.0/24
via: 192.168.1.1
However, after a restart those routes do not show up in the ip route
output. How do I get these routes to stick?
Note that I've also tried putting these commands in a script in /usr/lib/networkd-dispatcher/routable.d
based on some documentation I found, but that does not appear to have worked either.
EDIT: I'm getting closer. This is the new config, but now the problem is that although the table shows up in ip rule
, ip route show table 129
is empty:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
I'm on netplan version 0.36.1
18.04 routing netplan
add a comment |Â
up vote
5
down vote
favorite
I recently upgraded to ubuntu 18.04 from 16.04 and am trying to figure out how to get my ip route
and ip rule
commands that I used to put in /etc/network/interfaces
working under netplan.
These are the commands that I'm trying to reproduce, that I previously ran in /etc/network/interfaces
:
sudo ip rule add table 129 from 192.168.1.160
sudo ip route add table 129 to 204.8.230.0/24 dev enp0s3
sudo ip route add table 129 to 192.168.1.0/24 dev enp0s3
sudo ip route add table 129 default via 192.168.1.1
This is my first pass at the netplan config in /etc/netplan/01-netcfg.yaml
:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routes:
- from: 192.168.1.160
to: 204.8.230.0/24
via: 192.168.1.1
- from: 192.168.1.160
to: 192.168.1.0/24
via: 192.168.1.1
However, after a restart those routes do not show up in the ip route
output. How do I get these routes to stick?
Note that I've also tried putting these commands in a script in /usr/lib/networkd-dispatcher/routable.d
based on some documentation I found, but that does not appear to have worked either.
EDIT: I'm getting closer. This is the new config, but now the problem is that although the table shows up in ip rule
, ip route show table 129
is empty:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
I'm on netplan version 0.36.1
18.04 routing netplan
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I recently upgraded to ubuntu 18.04 from 16.04 and am trying to figure out how to get my ip route
and ip rule
commands that I used to put in /etc/network/interfaces
working under netplan.
These are the commands that I'm trying to reproduce, that I previously ran in /etc/network/interfaces
:
sudo ip rule add table 129 from 192.168.1.160
sudo ip route add table 129 to 204.8.230.0/24 dev enp0s3
sudo ip route add table 129 to 192.168.1.0/24 dev enp0s3
sudo ip route add table 129 default via 192.168.1.1
This is my first pass at the netplan config in /etc/netplan/01-netcfg.yaml
:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routes:
- from: 192.168.1.160
to: 204.8.230.0/24
via: 192.168.1.1
- from: 192.168.1.160
to: 192.168.1.0/24
via: 192.168.1.1
However, after a restart those routes do not show up in the ip route
output. How do I get these routes to stick?
Note that I've also tried putting these commands in a script in /usr/lib/networkd-dispatcher/routable.d
based on some documentation I found, but that does not appear to have worked either.
EDIT: I'm getting closer. This is the new config, but now the problem is that although the table shows up in ip rule
, ip route show table 129
is empty:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
I'm on netplan version 0.36.1
18.04 routing netplan
I recently upgraded to ubuntu 18.04 from 16.04 and am trying to figure out how to get my ip route
and ip rule
commands that I used to put in /etc/network/interfaces
working under netplan.
These are the commands that I'm trying to reproduce, that I previously ran in /etc/network/interfaces
:
sudo ip rule add table 129 from 192.168.1.160
sudo ip route add table 129 to 204.8.230.0/24 dev enp0s3
sudo ip route add table 129 to 192.168.1.0/24 dev enp0s3
sudo ip route add table 129 default via 192.168.1.1
This is my first pass at the netplan config in /etc/netplan/01-netcfg.yaml
:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routes:
- from: 192.168.1.160
to: 204.8.230.0/24
via: 192.168.1.1
- from: 192.168.1.160
to: 192.168.1.0/24
via: 192.168.1.1
However, after a restart those routes do not show up in the ip route
output. How do I get these routes to stick?
Note that I've also tried putting these commands in a script in /usr/lib/networkd-dispatcher/routable.d
based on some documentation I found, but that does not appear to have worked either.
EDIT: I'm getting closer. This is the new config, but now the problem is that although the table shows up in ip rule
, ip route show table 129
is empty:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
I'm on netplan version 0.36.1
18.04 routing netplan
edited May 10 at 15:32
asked May 10 at 14:25
basepi
1865
1865
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
6
down vote
I figured it out. The problem was that systemd-networkd was trying to set the routes before the network was up, which was failing. The fix is on-link: True
on the routes:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
on-link: True
Upvoted. Thanks for posting the answer as you will be helping many searchers.
â chili555
May 10 at 20:06
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
I figured it out. The problem was that systemd-networkd was trying to set the routes before the network was up, which was failing. The fix is on-link: True
on the routes:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
on-link: True
Upvoted. Thanks for posting the answer as you will be helping many searchers.
â chili555
May 10 at 20:06
add a comment |Â
up vote
6
down vote
I figured it out. The problem was that systemd-networkd was trying to set the routes before the network was up, which was failing. The fix is on-link: True
on the routes:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
on-link: True
Upvoted. Thanks for posting the answer as you will be helping many searchers.
â chili555
May 10 at 20:06
add a comment |Â
up vote
6
down vote
up vote
6
down vote
I figured it out. The problem was that systemd-networkd was trying to set the routes before the network was up, which was failing. The fix is on-link: True
on the routes:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
on-link: True
I figured it out. The problem was that systemd-networkd was trying to set the routes before the network was up, which was failing. The fix is on-link: True
on the routes:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
routing-policy:
- from: 192.168.1.160
table: 129
routes:
- to: 204.8.230.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 192.168.1.0/24
via: 192.168.1.1
table: 129
on-link: True
- to: 0.0.0.0/0
via: 192.168.1.1
table: 129
on-link: True
answered May 10 at 16:22
basepi
1865
1865
Upvoted. Thanks for posting the answer as you will be helping many searchers.
â chili555
May 10 at 20:06
add a comment |Â
Upvoted. Thanks for posting the answer as you will be helping many searchers.
â chili555
May 10 at 20:06
Upvoted. Thanks for posting the answer as you will be helping many searchers.
â chili555
May 10 at 20:06
Upvoted. Thanks for posting the answer as you will be helping many searchers.
â chili555
May 10 at 20:06
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%2f1034518%2freproducing-a-set-of-ip-commands-in-netplan%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