服务器在 PXE 启动和启动操作系统之间更改正在使用的网络端口

服务器在 PXE 启动和启动操作系统之间更改正在使用的网络端口

每当我通过 PXE 启动 CentOS 6.5 服务器时,我都会遇到服务器在安装和启动操作系统之间使用不同网络端口的问题。

我已经在多台服务器上看到了这种情况。行为如下:

  1. 我将网线插入第一个板载以太网端口(在任何其他端口上 PXE 启动都会失败)。
  2. 我打开服务器电源,按 F12,它开始 PXE 启动安装。
  3. 安装完成后,我重新启动服务器。
  4. 当服务器启动时,网络就中断了。
  5. 我从在船上端口并将其重新插入第一个网卡港口。
  6. 网络再次活跃起来。

有没有办法从一开始就防止这种端口更改发生,而不是每次都要进行尴尬的电缆交换或网络重新配置?

我查看了 BIOS 和网上的各种 CentOS 文章,但是我的 Google-fu 却让我失望了。

编辑:根据要求,这里是一些附加信息。

提到的 PXE 启动服务器是 Cobbler 服务器。它使用 kickstart 模板自动完成安装,目前仅通过 DHCP 配置网络。

此外,使用的主板是 SuperMicro H8DGU-F。

kickstart模板如下:

# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Firewall configuration
firewall --enabled
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config') # This becomes: 'network --bootproto=dhcp --device=eth0 --onboot=on'
# Reboot after installation
reboot

#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone  America/Denver
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
autopart

%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end

%packages
$SNIPPET('func_install_if_enabled')
%end

%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end

答案1

Linux 在这里首先探测专用网卡,我想知道是否有任何方法可以改变此顺序。因此,板载端口的名称为 ethX,而不是 eth0。

如果您同意,那么只需使用--device=bootifkickstart 网络选项来准确配置 PXE 启动接口:

network --bootproto=dhcp --device=bootif --onboot=on

一些额外的猜测:

如果能自动将 eth0 名称分配给启动接口,那就太好了。提供一个将 bootif MAC 地址传递给 kickstart 安装后脚本的选项,就可以相应地重写 UDEV 规则。不幸的是,我目前不知道如何做到这一点。

相关内容