在 Ubuntu Server 14.04 安裝 PXE Server

在 Ubuntu Server 14.04 安裝 PXE Server 主要是想利用 PXE Server 搭配 Clonezilla 來備份及還原 Client 端作業系統。
參考網站:
How to Setup a PXE Server on Ubuntu
PXE Boot Server Installation Steps in Ubuntu Server VM – Ask Ubuntu

安裝 tftp 和 dhcp server 及一些所須的套件
# apt-get -y install tftpd-hpa isc-dhcp-server lftp openbsd-inetd inetutils-inetd
建立 dhcp server 設定檔
# vim /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.201 192.168.1.210;
    option subnet-mask 255.255.255.0;
    option routers 192.168.1.254;
    option broadcast-address 192.168.1.255;
    filename “pxelinux.0”;
    next-server 192.168.1.124;
}
[@more@]啟動 dhcpd server
# /etc/init.d/isc-dhcp-server restart
 * Stopping ISC DHCP server dhcpd                                        [fail]
 * Starting ISC DHCP server dhcpd                                        [ OK ]

檢查 dhcpd server 是否有正常啟動
# netstat -lu | grep boot
udp        0      0 *:bootps                *:*
udp        0      0 *:bootpc                *:*

修改 tftpd server 設定
# vim /etc/inetd.conf
加入下面一行
tftp    dgram   udp wait    root    /usr/sbin/in.tftpd  /usr/sbin/in.tftpd -s /var/lib/tftpboot

# update-inetd –enable BOOT
# /etc/init.d/openbsd-inetd restart
 * Restarting internet superserver inetd                                 [ OK ]
# /etc/init.d/tftpd-hpa restart

檢查 tftpd server 是否有正常啟動
# netstat -lu | grep tftp
udp        0      0 *:tftp                  *:*

安裝 syslinux
# apt-get install syslinux

複製設定檔到 /var/lib/tftpboot 目錄
# cp /usr/lib/syslinux/menu.c32  /var/lib/tftpboot
# cp /usr/lib/syslinux/vesamenu.c32 /var/lib/tftpboot
# cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot
# cp /usr/lib/syslinux/memdisk /var/lib/tftpboot
# cp /usr/lib/syslinux/mboot.c32 /var/lib/tftpboot
# cp /usr/lib/syslinux/chain.c32 /var/lib/tftpboot

建立 /var/lib/tftpboot/pxelinux.cfg 目錄,用來存放 PXE 開機時 Client 端的一些設定
# mkdir /var/lib/tftpboot/pxelinux.cfg

建立 PXE 開機的開機選單
# vim /var/lib/tftpboot/pxelinux.cfg/default
UI vesamenu.c32
TIMEOUT 300
MENU TITLE Welcom to Tou-Cheng Elementary School PXE Server System

LABEL local
  MENU LABEL Boot from local drive
  MENU DEFAULT
  localboot 0

開機畫面