我已经build立了基于Debian的机器自动安装的基础设施。 它使用PXE引导与DHCP和TFTP服务器,并预先自动化操作系统安装。
我想要的是:
但我找不到如何去做,甚至知道是否有可能。
我目前的preseed文件如下所示(仅限networking参数):
# netcfg will choose an interface that has link if possible. This makes it # skip displaying a list if there is more than one interface. di netcfg/choose_interface select auto # If you prefer to configure the network manually, uncomment this line and # the static network configuration below. di netcfg/disable_autoconfig boolean true # If you want the preconfiguration file to work on systems both with and # without a dhcp server, uncomment these lines and the static network # configuration below. di netcfg/dhcp_failed note di netcfg/dhcp_options select Configure network manually # Static network configuration. # # IPv4 example di netcfg/get_ipaddress string 192.168.1.10 di netcfg/get_netmask string 255.255.255.0 di netcfg/get_gateway string 192.168.1.254 di netcfg/get_nameservers string 192.168.1.1 di netcfg/confirm_static boolean true
(我也testing了注释线di netcfg/disable_autoconfig boolean true
具有相同的结果)。
有谁知道如何做到这一点?
谢谢。
ps:这是Debian Wheezy
在安装后使用您自己的命令执行的预先select:
di preseed/late_command string wget http://your-web_or_ftp/unattend/dopostinstall.sh -O /tmp/dopostinstall.sh; chmod +x /tmp/dopostinstall.sh; /tmp/dopostinstall.sh
dopostinstall.sh是这样的:
#!/bin/ash echo -e "auto lo eth0 \niface lo inet loopback\n\niface eth0 inet static\n\t address 192.168.1.10\n\t netmask 255.255.255.0\n\t gateway 192.168.1.254\n\t dns-nameservers 192.168.1.1" > /target/etc/network/interfaces