Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alter network config at boot time #1982

Closed
dm6079 opened this issue Nov 26, 2018 · 3 comments
Closed

alter network config at boot time #1982

dm6079 opened this issue Nov 26, 2018 · 3 comments

Comments

@dm6079
Copy link

dm6079 commented Nov 26, 2018

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
Copy link
Member

schlomo commented Nov 26, 2018

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
Copy link
Member

gdha commented Nov 27, 2018

@dm6079
Copy link
Author

dm6079 commented Nov 27, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants