这几天在研究clonezilla的PXE网络启动,因为公司的DHCP服务器无法改动,所以就想了个其他法子来搭建
1.安装pxe-pdhcp
使用pxe-pdhcp来做转发,这个工具很好用,支持跨网段的PXE启动
https://github.com/frsyuki/pxe-pdhcp 这个是链接
先下载安装包
pxe-pdhcp-master.zip
解压上传到linux服务器
cd pxe-pdhcp-master
make
编译完成,然后启动
pxe-pdhcp-master/pxe-pdhcp -l 0.0.0.0 -b 255.255.255.0 -t 192.168.1.2 -d pxelinux.0
其中-d是debug模式,也就是会有很多输出信息,-t 后面加tftp服务器,命令可能会提示“address already in use”,检查端口占用情况“netstat -apn”,kill掉占用的程序
usage: pxe-pdhcp [-d] [-i interface]
[-l listen address] [-t tftp address] [-b broadcast address]
这些是替代DHCP配置的内容,很方便
2.配置clonezilla PXE启动文件
可以参考http://blog.csdn.net/wmj2004/article/details/53215906
我做了以下改动,把NFS移到windows服务器上去了,因为我所有的镜像都在windows服务器上面存放,
另外修改了default文件
++++++++++++++++++++++++++++++++++++++++
DEFAULT vesamenu.c32
MENU TITLE === PXE Boot Server ===
menu color title 1;36;44 #ffffffff #00000000 std
LABEL fog.local
localboot 0
MENU DEFAULT
MENU LABEL Boot from hard disk
TEXT HELP
Boot from the local hard drive.
If you are unsure, select this option.
ENDTEXT
LABEL fog.clonezilla
kernel /clonezilla/vmlinuz
append initrd=/clonezilla/initrd.img boot=live username=user union=overlay config components quiet noswap edd=on nomodset nodmraid locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt netboot=nfs nfsroot=serverIP:/clonezilla
MENU LABEL Run Clonezilla
TEXT HELP
This mode will allow you run Clonezilla to Backup/Restore OS!
ENDTEXT
PROMPT 0
TIMEOUT 300
+++++++++++++++++++++++++++++++++++++++++
注意这里的union一定要用overlay,否则会出现aufs的报错
具体可以参考这篇文章,https://sourceforge.net/p/clonezilla/discussion/Clonezilla_live/thread/0f8505b0/?limit=25
3.tftp服务器搭建
编辑TFTP服务器的配置文件/etc/xinetd.d/tftp
+++++++++++++++++++++++++
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
+++++++++++++++++++++++++++++++
把路径改为了/tftpboot,重启xinetd服务,我的server不知道怎么搞的,xinetd启动一直失败,必须手动启动一下,systemctl start xinetd.services
并且需要关闭firewall,iptables,selinux
4.nfs服务器的搭建
windows创建nfs可以参考这篇文章,https://wenku.baidu.com/view/355c8160647d27284a735125.html
参考的文章:http://blog.csdn.net/wmj2004/article/details/53215906
https://wenku.baidu.com/view/aafb143910661ed9ad51f3e0.html
https://sourceforge.net/p/clonezilla/discussion/Clonezilla_live/thread/0f8505b0/?limit=25
https://wenku.baidu.com/view/355c8160647d27284a735125.html