博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Preparing Files for TFTP Net Booting
阅读量:4139 次
发布时间:2019-05-25

本文共 6846 字,大约阅读时间需要 22 分钟。

 

 

 

Also,  in the following doc, it introduce how to setup the tftpd

 

If your machine is connected to a local area network, you may be able to boot it over the network from another machine, using TFTP. If you intend to boot the installation system from another machine, the boot files will need to be placed in specific locations on that machine, and the machine configured to support booting of your specific machine.

You need to setup a TFTP server, and for many machines, a BOOTP server , or DHCP server.

BOOTP is an IP protocol that informs a computer of its IP address and where on the network to obtain a boot image. The DHCP (Dynamic Host Configuration Protocol) is a more flexible, backwards-compatible extension of BOOTP. Some systems can only be configured via DHCP.

The Trivial File Transfer Protocol (TFTP) is used to serve the boot image to the client. Theoretically, any server, on any platform, which implements these protocols, may be used. In the examples in this section, we shall provide commands for SunOS 4.x, SunOS 5.x (a.k.a. Solaris), and GNU/Linux.

[Note]  

To use the Pre-boot Execution Environment (PXE) method of TFTP booting, you will need a TFTP server with tsize support. On an Ubuntu or Debian GNU/Linux server, the atftpd and tftpd-hpa packages qualify; we recommend tftpd-hpa.

 

Setting up BOOTP server

There are two BOOTP servers available for GNU/Linux. The first is CMU bootpd. The other is actually a DHCP server: ISC dhcpd. In Ubuntu these are contained in the bootp and dhcp packages respectively.

To use CMU bootpd, you must first uncomment (or add) the relevant line in /etc/inetd.conf. On Debian GNU/Linux or Ubuntu, you can run update-inetd --enable bootps, then /etc/init.d/inetd reload to do so. Just in case your BOOTP server does not run Debian or Ubuntu, the line in question should look like:

bootps  dgram  udp  wait  root  /usr/sbin/bootpd  bootpd -i -t 120

Now, you must create an /etc/bootptab file. This has the same sort of familiar and cryptic format as the good old BSD printcaptermcap, and disktab files. See thebootptab manual page for more information. For CMU bootpd, you will need to know the hardware (MAC) address of the client. Here is an example /etc/bootptab:

client:/  hd=/tftpboot:/  bf=tftpboot.img:/  ip=192.168.1.90:/  sm=255.255.255.0:/  sa=192.168.1.1:/  ha=0123456789AB:

You will need to change at least the “ha” option, which specifies the hardware address of the client. The “bf” option specifies the file a client should retrieve via TFTP; see  for more details.

By contrast, setting up BOOTP with ISC dhcpd is really easy, because it treats BOOTP clients as a moderately special case of DHCP clients. Some architectures require a complex configuration for booting clients via BOOTP. If yours is one of those, read the section . Otherwise, you will probably be able to get away with simply adding the allow bootp directive to the configuration block for the subnet containing the client, and restart dhcpd with /etc/init.d/dhcpd restart.

Setting up a DHCP server

One free software DHCP server is ISC dhcpd. In Ubuntu, this is available in the dhcp package. Here is a sample configuration file for it (usually /etc/dhcpd.conf):

option domain-name "example.com";option domain-name-servers ns1.example.com;option subnet-mask 255.255.255.0;default-lease-time 600;max-lease-time 7200;server-name "servername";subnet 192.168.1.0 netmask 255.255.255.0 {  range 192.168.1.200 192.168.1.253;  option routers 192.168.1.1;}host clientname {  filename "/tftpboot/tftpboot.img";  server-name "servername";  next-server servername;  hardware ethernet 01:23:45:67:89:AB;  fixed-address 192.168.1.90;}

Note: the new (and preferred) dhcp3 package uses /etc/dhcp3/dhcpd.conf.

In this example, there is one server servername which performs all of the work of DHCP server, TFTP server, and network gateway. You will almost certainly need to change the domain-name options, as well as the server name and client hardware address. The filename option should be the name of the file which will be retrieved via TFTP.

After you have edited the dhcpd configuration file, restart it with /etc/init.d/dhcpd restart.

Enabling PXE Booting in the DHCP configuration

Here is another example for a dhcp.conf using the Pre-boot Execution Environment (PXE) method of TFTP.

option domain-name "example.com";default-lease-time 600;max-lease-time 7200;allow booting;allow bootp;# The next paragraph needs to be modified to fit your casesubnet 192.168.1.0 netmask 255.255.255.0 {  range 192.168.1.200 192.168.1.253;  option broadcast-address 192.168.1.255;# the gateway address which can be different# (access to the internet for instance)  option routers 192.168.1.1;# indicate the dns you want to use  option domain-name-servers 192.168.1.3;}group { next-server 192.168.1.3; host tftpclient {# tftp client hardware address  hardware ethernet  00:10:DC:27:6C:15;  filename "/tftpboot/pxelinux.0"; }}

Note that for PXE booting, the client filename pxelinux.0 is a boot loader, not a kernel image (see  below).

Enabling the TFTP Server

To get the TFTP server ready to go, you should first make sure that tftpd is enabled. This is usually enabled by having something like the following line in/etc/inetd.conf:

tftp dgram udp wait nobody /usr/sbin/tcpd in.tftpd /tftpboot

Ubuntu packages will in general set this up correctly by default when they are installed.

Look in that file and remember the directory which is used as the argument of in.tftpd; you'll need that below. The -l argument enables some versions ofin.tftpd to log all requests to the system logs; this is useful for diagnosing boot errors. If you've had to change /etc/inetd.conf, you'll have to notify the running inetd process that the file has changed. On an Ubuntu or Debian machine, run /etc/init.d/inetd reload; on other machines, find out the process ID for inetd, and run kill -HUP inetd-pid.

Move TFTP Images Into Place

Next, place the TFTP boot image you need, as found in , in the tftpd boot image directory. Generally, this directory will be /tftpboot. You'll have to make a link from that file to the file which tftpd will use for booting a particular client. Unfortunately, the file name is determined by the TFTP client, and there are no strong standards.

For PXE booting, everything you should need is set up in the netboot/netboot.tar.gz tarball. Simply extract this tarball into the tftpd boot image directory. Make sure your dhcp server is configured to pass /pxelinux.0 to tftpd as the filename to boot.

 

 

PS: To let dhcp work automatically, 

然后,设置静态ip地址,同时修改mac。如果不需要修改mac,相关行无须填写。

打开“/etc/network/interfaces”,如下:
sudo gedit /etc/network/interfaces
添加如下几行:

# eth0自动连接

auto eth0
# 下面一行说明使用的是静态IP地址
iface eth0 inet static
# 下面一行填写要设置的本机静态IP
address xxx.xxx.xxx.xxx
# 下面一行填写相应的的子网掩码
netmask xxx.xxx.xxx.xxx
# 下面一行填写相应的网关
gateway xxx.xxx.xxx.xxx

 

转载地址:http://kemvi.baihongyu.com/

你可能感兴趣的文章
《Wireshark数据包分析实战 》 Chris Sanders
查看>>
《曾国藩传》 董丛林 (做人要学曾国藩, 做事要学张居正)
查看>>
在Windows下如何练习Linux下的vim? (为即将步入IT行业的兄弟和妹子介绍一个工具)
查看>>
大餐分享: Windows环境下学习linux的命令行,编辑器vim, 脚本和Git的绝佳工具---msysGit(才十几M)
查看>>
如何让程序只有一个实例运行(用tftp时的感想)?
查看>>
VC++6.0环境下sqlite数据库编程入门 (是该走进数据库里面了)
查看>>
如何搭建tftp服务器?
查看>>
ftp常用简易命令实战
查看>>
要学会写小程序来完成自己想要的功能
查看>>
An extremely simple ftp-like ftp
查看>>
fread的第二个参数和第三个参数可以互换吗---为什么fread容易返回0 ?
查看>>
手机内存卡应该叫外存卡
查看>>
哈希表之简易数学原理和简易实现(史上最简单易懂的哈希表介绍)
查看>>
Restep into the English World
查看>>
kk音标导读(上):赖世雄老师26个英语字母导读示范 (附我备注)
查看>>
memset, string, 段错误?---谈谈我遇到的memset误用
查看>>
gdb调试器学习与总结(熟能生巧)
查看>>
今天下午desktop不能和某嵌入式设备通信---找到原因后, 快笑晕了。
查看>>
kk音标导读(下):赖世雄老师26个英语字母导读示范 (附我备注)
查看>>
赖世雄精准美国英语音标发音指南01 (附我备注)
查看>>