{"id":60,"date":"2012-12-16T16:05:52","date_gmt":"2012-12-16T15:05:52","guid":{"rendered":"http:\/\/esxi-v34\/wordpress\/?p=60"},"modified":"2013-01-27T12:29:15","modified_gmt":"2013-01-27T11:29:15","slug":"installation-notes-on-setting-up-a-bootserver","status":"publish","type":"post","link":"\/wordpress\/freebsd\/installation-notes-on-setting-up-a-bootserver\/","title":{"rendered":"Setting up a PXE bootserver"},"content":{"rendered":"<p>Notes on installing a PXE bootserver that boots diskless terminalservers by use of nfsroot. Three machines have been set up for this:<\/p>\n<table>\n<tr>\n<th>Name<\/th>\n<th>IP<\/th>\n<tr>\n<td>bootserver<\/td>\n<td>192.168.65.1<\/td>\n<tr>\n<td>ts1<\/td>\n<td>192.168.65.11<\/td>\n<tr>\n<td>ts2<\/td>\n<td>192.168.65.12<\/td>\n<\/table>\n<h3>bootserver<\/h3>\n<p>A typical install of FreeBSD have been used. Only including base, generic kernel and lib32. After it&#8217;s installed, <code>freebsd-update<\/code> have been applied to fetch the latest patches. That leaves us with a base from which to build the terminalservers.<\/p>\n<p>By creating the dump on a different filesystem, it won&#8217;t be included (in the dump). If another filesystem cannot be mounted by nfs or usb or whatnot, the nodump flag can be set on the resulting dump by use of for instance <code>chflags nodump \/tmp\/bootserver.root<\/code><\/p>\n<h3>Create nfsroot filesystem<\/h3>\n<p>This entire process can be copied to create additional terminalservers.<\/p>\n<pre><code>dump -0Laf \/mnt\/bootserver.root \/\r\nmkdir \/ts-rootfs\/TS1\r\ncd \/ts-rootfs\/TS1\r\nrestore -xvf \/mnt\/bootserver.root<\/code><\/pre>\n<p>\/var needs to be mounted on a virtual ramdisk device so we don&#8217;t need the contents of \/var on the terminalserver. \/var itself still must exist in order to be able to mount a filesystem on top of it.<\/p>\n<pre><code>rm -rf \/ts-rootfs\/TS1\/var\/*<\/code><\/pre>\n<p>Back to the bootserver and configure necessary daemons.<\/p>\n<h3>Set up NFS server<\/h3>\n<h4>\/etc\/exports<\/h4>\n<pre><code>\/ts-rootfs\/TS1 -maproot=root -alldirs -network=192.168.65.11\/32\r\n\/ts-rootfs\/TS2 -maproot=root -alldirs -network=192.168.65.12\/32<\/code><\/pre>\n<h4>\/etc\/rc.conf<\/h4>\n<pre><code>rpcbind_enable=\"YES\"\r\nnfs_server_enable=\"YES\"\r\nmountd_flags=\"-r\"\r\nmountd_enable=\"YES\"<\/code><\/pre>\n<h3>Set up TFTP server<\/h3>\n<pre><code>mkdir \/tftpboot<\/code><\/pre>\n<h4>\/etc\/rc.conf<\/h4>\n<p>I have also set up a NIC for management on another network so this is in order for inetd to only listen on the pxeboot lan.<\/p>\n<pre><code>inetd_enable=\"YES\"\r\ninetd_flags=\"-a 192.168.65.1\"<\/code><\/pre>\n<h4>\/etc\/inetd.conf<\/h4>\n<p>Uncomment the tftp line for ipv4<\/p>\n<pre><code>tftp   dgram   udp     wait    root    \/usr\/libexec\/tftpd      tftpd -l -s \/tftpboot<\/code><\/pre>\n<p>Then create a link to the bootloader<\/p>\n<pre><code>cd \/tftpboot\r\nln \/boot\/pxeboot<\/code><\/pre>\n<h3>Set up DHCP server<\/h3>\n<p>This is a port that needs to be installed. I simply fetched it from my package building server.<\/p>\n<pre><code>pkg_add http:\/\/esxi-v4\/All\/isc-dhcp42-server-4.2.4_2.tbz<\/code><\/pre>\n<h4>\/usr\/local\/etc\/dhcpd.conf<\/h4>\n<pre><code>default-lease-time 3600;\r\nmax-lease-time 86400;\r\nddns-update-style none;\r\n\r\nsubnet 192.168.65.0 netmask 255.255.255.0 {\r\noption domain-name \"ts.local\";\r\n\r\nnext-server 192.168.65.1;\r\n\r\nfilename \"pxeboot\";\r\n\r\ndeny unknown-clients;\r\n}\r\n\r\nhost ts01 {\r\nhardware ethernet 00:0c:29:eb:52:78;\r\nfixed-address 192.168.65.11;\r\noption root-path \"192.168.65.1:\/ts-rootfs\/TS1\/\";\r\n}\r\n\r\nhost ts02 {\r\n  hardware ethernet 00:0c:29:2d:6b:e3;\r\n  fixed-address 192.168.65.12;\r\n  option root-path \"192.168.65.1:\/ts-rootfs\/TS2\/\";\r\n}<\/code><\/pre>\n<h3>Set up NTP server<\/h3>\n<p>In distributed computing it&#8217;s important that the time is the same on all involved servers. Thus bootserver will serve time to the terminalservers. If it&#8217;s also connected to the Internet, it can ask other ntp servers for time. If not, it doesn&#8217;t matter if the time is correct. What matters is that it is the same on the terminalservers.<\/p>\n<h4>\/etc\/rc.conf<\/h4>\n<pre><code>ntpd_enable=\"YES\"<\/code><\/pre>\n<p>Now the terminalservers are ready for booting but a couple of preparations need to be done on them before that. These preparations need to be done on all terminalservers that have been created.<\/p>\n<h3>Prepare \/ts-rootfs\/TS1<\/h3>\n<pre><code>chroot \/ts-rootfs\/TS1<\/code><\/pre>\n<h4>\/etc\/rc.conf<\/h4>\n<pre><code>hostname=\"ts01.ts.local\"\r\ndefaultroute_delay=0     # (The terminalservers are setup without a defaultroute)\r\nsshd_enable=\"YES\"\r\nntpd_enable=\"YES\"<\/code><\/pre>\n<h4>\/etc\/fstab<\/h4>\n<pre><code>192.168.65.1:\/ts-rootfs\/TS1 \/ nfs rw 0 0<\/code><\/pre>\n<p>The \/var filesystem needs to be put on a virtual ramdrive device by the following. If you find your terminalservers \/var filesystem growing you need to increase its size. I&#8217;ve chosen 64Mb which is plenty thus far.<\/p>\n<pre><code>mkdir -p \/conf\/base\/var\r\necho \"64m\" &gt; \/conf\/base\/var\/md_size<\/code><\/pre>\n<h4>\/etc\/rc.shutdown.local<\/h4>\n<p> (run this to create the initial snapshot)<br \/>\nAll contents of \/var will be lost when the terminalserver reboots. To remedy this I&#8217;ve added <code>\/bin\/sh \/etc\/rc.shutdown.local<\/code> to root&#8217;s crontab on a daily schedule.<\/p>\n<pre><code>mv -f \/conf\/base\/var.cpio.gz \/conf\/base\/var.cpio.gz.old\r\ntar -cf \/conf\/base\/var.cpio.gz -C \/ --format cpio --gzip var<\/pre>\n<p><\/code><\/p>\n<h4>\/etc\/periodic.conf<\/h4>\n<pre><code>daily_output=\"\/var\/log\/daily.log\"\r\nweekly_output=\"\/var\/log\/weekly.log\"\r\nmonthly_output=\"\/var\/log\/monthly.log\"\r\ndaily_status_security_output=\"\/var\/log\/dailysecurity.log\"<\/code><\/pre>\n<h4>\/etc\/ntp.conf<\/h4>\n<pre><code>server 192.168.65.1<\/code><\/pre>\n<p>In order to access the terminal servers, ssh keys should be set up. It's also advisable to put all hostnames in \/etc\/hosts on bootserver and the terminalservers.<\/p>\n<h3>Setup SSH keys<\/h3>\n<p>On bootserver<\/p>\n<pre><code>ssh-keygen -t dsa\r\nssh 192.168.65.11 \"mkdir .ssh; chmod 700 .ssh\"\r\nscp .ssh\/id_dsa.pub 192.168.65.11:.ssh\/authorized_keys\r\nssh 192.168.65.12 \"mkdir .ssh; chmod 700 .ssh\"\r\nscp .ssh\/id_dsa.pub 192.168.65.12:.ssh\/authorized_keys<\/code><\/pre>\n<p>\/etc\/hosts looks like this that need to be synced to all servers:<\/p>\n<pre><code>192.168.65.1     bootserver bootserver.ts.local\r\n192.168.65.11    ts01 ts01.ts.local\r\n192.165.65.12    ts02 ts02.ts.local\r\n<\/code><\/pre>\n<p>Now you have a terminalserver farm that can easily be expanded with endless possobilities of distributed computing! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Notes on installing a PXE bootserver that boots diskless terminalservers by use of nfsroot. Three machines have been set up for this: Name IP bootserver 192.168.65.1 ts1 192.168.65.11 ts2 192.168.65.12 bootserver A typical install of FreeBSD have been used. Only including base, generic kernel and lib32. After it&#8217;s installed, freebsd-update have been applied to fetch <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"\/wordpress\/freebsd\/installation-notes-on-setting-up-a-bootserver\/\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[31,25,24,13,23],"_links":{"self":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/60"}],"collection":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":14,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":72,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/60\/revisions\/72"}],"wp:attachment":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}