云联天下首页 |  登陆 |  注册 |  密码找回 |  关于我们 | 加入收藏 
首页技术资料系统/服务器→FreeBSD如何跑diskless? 【字号: 】 【背景色 杏仁黄 秋叶褐 胭脂红 芥末绿 天蓝 雪青 灰 银河白(默认色)

FreeBSD如何跑diskless?

网址来源:http://www.kehui.net发布时间: 2004-11-18 07:33:18
diskless 可以让 FreeBSD client PC 不需要硬碟就可以透过网路跑 FreeBSD。 
以下是两个成功的范例: 

======== 范例一 ========= 
From: client.bbs@csie.nctu.edu.tw (client) 
Newsgroups: tw.bbs.comp.386bsd 
Subject: Re: 如何使 diskless 的 pc 也能跑 freebsd 
Date: 27 May 1995 05:44:34 GMT 

(1) /etc/bootptab 建立diskless pc 的资料 
(2) /etc/servives 之bootpd 及 tftpd 是否打开 
(3) /etc/inetd.conf 之tftpd 是否打开 
(4) bootpd 放入 /etc/rc 差不多最后面 
    (若由inetd 来叫 ,时常抢不过 ka9q 的 bootpd) 
(5) 建立diskless pc 的 root file system. ex:/home/diskless1 
(6) 建立diskless pc 的swap file system. 
    建目录: ex:/home/swapfs 
    建swap file: 若diskless pc 的 ip: 140.115.10.222 
    则 touch /home/swapfs/swap.140.115.10.222 
(7) 把 freebsd 整个系统 拷贝至 /home/diskless1 
(8) export /home/diskless1 及 home/swapfs 给 diskless pc 
(9) 建立 /tftpboot/cfg.140.115.10.222 file 
    rootfs server:/home/diskless1 
    swapfs server:/home/swapfs 
    swapsize 32000 
(10)至/usr/src/sys/i386/boot/netboot make *.com 或 *.rom 
    make install 
    至/usr/mdec 取你要的 档案,开 diskless pc 

大致上,是如此! 自己再try ! 
======================== 

======== 范例二 ======== 
From: upleong@csie.nctu.edu.tw (Bills) 
Newsgroups: tw.bbs.comp.386bsd 
Subject: 设定diskless pc step by step 
Date: 16 Oct 1996 03:17:58 GMT 
  

给大家分享一下. 实在太好玩了。 

假设有两台机器, 
serverxy 是提供 diskless开机之server, ip: 140.113.141.191 
clientab 为 diskless之机器 ip: 140.113.141.204 
以下范例是在同一domain之下测试成功的(注: 好像是在不同domain也可以) 

所有要修改或增加的档案: 
a. /etc/inetd.conf 
b. /etc/services 
c. /tftpboot/cfg.xxx.yyy.zzz.www 
d. /etc/bootptab 
e. /swapfs/swap.xxx.yyy.zzz.www 
f. /sys/i386/conf/boot/netboot/*.com 
g. /rootfs/clientab ;这里是整个系统 
h. /etc/exports 

Server端的设定: 
(一)修改 /etc/inetd.conf 加入tftpd, 修改/etc/services 增加tftpd, 
bootpd的功能, 其中diskless的机器之root file system在 /rootfs/clientab。 
/etc/inetd.conf: 
tftp dgram udp wait nobody /usr/libexec/tftpd  
tftpd -l /tftpboot /rootfs/clientab 
/etc/services: 
tftp 69/tcp #Trivial File Transfer 
tftp 69/udp #Trivial File Transfer 
bootps 67/tcp dhcps #Bootstrap Protocol Server 
bootps 67/udp dhcps #Bootstrap Protocol Server 
bootpc 68/tcp dhcpc #Bootstrap Protocol Client 
bootpc 68/udp dhcpc #Bootstrap Protocol Client 

(三)以后启动 bootpd, 可以加入/etc/rc.local之中, 其设定档为/etc/bootptab。 
/etc/rc.local: 
/usr/libexec/bootpd -s /etc/bootptab 

(二)修改 bootptab, 把该改的该一下就好了, 详细之参数可参考handbook或man。 
/etc/bootptab: 
.default: 
:td=/tftpboot:hd=/clientab:bf=kernel: ;bf可设定boot file name 
:sm=255.255.255.0: 
:hn: 
:ds=140.113.1.1, 140.113.17.5: ;改为你的domain name server 
:ip=140.113.141.204: ;diskless client之 IP 
:gw=140.113.141.254: 
:dn=dorm10.nctu.edu.tw: ;改一下domain name 
:vm=rfc1048: 
clientab:ht=ether:ha=0000b46b0369:tc=.default: 
;ht为client的网路种类 
;ha为网路卡的hardware address 

(四)设定 tftpboot的 config file, 这是开机时 client从 server得到资讯的地方。 
档案名皆为 cfg.[client ip addr]。 eg. cfg.140.113.141.191 
/tftpboot/cfg.140.113.141.204: ;档案名记得要改... 
rootfs 140.113.141.191:/rootfs/clientab ;rootfs放在server的 
; /rootfs/clientab目录下 
swapfs 140.113.141.191:/swapfs ;swap file放在/swapfs下 
swapsize 20000 ;swap size in KB 
hostname clientab.dorm13.nctu.edu.tw ;client的host name 
ip 140.113.141.204 ;client的ip address 
kernel kernel ;kernel叫什么, 因为一开机就 
; 是NFS mount rootfs, kernel 
;要有NFS support 才能动 

(五)建一个 swap file的档案, 改名为 swap.[client IP address] 
> touch /swapfs/swap.140.113.141.204 

(六)把 client的file systems(/ /sbin /bin /root /etc ...)放在前面定义的地方 
(/rootfs/clientab)。Client可以和 server分享一部份的file systems, 如/usr, 
/usr/local等。但 rootfs等则不可以share。 
这里要怎样拷过去比较好呢? 我只想到把一些最基本的程式拷到rootfs, 等开 
机后再 mount freebsd.csie:/some/where/SNAP; sh upgrade.sh。 

(七)修改/etc/exports, 把client的file system及swap都打开给client。 
root partition记得要maproot, 否则会没效。 
/etc/exports: 
/rootfs/clientab /swapfs -maproot=root:wheel clientab.dorm13.nctu.edu.tw 

(八)启动tftp和bootpd。 
>kill -1 `cat /var/run/inetd.pid`; 
>/usr/libexec/bootpd -s /etc/bootptab; 

Client端的设定: 
因为是diskless的关系, 设定都跑到 server去了, 所以只要准备开机片就好了。剩下 
就是开机时打一下参数等。 
(一)建立网路开机所需的档案。 
cd /usr/src/sys/i386/boot/netboot 
修改Makefile中网路卡的参数, 如 NE_BASE=0x300等。 
make all install 
cd /usr/mdec; 把 *.com copy 至一DOS formatted的磁片上。 

(二)以DOS 开机 
看是那一张网路卡, 执行其中一个 .com的档案后, 它会自动去找bootpd的server. 
不过并不容易找到, 解决方法是手动给它填些参数。 
按ESC后会进到menu的command line, help 可以得到 help :P 
>server 140.113.141.191 
>ip 140.113.141.204 
>netmask 255.255.255.0 
>gateway 140.113.141.254 
>kernel kernel ;指定kernel name (eg. kernel.GENERIC) 
>flags c s ;等于boot: -c -s 
>autoboot 
顺利的话会看到loading kernel...等讯息, 可以开机进入single就成功了, 其他 
设定都是diskless PC的事情了。 
(http://www.fanqiang.com)
    进入【UNIX论坛

白衫 

相关新闻
v FreeBSD的硬盘分隔策略 2004-11-18 07:33:47
v Console中使用鼠标进行Copy-Paste 2004-11-18 07:34:39
v FreeBSD上的软件安装方法 2004-11-18 07:35:10
v 如何在 FreeBSD 上使用 CD 刻录机? 2004-11-18 07:35:34
v 如何使用IP Alias? 2004-11-18 07:35:58
v 如何设定防火墙IP Firewall 2004-11-18 07:36:20
v 如何使用NAT? 2004-11-18 07:37:08
v DOS命令全集 2005-11-02 00:29:18
v 小心!黑客利用Google挖掘你的隐私 2007-04-07 00:50:54
v 与黑客过招 给自己的网络设道安全防线 2007-04-07 00:53:23
  最新新闻
智慧家居
智慧家居颠覆传统智能家居
智慧云谷让智能家居变成有智慧的
智慧云谷引领智慧家居新生活
科技改变生活 智慧云谷智慧家居系
智慧家居领航者,智慧云谷助你玩
智能家居如何赢得市场美誉度?
智慧云谷智慧家居:创业者有无限
WiFi智能家居你还在用?这样的智
互联网+助推智能家居产业
智慧云谷为您打造真正的智能家居
智能家居产业需要的不是单品,而
新家如何选择开关?智慧云谷iWis
智能传感器-世界首款“智”为你的
智慧云谷开关智能安防智能空气质
智能开关品牌,如何选择智能开关
秋季干燥,智慧家居温湿度传感器
传感器助力智慧家居 感知爱家
iWiscloud智能触摸开关缔造家居装

  最新帖子
 ※室内空气污染的危害及  [sensor]
 ※超声波风速传感器在生  [sensor]
 ※这么冷清  [gabc111]
 ※手机APP操作有问题  [ssy11407]
 ※智慧云谷智慧家居将在  [cici]
 ※上传下载  [cici]
 ※下载智慧家居  [apple2008]
 ※秋季干燥,智慧家居温  [apple2008]
 ※智慧家居紧扣热点 安全  [apple2008]
 ※办公大楼如何智慧化管  [apple2008]
 ※智慧云谷工业自控的优  [apple2008]
 ※传感器助力智慧家居 感  [apple2008]
 ※智能开关品牌,如何选  [apple2008]
 ※智慧云谷开关智能安防  [apple2008]
 ※没有专业人员,如何安  [apple2008]
 ※烟台智慧云谷董事长任  [apple2008]
 ※互联网+助推智能家居产  [apple2008]
 ※WiFi智能家居你还在用  [apple2008]
 ※智慧云谷智慧家居:创  [apple2008]
 ※智能家居如何赢得市场  [apple2008]
钯碳回收 硝酸银回收 银浆回收 银焊条回收 回收银浆 氯化钯回收 氯化钯回收 氧化钯回收 回收硝酸钯 钯水回收价格 海绵钯回收 钯炭回收价格 回收镀金板 深圳钯碳回收 镇江氯化钯回收 杭州钯浆回收 银浆回收多少钱 回收钯碳公司 硝酸银的价格 那里有回收金 氯化钯回收价格 江苏擦银布回收 硝酸银价格 德州钯粉回收 银铜回收 回收钯粉 回收铂碳催化剂 佛山钯碳回收 金盐回收价格 海绵钯回收 钯碳高价回收 钯回收价格 钯炭回收