UbuntuHelp:Installation/QuickNetboot
来自Ubuntu中文
Oneleaf(讨论 | 贡献)2007年5月13日 (日) 11:43的版本 (New page: {{From|https://help.ubuntu.com/community/Installation/QuickNetboot}} {{Languages|php5}} There is more than one way to install Ubuntu via netboot, search for ''netboot'' in the Ubuntu wiki....)
There is more than one way to install Ubuntu via netboot, search for netboot in the Ubuntu wiki.
This guide aims to give simple, complete and verifiable instructions to get netboot working in a matter of minutes. The server is running Dapper and the instructions are for installing Dapper, but with minor modifications in step 2 they should work for other Ubuntu releases as well.
Before you begin
There should be no other DHCP servers running in the subnet. You might succeed with two servers as well (as I did), but be warned.
DHCP/TFTP server installation
Prepare
1. install required software
sudo apt-get install dnsmasq atftp atftpd </code> 1.#2 download and unpack the netboot tarball <pre> sudo mkdir /tftpboot cd /tftpboot sudo wget http://archive.ubuntu.com/ubuntu/dists/dapper/main/installer-i386/current/images/netboot/netboot.tar.gz sudo tar zxf netboot.tar.gz sudo chown -R nobody: . </code> 1.#3 tell ''dnsmasq'' to assing addresses starting from <BEGIN_IP_RANGE> until <END_IP_RANGE>, put the servers ip address in <SERVER_IP>, the default gateway must be put in <DEFAULT_GW>, and the dns server in <DNS_SERVER>. Append this to /etc/dnsmasq.conf with your favorite editor: <pre> dhcp-range=<BEGIN_IP_RANGE>,<END_IP_RANGE>,12h dhcp-boot=pxelinux.0,<SERVER_IP> dhcp-option=3,<DEFAULT_GW> dhcp-option=6,<DNS_SERVER> </code> An example append is shown here: <pre> dhcp-range=192.168.0.20,192.168.0.30,12h dhcp-boot=pxelinux.0,192.168.0.10 dhcp-option=3,192.168.0.1 dhcp-option=6,192.168.0.1 </code> Then restart dnsmasq with the following command: <pre> sudo invoke-rc.d dnsmasq restart </code> 1.#4 tell ''atftpd'' to run as a server directly, not through ''inetd'' <pre> sudo sed -e '/USE_INETD=/s/true/false/' -i /etc/default/atftpd sudo invoke-rc.d inetd stop sudo invoke-rc.d xinetd stop sudo invoke-rc.d atftpd restart </code> 1.#5 check that your firewall is not blocking DHCP/TFTP traffic (UDP) or, alternatively, just turn off the firewall altogether <pre> sudo iptables -F sudo iptables -X sudo iptables -P INPUT ACCEPT sudo iptables -P FORWARD ACCEPT sudo iptables -P OUTPUT ACCEPT sudo iptables -t mangle -F 2>/dev/null sudo iptables -t mangle -X 2>/dev/null sudo iptables -t nat -F 2>/dev/null sudo iptables -t nat -X 2>/dev/null </code> 1.#6 everything is ready to run now. Time to verify if everything really works. === Verify === 1. check ''iptables'', if you turned it off, there should be no rules and the policy should be ''ACCEPT'' <pre> sudo iptables -L sudo iptables -t nat -L sudo iptables -t mangle -L </code> 1.#2 check if ''dnsmasq'' is listening on the ''bootp'' port 67 <pre> netstat -nulp | grep '67.*dnsmasq' # should display udp 0 0 0.0.0.0:67 0.0.0.0:* <some num>/dnsmasq </code> 1.#3 check if ''atftpd'' is listening on the ''tftp'' port 69 <pre> netstat -nulp | grep atftpd # should display udp 0 0 0.0.0.0:69 0.0.0.0:* <some num>/atftpd </code> 1.#4 test if you can get the PXE boot kernel via tftp, replace SERVER_IP with your own ip address. <pre> cd /tmp echo 'get pxelinux.0' | atftp SERVER_IP ls -l pxelinux.0 # should display a 13156-byte file </code> === Boot the client === Enable PXE boot in BIOS or use Ethertool or whatever makes your client boot off the net. See e.g. http://syslinux.zytor.com/pxe.php . === Problems? === 1. check syslog (''/var/log/syslog'') 1. use ''ethereal'' to inspect network traffic [[category:UbuntuHelp]]