#1982 Issue closed
: alter network config at boot time¶
Labels: documentation
, fixed / solved / done
dm6079 opened issue at 2018-11-26 16:51:¶
rear version - Relax-and-Recover 2.4 / Git
OS version - Red Hat Enterprise Linux 7.4
source - x86 physical
restore target - VMware virtual machine
Source system has 2x 10Gbe NICs, bonded together via 'teamd', multiple
vlans trunked over the team.
Testing restore to a VM. The initial boot of the rescue .iso asks to
substitute one of the original NIC names (eno1) with a nic name of the
vm (ens192). After the boot, it brings up most the vlan interfaces and
one as a sub-interface of the new nic name.
Normally I use several 'cheats' to configure this networking under rhel7 - either 'nmtui', 'nmcli', or edit the config scripts under /etc/sysconfig/network-scripts and restart networking via 'systemctl restart network'. I don't see that any of these options are available under rescue.
If I do manage to get a usable interface up with ip or ifconfig, somewhere in the restore process it appears that the original vlan interfaces are getting reconfigured to match production and restarted. Makes testing very dicey ....
Is there some way to tell the rescue boot to disregard original network
configs ??
Is there some way to tell the restore process to NOT bring up the
original nic settings ??
thanks,
don m.
schlomo commented at 2018-11-26 22:02:¶
You can force the rescue system to use DHCP via USE_DHCLIENT=y
(regardless of your actual DHCP client software, this is the parameter).
To set a completely custom network configuration in the rescue system
use the NETWORKING_PREPARATION_COMMANDS
variables which is described
in /usr/share/rear/conf/default.conf
like this:
# Commands to prepare network devices setup in the rescue/recovery system
# provided the kernel command line does not contain the 'noip' parameter.
# Each command is a quoted fixed string to get the commands separated from each other
# as in NETWORKING_PREPARATION_COMMANDS=( 'first command' 'second command' ).
# The commands in NETWORKING_PREPARATION_COMMANDS get copied at the beginning
# of /etc/scripts/system-setup.d/60-network-devices.sh that is the main script
# which runs while booting the rescue/recovery system to set up network devices.
# The primary intent is to be able to specify special commands for special cases
# as preparation so that the subsequent autogenerated network devices setup code
# in the 60-network-devices.sh script can successfully set up network devices
# (for details see usr/share/rear/rescue/GNU/Linux/310_network_devices.sh).
# But NETWORKING_PREPARATION_COMMANDS is not limited to its primary intent.
# For example it can also be used to set up networking completely manually in the rescue/recovery system via something like
# NETWORKING_PREPARATION_COMMANDS=( 'ip addr add 192.168.100.2/24 dev eth0' 'ip link set dev eth0 up' 'ip route add default via 192.168.100.1' 'return' )
# where the last command lets the 60-network-devices.sh script directly return
# so that the subsequent autogenerated network devices setup code will not be run.
# The by default empty NETWORKING_PREPARATION_COMMANDS means the 60-network-devices.sh script
# is autogenerated according to the network devices setup in the currently running system
# i.e. the default is an automated network devices setup in the rescue/recovery system
# that should match the network devices setup in the currently running system:
NETWORKING_PREPARATION_COMMANDS=()
See the default.conf
for more things to tweak. For example
POST_RECOVERY_SCRIPT
could point to some script that is called after
the recovery and that modifies the recovered system (found in
/mnt/local
) to come up with a different network configuration. For
example by deleting the static network configuration files and switching
the system to DHCP. You have to create this script and can do there
whatever you want.
About the network configuration tools you mention - we don't support those at all. You'll have to use Linux standard commands to configure the network. The reason is that we don't copy the OS's network configuration framework but ship our own which is much simpler and works everywhere the same (based on the plain Linux networking commands).
Is that what you meant?
gdha commented at 2018-11-27 07:48:¶
@dm6079 please check also http://relax-and-recover.org/documentation/faq
dm6079 commented at 2018-11-27 17:22:¶
Thank you, gentlemen. Your suggestions got our test working. Did spend
a
good bit of time adjusting partition & volume sizings to restore to a
smaller disk.
thanks,
don m.
On Tue, Nov 27, 2018 at 2:48 AM gdha notifications@github.com wrote:
@dm6079 https://github.com/dm6079 please check also
http://relax-and-recover.org/documentation/faq—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/rear/rear/issues/1982#issuecomment-441959890, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AYZxQ96onA3evPrXojeNi_GFWPZ8a5CGks5uzO5fgaJpZM4YzbL_
.
[Export of Github issue for rear/rear.]