Is there a way to try out a netplan configuration without altering the system?


up vote
2
down vote
favorite
I work on remote servers, and its a painfull process to go into Rescue Mode everytime I screw something up when it comes to network configuraitons.
Are there a way to implement something like:
Netplan apply /customscript.yaml
That I can use when I troubleshoot network configurations.
So the server gets its "defaults" if I do a cold reboot.
boot networking netplan
 |Â
show 1 more comment
up vote
2
down vote
favorite
I work on remote servers, and its a painfull process to go into Rescue Mode everytime I screw something up when it comes to network configuraitons.
Are there a way to implement something like:
Netplan apply /customscript.yaml
That I can use when I troubleshoot network configurations.
So the server gets its "defaults" if I do a cold reboot.
boot networking netplan
Are you trying to restore the default .yaml file and then netplan apply? Can you save the default as default.yaml.bak and then:sudo mv default.yaml.bak 01-netcfg.yaml && netplan apply
?
â chili555
Mar 10 at 15:45
this is an valid option as long as you have local access to the server, not over network. I only have 1 network card, and can only access the server using ssh. So if i mess something up in the netplan, and load it. then i have to boot the server up in recovery mode and do this you just described. What I want is to be able to apply settings in netplan, that are reversed back to a default setup when i reboot the server, incase i mess up.
â BD Bear
Mar 11 at 16:48
1
What I can try to create a bash script that load on boot, where i use cat to write the defaults to 01-netctf.yaml.
â BD Bear
Mar 11 at 16:50
1
I'd look into /etc/rc.local.
â chili555
Mar 11 at 17:22
3
One thing I'm working on is "netplan try", so that configuration could be "attempted" live and if you don't answer a prompt, it is automatically reverted to the previous configuration. Would that help in your case?
â Mathieu Trudel-Lapierre
Mar 13 at 15:43
 |Â
show 1 more comment
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I work on remote servers, and its a painfull process to go into Rescue Mode everytime I screw something up when it comes to network configuraitons.
Are there a way to implement something like:
Netplan apply /customscript.yaml
That I can use when I troubleshoot network configurations.
So the server gets its "defaults" if I do a cold reboot.
boot networking netplan
I work on remote servers, and its a painfull process to go into Rescue Mode everytime I screw something up when it comes to network configuraitons.
Are there a way to implement something like:
Netplan apply /customscript.yaml
That I can use when I troubleshoot network configurations.
So the server gets its "defaults" if I do a cold reboot.
boot networking netplan
boot networking netplan
edited Mar 14 at 2:36
dpb
4,90911545
4,90911545
asked Mar 9 at 17:30
BD Bear
11013
11013
Are you trying to restore the default .yaml file and then netplan apply? Can you save the default as default.yaml.bak and then:sudo mv default.yaml.bak 01-netcfg.yaml && netplan apply
?
â chili555
Mar 10 at 15:45
this is an valid option as long as you have local access to the server, not over network. I only have 1 network card, and can only access the server using ssh. So if i mess something up in the netplan, and load it. then i have to boot the server up in recovery mode and do this you just described. What I want is to be able to apply settings in netplan, that are reversed back to a default setup when i reboot the server, incase i mess up.
â BD Bear
Mar 11 at 16:48
1
What I can try to create a bash script that load on boot, where i use cat to write the defaults to 01-netctf.yaml.
â BD Bear
Mar 11 at 16:50
1
I'd look into /etc/rc.local.
â chili555
Mar 11 at 17:22
3
One thing I'm working on is "netplan try", so that configuration could be "attempted" live and if you don't answer a prompt, it is automatically reverted to the previous configuration. Would that help in your case?
â Mathieu Trudel-Lapierre
Mar 13 at 15:43
 |Â
show 1 more comment
Are you trying to restore the default .yaml file and then netplan apply? Can you save the default as default.yaml.bak and then:sudo mv default.yaml.bak 01-netcfg.yaml && netplan apply
?
â chili555
Mar 10 at 15:45
this is an valid option as long as you have local access to the server, not over network. I only have 1 network card, and can only access the server using ssh. So if i mess something up in the netplan, and load it. then i have to boot the server up in recovery mode and do this you just described. What I want is to be able to apply settings in netplan, that are reversed back to a default setup when i reboot the server, incase i mess up.
â BD Bear
Mar 11 at 16:48
1
What I can try to create a bash script that load on boot, where i use cat to write the defaults to 01-netctf.yaml.
â BD Bear
Mar 11 at 16:50
1
I'd look into /etc/rc.local.
â chili555
Mar 11 at 17:22
3
One thing I'm working on is "netplan try", so that configuration could be "attempted" live and if you don't answer a prompt, it is automatically reverted to the previous configuration. Would that help in your case?
â Mathieu Trudel-Lapierre
Mar 13 at 15:43
Are you trying to restore the default .yaml file and then netplan apply? Can you save the default as default.yaml.bak and then:
sudo mv default.yaml.bak 01-netcfg.yaml && netplan apply
?â chili555
Mar 10 at 15:45
Are you trying to restore the default .yaml file and then netplan apply? Can you save the default as default.yaml.bak and then:
sudo mv default.yaml.bak 01-netcfg.yaml && netplan apply
?â chili555
Mar 10 at 15:45
this is an valid option as long as you have local access to the server, not over network. I only have 1 network card, and can only access the server using ssh. So if i mess something up in the netplan, and load it. then i have to boot the server up in recovery mode and do this you just described. What I want is to be able to apply settings in netplan, that are reversed back to a default setup when i reboot the server, incase i mess up.
â BD Bear
Mar 11 at 16:48
this is an valid option as long as you have local access to the server, not over network. I only have 1 network card, and can only access the server using ssh. So if i mess something up in the netplan, and load it. then i have to boot the server up in recovery mode and do this you just described. What I want is to be able to apply settings in netplan, that are reversed back to a default setup when i reboot the server, incase i mess up.
â BD Bear
Mar 11 at 16:48
1
1
What I can try to create a bash script that load on boot, where i use cat to write the defaults to 01-netctf.yaml.
â BD Bear
Mar 11 at 16:50
What I can try to create a bash script that load on boot, where i use cat to write the defaults to 01-netctf.yaml.
â BD Bear
Mar 11 at 16:50
1
1
I'd look into /etc/rc.local.
â chili555
Mar 11 at 17:22
I'd look into /etc/rc.local.
â chili555
Mar 11 at 17:22
3
3
One thing I'm working on is "netplan try", so that configuration could be "attempted" live and if you don't answer a prompt, it is automatically reverted to the previous configuration. Would that help in your case?
â Mathieu Trudel-Lapierre
Mar 13 at 15:43
One thing I'm working on is "netplan try", so that configuration could be "attempted" live and if you don't answer a prompt, it is automatically reverted to the previous configuration. Would that help in your case?
â Mathieu Trudel-Lapierre
Mar 13 at 15:43
 |Â
show 1 more comment
2 Answers
2
active
oldest
votes
up vote
1
down vote
There is a new way to do this in Bionic: netplan try
.
In your case, netplan try --config-file foo.yaml
should do what you want.
The manpage isn't very helpful as it mostly describes the config file format, but --help
gives you a pretty good outline of the tool:
ubuntu@netplan:~$ netplan try --help
usage: /usr/sbin/netplan try [-h] [--debug] [--config-file CONFIG_FILE]
[--timeout TIMEOUT]
Try to apply a new netplan config to running system, with automatic rollback
optional arguments:
-h, --help show this help message and exit
--debug Enable debug messages
--config-file CONFIG_FILE
Apply the config file in argument in addition to
current configuration.
--timeout TIMEOUT Maximum number of seconds to wait for the user's
confirmation
add a comment |Â
up vote
0
down vote
accepted
First I created a sh script, placed it in /etc/netplan/ and named it backup.sh
#!/bin/sh
# -q quiet
# -c nb of pings to perform
ping -q -c5 aa.bb.cc.dd > /dev/null
if [ $? -eq 0 ]
then
: #do absolutly nothing! server can ping its external IP.
else
# restore, working config to netplan.
cp -f /etc/netplan/02-netcfg.yaml /etc/netplan/01-netcfg.yaml
# apply network config.
netplan apply
fi
This script revert the changes I have made, to a working configuration setup that I have stored in 02-netcfg.yaml If i cant ping the server IP. I have masked my server IP address whit aa.bb.cc.dd So you have to replace that whit the IP you want to ping, in order to execute the "else" in the if.
Then i set this script to run everytime the server restart, as well as enable a Cron job for it that runs every 3 minutes when i work on network configurations.
A question, to simplyfy the script even more: Can i add a netplan - c /etc/netplan/02-netcfg.yaml apply or something like that?
â BD Bear
Mar 15 at 10:17
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
There is a new way to do this in Bionic: netplan try
.
In your case, netplan try --config-file foo.yaml
should do what you want.
The manpage isn't very helpful as it mostly describes the config file format, but --help
gives you a pretty good outline of the tool:
ubuntu@netplan:~$ netplan try --help
usage: /usr/sbin/netplan try [-h] [--debug] [--config-file CONFIG_FILE]
[--timeout TIMEOUT]
Try to apply a new netplan config to running system, with automatic rollback
optional arguments:
-h, --help show this help message and exit
--debug Enable debug messages
--config-file CONFIG_FILE
Apply the config file in argument in addition to
current configuration.
--timeout TIMEOUT Maximum number of seconds to wait for the user's
confirmation
add a comment |Â
up vote
1
down vote
There is a new way to do this in Bionic: netplan try
.
In your case, netplan try --config-file foo.yaml
should do what you want.
The manpage isn't very helpful as it mostly describes the config file format, but --help
gives you a pretty good outline of the tool:
ubuntu@netplan:~$ netplan try --help
usage: /usr/sbin/netplan try [-h] [--debug] [--config-file CONFIG_FILE]
[--timeout TIMEOUT]
Try to apply a new netplan config to running system, with automatic rollback
optional arguments:
-h, --help show this help message and exit
--debug Enable debug messages
--config-file CONFIG_FILE
Apply the config file in argument in addition to
current configuration.
--timeout TIMEOUT Maximum number of seconds to wait for the user's
confirmation
add a comment |Â
up vote
1
down vote
up vote
1
down vote
There is a new way to do this in Bionic: netplan try
.
In your case, netplan try --config-file foo.yaml
should do what you want.
The manpage isn't very helpful as it mostly describes the config file format, but --help
gives you a pretty good outline of the tool:
ubuntu@netplan:~$ netplan try --help
usage: /usr/sbin/netplan try [-h] [--debug] [--config-file CONFIG_FILE]
[--timeout TIMEOUT]
Try to apply a new netplan config to running system, with automatic rollback
optional arguments:
-h, --help show this help message and exit
--debug Enable debug messages
--config-file CONFIG_FILE
Apply the config file in argument in addition to
current configuration.
--timeout TIMEOUT Maximum number of seconds to wait for the user's
confirmation
There is a new way to do this in Bionic: netplan try
.
In your case, netplan try --config-file foo.yaml
should do what you want.
The manpage isn't very helpful as it mostly describes the config file format, but --help
gives you a pretty good outline of the tool:
ubuntu@netplan:~$ netplan try --help
usage: /usr/sbin/netplan try [-h] [--debug] [--config-file CONFIG_FILE]
[--timeout TIMEOUT]
Try to apply a new netplan config to running system, with automatic rollback
optional arguments:
-h, --help show this help message and exit
--debug Enable debug messages
--config-file CONFIG_FILE
Apply the config file in argument in addition to
current configuration.
--timeout TIMEOUT Maximum number of seconds to wait for the user's
confirmation
answered May 3 at 7:30
dja
173119
173119
add a comment |Â
add a comment |Â
up vote
0
down vote
accepted
First I created a sh script, placed it in /etc/netplan/ and named it backup.sh
#!/bin/sh
# -q quiet
# -c nb of pings to perform
ping -q -c5 aa.bb.cc.dd > /dev/null
if [ $? -eq 0 ]
then
: #do absolutly nothing! server can ping its external IP.
else
# restore, working config to netplan.
cp -f /etc/netplan/02-netcfg.yaml /etc/netplan/01-netcfg.yaml
# apply network config.
netplan apply
fi
This script revert the changes I have made, to a working configuration setup that I have stored in 02-netcfg.yaml If i cant ping the server IP. I have masked my server IP address whit aa.bb.cc.dd So you have to replace that whit the IP you want to ping, in order to execute the "else" in the if.
Then i set this script to run everytime the server restart, as well as enable a Cron job for it that runs every 3 minutes when i work on network configurations.
A question, to simplyfy the script even more: Can i add a netplan - c /etc/netplan/02-netcfg.yaml apply or something like that?
â BD Bear
Mar 15 at 10:17
add a comment |Â
up vote
0
down vote
accepted
First I created a sh script, placed it in /etc/netplan/ and named it backup.sh
#!/bin/sh
# -q quiet
# -c nb of pings to perform
ping -q -c5 aa.bb.cc.dd > /dev/null
if [ $? -eq 0 ]
then
: #do absolutly nothing! server can ping its external IP.
else
# restore, working config to netplan.
cp -f /etc/netplan/02-netcfg.yaml /etc/netplan/01-netcfg.yaml
# apply network config.
netplan apply
fi
This script revert the changes I have made, to a working configuration setup that I have stored in 02-netcfg.yaml If i cant ping the server IP. I have masked my server IP address whit aa.bb.cc.dd So you have to replace that whit the IP you want to ping, in order to execute the "else" in the if.
Then i set this script to run everytime the server restart, as well as enable a Cron job for it that runs every 3 minutes when i work on network configurations.
A question, to simplyfy the script even more: Can i add a netplan - c /etc/netplan/02-netcfg.yaml apply or something like that?
â BD Bear
Mar 15 at 10:17
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
First I created a sh script, placed it in /etc/netplan/ and named it backup.sh
#!/bin/sh
# -q quiet
# -c nb of pings to perform
ping -q -c5 aa.bb.cc.dd > /dev/null
if [ $? -eq 0 ]
then
: #do absolutly nothing! server can ping its external IP.
else
# restore, working config to netplan.
cp -f /etc/netplan/02-netcfg.yaml /etc/netplan/01-netcfg.yaml
# apply network config.
netplan apply
fi
This script revert the changes I have made, to a working configuration setup that I have stored in 02-netcfg.yaml If i cant ping the server IP. I have masked my server IP address whit aa.bb.cc.dd So you have to replace that whit the IP you want to ping, in order to execute the "else" in the if.
Then i set this script to run everytime the server restart, as well as enable a Cron job for it that runs every 3 minutes when i work on network configurations.
First I created a sh script, placed it in /etc/netplan/ and named it backup.sh
#!/bin/sh
# -q quiet
# -c nb of pings to perform
ping -q -c5 aa.bb.cc.dd > /dev/null
if [ $? -eq 0 ]
then
: #do absolutly nothing! server can ping its external IP.
else
# restore, working config to netplan.
cp -f /etc/netplan/02-netcfg.yaml /etc/netplan/01-netcfg.yaml
# apply network config.
netplan apply
fi
This script revert the changes I have made, to a working configuration setup that I have stored in 02-netcfg.yaml If i cant ping the server IP. I have masked my server IP address whit aa.bb.cc.dd So you have to replace that whit the IP you want to ping, in order to execute the "else" in the if.
Then i set this script to run everytime the server restart, as well as enable a Cron job for it that runs every 3 minutes when i work on network configurations.
edited Mar 15 at 10:27
answered Mar 15 at 10:14
BD Bear
11013
11013
A question, to simplyfy the script even more: Can i add a netplan - c /etc/netplan/02-netcfg.yaml apply or something like that?
â BD Bear
Mar 15 at 10:17
add a comment |Â
A question, to simplyfy the script even more: Can i add a netplan - c /etc/netplan/02-netcfg.yaml apply or something like that?
â BD Bear
Mar 15 at 10:17
A question, to simplyfy the script even more: Can i add a netplan - c /etc/netplan/02-netcfg.yaml apply or something like that?
â BD Bear
Mar 15 at 10:17
A question, to simplyfy the script even more: Can i add a netplan - c /etc/netplan/02-netcfg.yaml apply or something like that?
â BD Bear
Mar 15 at 10:17
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%2f1013455%2fis-there-a-way-to-try-out-a-netplan-configuration-without-altering-the-system%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
Are you trying to restore the default .yaml file and then netplan apply? Can you save the default as default.yaml.bak and then:
sudo mv default.yaml.bak 01-netcfg.yaml && netplan apply
?â chili555
Mar 10 at 15:45
this is an valid option as long as you have local access to the server, not over network. I only have 1 network card, and can only access the server using ssh. So if i mess something up in the netplan, and load it. then i have to boot the server up in recovery mode and do this you just described. What I want is to be able to apply settings in netplan, that are reversed back to a default setup when i reboot the server, incase i mess up.
â BD Bear
Mar 11 at 16:48
1
What I can try to create a bash script that load on boot, where i use cat to write the defaults to 01-netctf.yaml.
â BD Bear
Mar 11 at 16:50
1
I'd look into /etc/rc.local.
â chili555
Mar 11 at 17:22
3
One thing I'm working on is "netplan try", so that configuration could be "attempted" live and if you don't answer a prompt, it is automatically reverted to the previous configuration. Would that help in your case?
â Mathieu Trudel-Lapierre
Mar 13 at 15:43