首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用PXE和预设的动态IP地址安装Debian,但最后使用静态IP地址进行配置。

使用PXE和预设的动态IP地址安装Debian,但最后使用静态IP地址进行配置。
EN

Server Fault用户
提问于 2013-07-25 09:55:40
回答 1查看 3.8K关注 0票数 3

我已经为基于Debian的机器的自动安装建立了基础设施。它使用PXE引导与DHCP和TFTP服务器,并预置,以自动化的操作系统安装。

我想要的是:

  • 使用DHCP引导PXE
  • 为Debian安装程序使用DHCP :它需要一个IP地址来访问预置文件,我不想手动输入它
  • 在最终安装的操作系统上使用静态IP地址。此IP地址将在预置文件中指定。

但我找不到该怎么做,甚至也不知道是否可能。

我当前的预置文件看起来如下(仅网络参数):

代码语言:javascript
复制
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto

# If you prefer to configure the network manually, uncomment this line and
# the static network configuration below.
d-i 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.
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually

# Static network configuration.
#
# IPv4 example
d-i netcfg/get_ipaddress string 192.168.1.10
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 192.168.1.254
d-i netcfg/get_nameservers string 192.168.1.1
d-i netcfg/confirm_static boolean true

(我还测试了用相同的结果注释行d-i netcfg/disable_autoconfig boolean true )。

有人知道怎么做吗?

谢谢。

ps:我是Debian Wheezy

EN

回答 1

Server Fault用户

发布于 2013-09-04 13:05:04

在安装后执行自己的命令的预置选项中使用:

代码语言:javascript
复制
d-i 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是这样的:

代码语言:javascript
复制
#!/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
票数 3
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/526161

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档