Since I'm doing it all in VM's on the same ESX server it's a virtual switch, no routing. DHCP/BOOTP is a broadcast, so you'd have to have a local server or a router that could forward DHCP broadcast requests. If you configure the PXE BIOS with the address and gateway then no special router config should be required. Just let port 69 through for TFTP. /opt/bootlocal.sh on the PXE server has this:
/usr/bin/udpsvd -E 0 69 tftpd /opt/tftproot &
/opt/dhcpd.sh &
/opt/lighttpd.sh &
dhcpd.sh handles bootp:
#!/bin/sh
#
/usr/local/sbin/dhcpd -cf /usr/local/etc/bootp.conf -lf /mnt/sda1/tce64/bootp.leases \
-tf /var/log/bootp.log -pf /var/run/bootp.pid eth0 >>/var/log/bootp-sh.log 2>&1 &
lighttpd.sh serves up extensions from the local tce directory:
#!/bin/sh
#
HTTPD=/usr/local/sbin/lighttpd
HTTPD_ROOT=/mnt/sda1/tce64
HTTPD_CONF=$HTTPD_ROOT/lighttpd.conf
cat >$HTTPD_CONF <<EOF
server.document-root = "/"
server.bind = "192.168.1.10"
server.port = 80
server.username = "nobody"
server.groupname = "nogroup"
server.chroot = "$HTTPD_ROOT"
EOF
$HTTPD -D -m /usr/local/lib/lighttpd -f $HTTPD_CONF &
A boot file in pxelinux.cfg looks like this (to start a PostgreSQL server):
DEFAULT pxe
LABEL pxe
KERNEL pxelinux.cfg/default-boot/vmlinuz64-7.2
INITRD pxelinux.cfg/default-boot/rootfs64-7.2.gz,pxelinux.cfg/default-boot/modules64-7.2.gz,pxelinux.cfg/default-boot/my-pgsql-data.gz
APPEND printk.time=1 syslog quiet noswap nozswap tce=/ httplist=192.168.1.10:/pgsql.lst
The third initrd file my-pgsql-data.gz is a "mydata" style filesystem for the target system but in compressed CPIO format.