pxe网络安装openbsd

OpenBSD的安装、升级、更新等日常问题。

版主: chenjun天地乾坤

回复
junfengfan
铜 Cu
帖子: 236
注册时间: 2010-02-03 18:37

pxe网络安装openbsd

帖子 junfengfan » 2010-02-10 12:11

我在一台已装好openbsd4.6的机器上,配置好dhcpd.conf , 还有把 inetd.conf 的tftpd 那一行的前面的星号去掉,等于配置好tftpd服务;然后建立 /pxeboot 文件夹,建立/tftpboot文件夹,还有pxeboot,bsd.rd两个文件;
在另一台机器上启用bootrom 后,能分配到ip地址,可是出现
pxe-e11:arp timeout
pxe-e38:tftp cannot open connection
pxe-mof: exiting pxe rom.

不知是何原因?

网上搜到的都是服务器为winxp .或者ubuntu等等,我没有搜到服务器也为Openbsd的;

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2010-02-11 14:55

junfengfan 写了:我在一台已装好openbsd4.6的机器上,配置好dhcpd.conf , 还有把 inetd.conf 的tftpd 那一行的前面的星号去掉,等于配置好tftpd服务;然后建立 /pxeboot 文件夹,建立/tftpboot文件夹,还有pxeboot,bsd.rd两个文件;
在另一台机器上启用bootrom 后,能分配到ip地址,可是出现
pxe-e11:arp timeout
pxe-e38:tftp cannot open connection
pxe-mof: exiting pxe rom.

不知是何原因?

网上搜到的都是服务器为winxp .或者ubuntu等等,我没有搜到服务器也为Openbsd的;
这里有描述:
http://www.gobsd.org/OpenBSD.FAQ/c/faq6.html#PXE

你先测试一下你的tftp.另外请把你的网络情况和dhcpd.conf贴出来。

junfengfan
铜 Cu
帖子: 236
注册时间: 2010-02-03 18:37

帖子 junfengfan » 2010-02-12 14:50

# less /etc/dhcpd.conf

# $OpenBSD: dhcpd.conf,v 1.2 2008/10/03 11:41:21 sthen Exp $
#
# DHCP server options.
# See dhcpd.conf(5) and dhcpd(8) for more information.
#

# Network: 192.168.1.0/255.255.255.0
# Domain name: my.domain
# Name servers: 192.168.1.3 and 192.168.1.5
# Default router: 192.168.1.1
# Addresses: 192.168.1.32 - 192.168.1.127
#
option domain-name "3322.org";
option domain-name-servers 202.102.224.68, 202.102.227.68;
option netbios-name-servers 202.102.224.68, 202.102.227.68;

subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.1;

range 192.168.10.39 192.168.10.127;

# filename "pxeboot";
host static-client {
hardware ethernet 22:33:44:55:66:77;
fixed-address 192.168.10.200;
}

host pxe-client {
# hardware ethernet 02:03:04:05:06:07;
hardware ethernet 00:13:d4:50:b6:19;
# hardware ethernet 00:04:ac:98:15:d6;
filename "pxeboot";
next-server 192.168.10.1;
}
}
subnet 192.168.20.0 netmask 255.255.255.0 {
option routers 192.168.20.1;

range 192.168.20.38 192.168.20.127;

host static-client {
hardware ethernet 22:33:44:55:66:77;
fixed-address 192.168.20.200;
}

# filename "pxeboot";
host pxe-client {
# hardware ethernet 02:03:04:05:06:07;
hardware ethernet 00:13:d4:50:b6:19;
# default-lease-time 86400;
# max-lease-time 90000;
filename "pxeboot";
# option root-path "192.168.20.1:/tftpboot";
# option tftp-server-name "192.168.20.1";
next-server 192.168.20.1;
}
}




tftp也没有问题~~~

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2010-02-13 4:30

a. 根据您头一帖的描述,您目前的tftp虽然设置了,但是没有连接上,检查一下是否被pf给阻挡了?
b. 检查一下pxeboot文件的属性是否可读。
c. 您没有严格按照教程走,规则有问题,filename "pxeboot" 的前面不能有注释符“#”。
d. 另外检查一下是否有多余的网卡连接到了其它的路由器上,也就是说您的OpenBSD的DHCP服务器主机并非唯一的DHCP服务器,其它机器是否也提供了DHCP服务,而没有提供tftp?
e. 此外建议您尽量描述的详细一些,例如:是否DHCP和tftp服务器在同一台主机上?内容越详细越清晰则越便于分析问题,这在FAQ的例子里也提到了,不是没有道理的。我现在仅能假设您是这种情况,但我不能确认,如果您的网络不是这种情况则需要更改设置。


我把我的步骤也列在这里供您参考:

1.设置DHCP服务器上连接dhcp客户端的网卡,我这里是re0,为了避免冲突,您最好手动设置,我将内网IP段设为192.168.2.X,re0的IP设置为192.168.2.1,所以编辑/etc/hostname.re0文件,将内容设置为:

代码: 全选

inet 192.168.2.1 255.255.255.0 NONE
2. 设置DHCP服务器,编辑 /etc/rc.conf.local文件,下面是我的文件:

代码: 全选

[code]inetd=YES
[color=black]pf=NO[/color]
pf_rules=/etc/pfnew.conf
[color=red]dhcpd_flags="re0"[/color]
[color=red]dhcpd=YES[/color]
[/code]上面红色的部分是添加的内容,目的是启用dhcp服务器,其中re0为连接dhcp客户端的网络接口。注意我在这里为了简化操作步骤,仅简单地关闭了pf,如果您在实际应用里不愿意这样,请在PF规则里放行内网和DHCP服务器之间的全部通讯,或者开启对内网的相应端口及协议以便放行DHCP及tftp的相应通讯,为了说明主要问题——pxe启动,我们就不在这里展开讨论了。

3. 启用tftp服务器,这里请注意:按照FAQ的说明,您不能禁用inetd,因为启用tftp需要它;编辑/etc/inetd.conf文件,将tftpd前面的注释符去掉:

代码: 全选

.......
tftp dgram udp wait root /usr/libexec/tftpd tftpd -$
tftp dgram udp6 wait root /usr/libexec/tftpd tftpd -$
#127.0.0.1:comsat dgram udp wait......
4. 创建 /tftpboot目录,这是pxe默认使用的目录:

代码: 全选

# mkdir /tftpboot
5. 将启动所需文件拷贝至 /tftpboot目录

代码: 全选

[code]# cp /usr/mdec/pxeboot /tftpboot/pxeboot
# cp /bsd.rd /tftpboot/bsd.rd
[/code]
因为启动时您可以指定内核文件,所以不用再单独拷贝boot.conf了,如果您想这样做也可以,将boot.conf的内容修改为:

代码: 全选

boot /bsd.rd
6. 修改系统默认的 /etc/dhcpd.conf文件,加入如下红色内容,下面是我的文件:

代码: 全选

# $OpenBSD: dhcpd.conf,v 1.2 2008/10/03 11:41:21 sthen Exp $
#
# DHCP server options.
# See dhcpd.conf(5) and dhcpd(8) for more information.
#
# Network: 192.168.1.0/255.255.255.0
# Domain name: my.domain
# Name servers: 192.168.1.3 and 192.168.1.5
# Default router: 192.168.1.1
# Addresses: 192.168.1.32 - 192.168.1.127
#
option domain-name "my.domain";
option domain-name-servers 192.168.1.3, 192.168.1.5;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
range 192.168.1.32 192.168.1.127;
host static-client {
hardware ethernet 22:33:44:55:66:77;
fixed-address 192.168.1.200;
}
host pxe-client {
hardware ethernet 02:03:04:05:06:07;
filename "pxeboot";
next-server 192.168.1.1;
}
}
subnet 192.168.2.0 netmask 255.255.255.0 {
option routers 192.168.2.1;
range 192.168.2.32 192.168.2.127;
filename "pxeboot"; <-------------------这行决不能有注释符
host static-client {
hardware ethernet 22:33:44:55:66:77;
fixed-address 192.168.2.200;
}
host pxe-client {
hardware ethernet 02:03:04:05:06:07;
next-server 192.168.2.1;
}
}
7. 重新启动DHCP服务器所在主机。

8. 启动客户端计算机(必须具有PXE的能力,否则我前面说的就全是废话了。),出现boot提示符后键入bsd.rd就开始安装了。下面是FAQ里面的示例,是4.5的,很抱歉,我在测试时并未截图,不过没有关系,大同小异罢了:

代码: 全选

[code]>> OpenBSD/i386 PXEBOOT 2.03
boot> bsd.rd
booting tftp:bsd.rd: 4375152+733120 [58+122112+105468]=0x516d04
entry point at 0x100120
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2008 OpenBSD. All rights reserved. [URL]http://www.OpenBSD.org[/URL]
OpenBSD 4.5 (RAMDISK_CD) #1112: Sat Feb 28 15:06:26 MST 2009
[/code]不知道我的描述您能明白吗?
如果您成功了,请根据自己的情况修改该主题的前缀,也就是将前缀修改为【部分解决】或【完全解决】,如果不清楚怎样修改,我来改也可以。
如果您愿意,请在下面回贴说明当初详细的配置情况及失败原因,这样以后遇到同样问题的朋友会非常感激您。

junfengfan
铜 Cu
帖子: 236
注册时间: 2010-02-03 18:37

帖子 junfengfan » 2010-02-17 11:49

你上面的例子是在openbsd4.5上面,你闲时请你再试试openbsd4.6,我感觉两者配置不太一样,我在openbsd4.6上配置总是不行~~~~~~~

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2010-02-17 12:18

junfengfan 写了:你上面的例子是在openbsd4.5上面,你闲时请你再试试openbsd4.6,我感觉两者配置不太一样,我在openbsd4.6上配置总是不行~~~~~~~

抱歉是我的帖子没有说清楚,实际上我在最后说明的意思是,我就是用OpenBSD 4.6做的DHCPD和TFTP服务器测试,PXE成功启动时没有截图,所以就用了FAQ上4.5教程的文字,不过没有很大区别,请您自行检查一下规则。

ps: 我的确以前没有用PXE这种方式安装过OpenBSD, 本来觉得肯定没问题的,毕竟在FAQ里有详细的说明,如果FAQ的教程有问题,在misc里早就会有人提出来了。但是看到你到处撒提问帖,我就对FAQ的教程开始有点怀疑,最后决定自己试了一下,客户端在widnows的wmware里,DHCP和TFTP服务器就是家里一台安装OpenBSD 4.6的计算机,就用它实现了pxe安装的系统,至少我没有发现问题,我是验证过没有问题才发的帖子,请您自己在检查一下自己的设置,您情况描述的不太清楚,我也无能为力了,请您仔细看我上面的帖子。

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2010-02-17 12:34

junfengfan 写了:你上面的例子是在openbsd4.5上面,你闲时请你再试试openbsd4.6,我感觉两者配置不太一样,我在openbsd4.6上配置总是不行~~~~~~~
请你自己先仔细检查一下你的规则
你自己试试这样吧:
把你原来的规则最后的部分:

代码: 全选

subnet 192.168.20.0 netmask 255.255.255.0 {
option routers 192.168.20.1;
range 192.168.20.38 192.168.20.127;
host static-client {
hardware ethernet 22:33:44:55:66:77;
fixed-address 192.168.20.200;
}
[color=red]# filename "pxeboot";[/color]
host pxe-client {
# hardware ethernet 02:03:04:05:06:07;
hardware ethernet 00:13:d4:50:b6:19;
# default-lease-time 86400;
# max-lease-time 90000;
[color=blue]filename "pxeboot";[/color]
# option root-path "192.168.20.1:/tftpboot";
# option tftp-server-name "192.168.20.1";
next-server 192.168.20.1;
}
}

修改成:

代码: 全选

subnet 192.168.20.0 netmask 255.255.255.0 {
option routers 192.168.20.1;
[color=red]filename "pxeboot";[/color]
range 192.168.20.38 192.168.20.127;
host static-client {
hardware ethernet 22:33:44:55:66:77;
fixed-address 192.168.20.200;
}
host pxe-client {
# hardware ethernet 02:03:04:05:06:07;
hardware ethernet 00:13:d4:50:b6:19;
# default-lease-time 86400;
# max-lease-time 90000;
[color=blue]#filename "pxeboot";[/color]
# option root-path "192.168.20.1:/tftpboot";
# option tftp-server-name "192.168.20.1";
next-server 192.168.20.1;
}
}

注意,红色部分挪了位置(上移五行),并去除了注释符"#",将蓝色部分注释掉(这步实际上无所谓了。)

junfengfan
铜 Cu
帖子: 236
注册时间: 2010-02-03 18:37

帖子 junfengfan » 2010-02-20 15:39

我用一台openbsd做成服务器,按照你的步骤;用另一台笔记本做客户端,可以的;谢谢你们的热情帮助!

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 15 访客