特殊:Badtitle/NS100:Installation/QuickNetboot:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Oneleaf留言 | 贡献
无编辑摘要
Wikibot留言 | 贡献
无编辑摘要
 
(未显示2个用户的9个中间版本)
第1行: 第1行:
{{From|https://help.ubuntu.com/community/Installation/QuickNetboot}}
{{From|https://help.ubuntu.com/community/Installation/QuickNetboot}}
{{Languages|php5}}
{{Languages|UbuntuHelp:Installation/QuickNetboot}}
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. They are for installing Ubuntu 8.04, but with minor modifications in step 2 they should work for other Ubuntu releases as well.   
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 ==
== 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.
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.
 
You might want to check if TFTP service is already enabled on your server, e.g. via inetd (''/etc/inetd.conf''; use ''update-inetd --disable tftp'' to turn off the inetd service).
== DHCP/TFTP server installation ==
== DHCP/TFTP server installation ==
=== Prepare ===
=== Prepare ===
1. install required software
0 become the root user
<pre><nowiki>
<pre><nowiki>
sudo apt-get install dnsmasq atftp atftpd
sudo -i
</nowiki></pre>
</nowiki></pre>
<ol><li>install required software</li></ol>


1.#2 download and unpack the netboot tarball
<pre><nowiki>
<pre><nowiki>
sudo mkdir /tftpboot
apt-get install dnsmasq atftp
</nowiki></pre>
1.#2 download and unpack the netboot tarball
<pre><nowiki>
mkdir /tftpboot
cd /tftpboot
cd /tftpboot
sudo wget http://archive.ubuntu.com/ubuntu/dists/dapper/main/installer-i386/current/images/netboot/netboot.tar.gz
wget http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/netboot.tar.gz
sudo tar zxf netboot.tar.gz
tar zxf netboot.tar.gz
sudo chown -R nobody: .
chown -R nobody: .
</nowiki></pre>
</nowiki></pre>
 
1.#3 tell ''dnsmasq'' to assign addresses starting from <BEGIN_IP_RANGE> until <END_IP_RANGE>, and to enable the TFTP service for BOOTP (PXE). The default gateway must be put in <DEFAULT_GW>, and the dns server in <DNS_SERVER> (both of these may be omitted if the host running ''dnsmasq'' is also the LAN's default gateway and DNS server). Append this to /etc/dnsmasq.conf with your favorite editor:
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><nowiki>
<pre><nowiki>
dhcp-range=<BEGIN_IP_RANGE>,<END_IP_RANGE>,12h
dhcp-range=<BEGIN_IP_RANGE>,<END_IP_RANGE>,12h
dhcp-boot=pxelinux.0,<SERVER_IP>
enable-tftp
tftp-root=/tftpboot
dhcp-boot=pxelinux.0
dhcp-option=3,<DEFAULT_GW>
dhcp-option=3,<DEFAULT_GW>
dhcp-option=6,<DNS_SERVER>
dhcp-option=6,<DNS_SERVER>
</nowiki></pre>
</nowiki></pre>
An example append is shown here:
An example append is shown here:
<pre><nowiki>
<pre><nowiki>
dhcp-range=192.168.0.20,192.168.0.30,12h
dhcp-range=192.168.0.20,192.168.0.30,12h
dhcp-boot=pxelinux.0,192.168.0.10
enable-tftp
tftp-root=/tftpboot
dhcp-boot=pxelinux.0
dhcp-option=3,192.168.0.1
dhcp-option=3,192.168.0.1
dhcp-option=6,192.168.0.1
dhcp-option=6,192.168.0.1
</nowiki></pre>
</nowiki></pre>
Then restart dnsmasq with the following command:
Then restart dnsmasq with the following command:
<pre><nowiki>
<pre><nowiki>
sudo invoke-rc.d dnsmasq restart
invoke-rc.d dnsmasq restart
</nowiki></pre>
</nowiki></pre>
 
1.#4 check that your firewall is not blocking DHCP/TFTP traffic (UDP) or, alternatively, just turn off the firewall altogether
1.#4 tell ''atftpd'' to run as a server directly, not through ''inetd''
<pre><nowiki>
<pre><nowiki>
sudo sed -e '/USE_INETD=/s/true/false/' -i /etc/default/atftpd
iptables -F
 
iptables -X
sudo invoke-rc.d inetd stop
iptables -P INPUT ACCEPT
sudo invoke-rc.d xinetd stop
iptables -P FORWARD ACCEPT
sudo invoke-rc.d atftpd restart
iptables -P OUTPUT ACCEPT
</nowiki></pre>
iptables -t mangle -F 2>/dev/null
 
iptables -t mangle -X 2>/dev/null
1.#5 check that your firewall is not blocking DHCP/TFTP traffic (UDP) or, alternatively, just turn off the firewall altogether
iptables -t nat -F 2>/dev/null
<pre><nowiki>
iptables -t nat -X 2>/dev/null
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
</nowiki></pre>
</nowiki></pre>
 
1.#5 everything is ready to run now. Time to verify if everything really works.
1.#6 everything is ready to run now. Time to verify if everything really works.
 
=== Verify ===
=== Verify ===
<ol><li>check ''iptables'', if you turned it off, there should be no rules and the policy should be ''ACCEPT''</li></ol>


1. check ''iptables'', if you turned it off, there should be no rules and the policy should be ''ACCEPT''
<pre><nowiki>
<pre><nowiki>
sudo iptables -L
iptables -L
sudo iptables -t nat -L
iptables -t nat -L
sudo iptables -t mangle -L
iptables -t mangle -L
</nowiki></pre>  
</nowiki></pre>  
 
1.#2 check if ''dnsmasq'' is listening on the ''bootp'' port 67
1.#2 check if ''dnsmasq'' is listening on the ''bootp'' port 67
<pre><nowiki>
<pre><nowiki>
netstat -nulp | grep '67.*dnsmasq' # should display udp  0  0 0.0.0.0:67  0.0.0.0:*  <some num>/dnsmasq
netstat -nulp | grep '67.*dnsmasq' # should display udp  0  0 0.0.0.0:67  0.0.0.0:*  <some num>/dnsmasq
</nowiki></pre>
</nowiki></pre>
 
1.#3 check if ''dnsmasq'' is listening on the ''tftp'' port 69
1.#3 check if ''atftpd'' is listening on the ''tftp'' port 69
<pre><nowiki>
<pre><nowiki>
netstat -nulp | grep atftpd # should display udp  0  0 0.0.0.0:69  0.0.0.0:*  <some num>/atftpd
netstat -nulp | grep '69.*dnsmasq' # should display udp  0  0 0.0.0.0:69  0.0.0.0:*  <some num>/dnsmasq
</nowiki></pre>
</nowiki></pre>
 
1.#4 test if you can get the PXE boot kernel via tftp.
1.#4 test if you can get the PXE boot kernel via tftp, replace SERVER_IP with your own ip address.
<pre><nowiki>
<pre><nowiki>
cd /tmp
cd /tmp
echo 'get pxelinux.0' | atftp SERVER_IP
echo 'get pxelinux.0' | atftp localhost


ls -l pxelinux.0 # should display a 13156-byte file
ls -l pxelinux.0 # should display a ~14kB file
</nowiki></pre>
</nowiki></pre>
=== Boot the client ===
=== 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 .
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? ===
=== Problems? ===
<ol><li>check syslog (''/var/log/syslog'')
</li><li>use ''ethereal'' (wireshark) to inspect network traffic</li></ol>


1. check syslog (''/var/log/syslog'')
1. use ''ethereal'' to inspect network traffic


[[category:UbuntuHelp]]
[[category:UbuntuHelp]]

2010年5月19日 (三) 22:51的最新版本

{{#ifexist: :Installation/QuickNetboot/zh | | {{#ifexist: Installation/QuickNetboot/zh | | {{#ifeq: {{#titleparts:Installation/QuickNetboot|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Installation/QuickNetboot|1|-1|}} | zh | | }}

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. They are for installing Ubuntu 8.04, 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. You might want to check if TFTP service is already enabled on your server, e.g. via inetd (/etc/inetd.conf; use update-inetd --disable tftp to turn off the inetd service).

DHCP/TFTP server installation

Prepare

0 become the root user

sudo -i
  1. install required software
apt-get install dnsmasq atftp

1.#2 download and unpack the netboot tarball

mkdir /tftpboot
cd /tftpboot
wget http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/netboot.tar.gz
tar zxf netboot.tar.gz
chown -R nobody: .

1.#3 tell dnsmasq to assign addresses starting from <BEGIN_IP_RANGE> until <END_IP_RANGE>, and to enable the TFTP service for BOOTP (PXE). The default gateway must be put in <DEFAULT_GW>, and the dns server in <DNS_SERVER> (both of these may be omitted if the host running dnsmasq is also the LAN's default gateway and DNS server). Append this to /etc/dnsmasq.conf with your favorite editor:

dhcp-range=<BEGIN_IP_RANGE>,<END_IP_RANGE>,12h
enable-tftp
tftp-root=/tftpboot
dhcp-boot=pxelinux.0
dhcp-option=3,<DEFAULT_GW>
dhcp-option=6,<DNS_SERVER>

An example append is shown here:

dhcp-range=192.168.0.20,192.168.0.30,12h
enable-tftp
tftp-root=/tftpboot
dhcp-boot=pxelinux.0
dhcp-option=3,192.168.0.1
dhcp-option=6,192.168.0.1

Then restart dnsmasq with the following command:

invoke-rc.d dnsmasq restart

1.#4 check that your firewall is not blocking DHCP/TFTP traffic (UDP) or, alternatively, just turn off the firewall altogether

iptables -F
iptables -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t mangle -F 2>/dev/null
iptables -t mangle -X 2>/dev/null
iptables -t nat -F 2>/dev/null
iptables -t nat -X 2>/dev/null

1.#5 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
iptables -L
iptables -t nat -L
iptables -t mangle -L

1.#2 check if dnsmasq is listening on the bootp port 67

netstat -nulp | grep '67.*dnsmasq' # should display udp  0  0 0.0.0.0:67  0.0.0.0:*  <some num>/dnsmasq

1.#3 check if dnsmasq is listening on the tftp port 69

netstat -nulp | grep '69.*dnsmasq' # should display udp  0  0 0.0.0.0:69  0.0.0.0:*  <some num>/dnsmasq

1.#4 test if you can get the PXE boot kernel via tftp.

cd /tmp
echo 'get pxelinux.0' | atftp localhost

ls -l pxelinux.0 # should display a ~14kB file

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)
  2. use ethereal (wireshark) to inspect network traffic