Setting Up a PXE Server on an RPM-based OS: Difference between revisions

From Alteeve Wiki
Jump to navigation Jump to search
Line 19: Line 19:
Before you do though, you must take into account any other DHCP servers on your network. More to the point, you need to make sure there are no other DHCP servers on your network. The reason is that, when you try to PXE-boot a machine, it's up to the DHCP server that responds first to tell the client about the PXE server. If a "normal" DHCP server answers first, there simply won't be any instructions and your machine will not actually boot.
Before you do though, you must take into account any other DHCP servers on your network. More to the point, you need to make sure there are no other DHCP servers on your network. The reason is that, when you try to PXE-boot a machine, it's up to the DHCP server that responds first to tell the client about the PXE server. If a "normal" DHCP server answers first, there simply won't be any instructions and your machine will not actually boot.


=== Changing Files ===
=== Configuration File ===


The core file to edit is <span class="code">/etc/dhcpd.conf</span>, which you will have to create.
The core file to edit is <span class="code">/etc/dhcp/dhcpd.conf</span>.
 
'''Note''': On many systems, this *used* to be <span class="code">/etc/dhcpd.conf</span>, but on Fedora 13 it's been moved into it's own directory. If you are adapting this tutorial for another operating system, please check to see where your server expects this file to be.


<source lang="bash">
<source lang="bash">
vim /etc/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
</source>
</source>
<source lang="text">
<source lang="bash">
### Global options
### Global options
# General domain information
option domain-name "alteeve.com";
option domain-name "alteeve.com";
option domain-name-server 192.139.81.117, 192.139.81.1;
option domain-name-servers 192.139.81.117, 192.139.81.1;
 
# Tell the server that it's authoritive on our network.
authoritive;


### Subnet options
### Subnet options
subnet 192.168.1.0 netmask 255.255.255.0 {
subnet 192.168.1.0 netmask 255.255.255.0 {
        # This is the DHCP server, but not the actual Internet gateway. So this
# This is the DHCP server, but not the actual Internet gateway. So this
        # Argument points our clients to the right box.
# Argument points our clients to the right box.
        option routers 192.168.1.1;
option routers 192.168.1.1;
# Set our range. This can be whatever you want so long as it fits in
# your netmask.
range 192.168.1.100 192.168.1.220;
# If clients don't ask, make the lease available for the following
# number of seconds. If the client does ask, allow up to this number of
# seconds. 86,400s = 24h.
default-lease-time 86400;
max-lease-time 86400;


        # Set our range. This can be whatever you want so long as it fits in
# These two options tell clients where to go to get the file needed to
        # your netmask.
# start the boot process.
        range 192.168.1.200 192.168.1.220;
next-server 192.168.1.10;
filename "pxelinux.0";
}
</source>


        # If clients don't ask, make the lease available for the following
Now set <span class="code">dhcpd</span> to start with your machine and then start it up for the first time.
        # number of seconds. If the client does ask, allow up to this number of
        # seconds. 86,400s = 24h.
        default-lease-time 86400;
        max-lease-time 86400;


        # These two options tell clients where to go to get the file needed to
<source lang="bash">
        # start the boot process.
chkconfig dhcpd on
        next-server 192.168.1.10;
/etc/init.d/dhcpd start
        filename "pxelinux.0";
}
</source>
</source>
Done!


This isn't meant to be a <span class="code">dhcpd</span> tutorial, so I am not showing a lot of options you may find useful. Please take the time to read the <span class="code">man dhcpd.conf</span> and <span class="code">man dhcp-options</span> page to see all the other neat things you can do.
This isn't meant to be a <span class="code">dhcpd</span> tutorial, so I am not showing a lot of options you may find useful. Please take the time to read the <span class="code">man dhcpd.conf</span> and <span class="code">man dhcp-options</span> page to see all the other neat things you can do.

Revision as of 03:46, 19 June 2010

 AN!Wiki :: How To :: Setting Up a PXE Server on an RPM-based OS

This tutorial covers the steps needed to make a PXE server. It will be used for hosting multiple Operating Systems that can be booted from a machine's network card. The main reason for this setup is to host installation media removing the requirement for have optical drives in machines. It also saves you from having a pile of optical discs kicking around.

Parts Needed

A PXE boot server is fairly strait forward. You need:

  • dhcp; This answers a workstation's request for an IP during the boot process.
  • tftp-server; This is a PXE compliant FTP server than handles passing the core boot files to the remote machine.
  • syslinux; This handles those special boot files that the remote machine needs to boot.
  • httpd; Once the boot files start up the remote machine, generally you will tell it to pull the main files from a webserver. This is the Apache webserver that will server that purpose.

dhcp

You're probably familiar with DHCP from a client perspective; It's the method used to get an IP address from most networks when you join them. This is a pretty old and simple protocol and is easy to setup.

A Word On Network Seperation

Before you do though, you must take into account any other DHCP servers on your network. More to the point, you need to make sure there are no other DHCP servers on your network. The reason is that, when you try to PXE-boot a machine, it's up to the DHCP server that responds first to tell the client about the PXE server. If a "normal" DHCP server answers first, there simply won't be any instructions and your machine will not actually boot.

Configuration File

The core file to edit is /etc/dhcp/dhcpd.conf.

Note: On many systems, this *used* to be /etc/dhcpd.conf, but on Fedora 13 it's been moved into it's own directory. If you are adapting this tutorial for another operating system, please check to see where your server expects this file to be.

vim /etc/dhcp/dhcpd.conf
### Global options
# General domain information
option domain-name "alteeve.com";
option domain-name-servers 192.139.81.117, 192.139.81.1;

# Tell the server that it's authoritive on our network.
authoritive;

### Subnet options
subnet 192.168.1.0 netmask 255.255.255.0 {
	# This is the DHCP server, but not the actual Internet gateway. So this
	# Argument points our clients to the right box.
	option routers 192.168.1.1;
	
	# Set our range. This can be whatever you want so long as it fits in
	# your netmask.
	range 192.168.1.100 192.168.1.220;
	
	# If clients don't ask, make the lease available for the following
	# number of seconds. If the client does ask, allow up to this number of
	# seconds. 86,400s = 24h.
	default-lease-time 86400;
	max-lease-time 86400;

	# These two options tell clients where to go to get the file needed to
	# start the boot process.
	next-server 192.168.1.10;
	filename "pxelinux.0";
}

Now set dhcpd to start with your machine and then start it up for the first time.

chkconfig dhcpd on
/etc/init.d/dhcpd start

Done!

This isn't meant to be a dhcpd tutorial, so I am not showing a lot of options you may find useful. Please take the time to read the man dhcpd.conf and man dhcp-options page to see all the other neat things you can do.

Credits

References used:

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Alteeve's Niche! Enterprise Support:
Alteeve Support
Community Support
© Alteeve's Niche! Inc. 1997-2024   Anvil! "Intelligent Availability®" Platform
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.