#2312 Issue closed: Provide complete basic network migration functionality during "rear recover"

Labels: enhancement, discuss / RFC, needs sponsorship, no-issue-activity

jsmeix opened issue at 2020-01-15 10:43:

Currently ReaR provides only a few limited specific
adaptions of the network configuration during "rear recover"
in particular for IP and MAC addresses and routing
via some /etc/rear/mappings/ files, cf.
https://github.com/rear/rear/tree/master/doc/mappings

But other basic network migration functionality is missing
for example the hostname, cf.
https://github.com/rear/rear/issues/2310#issuecomment-574592858
where @tumbajamba wrote (excerpt):

an idea btw. suggestion for a new feature
"changing hostname for target machine".
Since you've already implemented features like:

mappings/ip_addresses
mappings/routes
...

So it would just make sense to implement a function:
mappings/hostname

Which would complete the processes of
deploying a new server out of the existing machine
based on REAR-Software.

I think providing complete networking migration and/or setup
functionality during "rear recover" for basically all and everything
what can be set up for networking is (at least currently)
out of scope of what ReaR is meant for.

But I think providing functionality to migrate and/or setup
only the basic networking functionality during "rear recover"
so that after "rear recover" the new (re)-created machine
has a correct new basic network setup is what ReaR could do.

jsmeix commented at 2020-01-15 10:52:

@rmetrich @gdha
what do you think about this enhancement proposal?

Would it make sense?
I.e. does the term "basic network setup" actually make sense
or is network setup actually an unlimited complex beast
where one cannot separate "basic network setup"
from "advanced network setup" in a reasonable way.

If it makes sense, would it be doable with reasonable effort?

Perhaps a simple and generically working basic method
to set up networking at the end of "rear recover" could be
something like NETWORKING_PREPARATION_COMMANDS
https://github.com/rear/rear/blob/master/usr/share/rear/conf/default.conf#L2604
e.g. a new TARGET_SYSTEM_NETWORK_SETUP_COMMANDS
where the user can specify his particular comands to set up
networking at the end of "rear recover" as he needs it?
On the other had we already have POST_RECOVERY_SCRIPT
as a generic basic method where the user could do whatever
is needed at the end of "rear recover".
But POST_RECOVERY_SCRIPT runs within the ReaR recovery system, cf.
https://github.com/rear/rear/blob/master/usr/share/rear/wrapup/default/500_post_recovery_script.sh
while networking setup comands for the new (re)-created machine
should be run within that new (re)-created target system i.e. within
a chroot $TARGET_FS_ROOT environment so a separated
new TARGET_SYSTEM_NETWORK_SETUP_COMMANDS
where that happens automatically would make sense.

See also

some first ideas how to provide generic functionality in ReaR

in
https://github.com/rear/rear/issues/2310#issuecomment-575043164

rmetrich commented at 2020-01-15 11:07:

@jsmeix Hello, network setup is just a beast, it will be extremely difficult to have something work among all distros.
Even setting the hostname is not that easy (unless systemd is used).
I would definitely let the admin do what he wants.

tumbajamba commented at 2020-01-15 11:58:

@rmetrich
According to this link, setting up hostname doesn't look that difficult to implement, even though you are completely right, that the procedure of setting up the hostname across different distributions might differ.
https://www.tecmint.com/set-hostname-permanently-in-linux/

Basically we have three options here:

/etc/hostname
/etc/sysconfig/network
hostnamectl on systemD

jsmeix commented at 2020-03-05 09:12:

I added "needs sponsorship" because since
https://github.com/rear/rear/issues/2310#issuecomment-594591924
it does no longer look as if I could do that alone in a reasonable way.

github-actions commented at 2020-06-26 01:39:

Stale issue message


[Export of Github issue for rear/rear.]