?

Log in

No account? Create an account

Howto: Setting PXE server to install RHEV-H

There is nothing in special to setup the PXE server for RHEV. However, if you are wondering how to create one, please follow the steps below.

First, let's identify which subnet we are going to use. In my case, the subnet will be 192.168.1.X.

Checking the subnet


# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:1E:C9:20:3F:6B
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21e:c9ff:fe20:3f6b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4453951 errors:0 dropped:0 overruns:0 frame:0
TX packets:3350991 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3216624601 (2.9 GiB) TX bytes:1188936874 (1.1 GiB)
Interrupt:21 Memory:febe0000-fec00000

Installing DHCP



dhcp - is required because the client machine will boot from PXE and adquire an IP address from the DHCP server available at the subnet.

1) # yum install dhcp -y

Setting DHCP


2) vi /etc/dhcp/dhcpd.conf

authoritative;
ddns-update-style none;

subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.190 192.168.1.200;
range 192.168.1.201 192.168.1.250;
option domain-name-servers 192.168.1.101; # DHCP Server
#option domain-name "medogz.com";
option routers 192.168.1.101; # DHCP Server
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}

# HOST - RHEV
host rhev-server1 {
hardware ethernet 00:15:C5:E0:D3:27; # MAC from machine that will boot via PXE
fixed-address 192.168.1.240; # Fixed IP address
filename "pxelinux.0"; # File that will be downloaded by the client
next-server 192.168.1.101; # DHCP Server
}

# vi /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS=eth0

# chkconfig dhcpd on

# service dhcpd start
Starting dhcpd: [ OK ]

Installing TFTP



tftp - will be used to transfer the image to be installed into the clients from the server.

# yum install tftp tftp-server -y

# chkconfig xinetd on
# chkconfig tftp on

# service xinetd start
Starting xinetd: [ OK ]

Preparing pxeboot



Extract files available inside the rpm or install it.
Below RPM available only via Red Hat Channel.

# rpm2cpio rhev-hypervisor-6.2-0.17.2.el6.noarch.rpm | cpio -div
./usr/bin/rhevh-iso-to-disk
./usr/bin/rhevh-iso-to-pxeboot
./usr/share/rhev-hypervisor/rhev-hypervisor.iso
./usr/share/rhev-hypervisor/version.txt
241719 blocks

Converting the iso image to a PXE boot

note: you can use livecd-iso-to-pxeboot tool as well.
# bin/rhevh-iso-to-pxeboot share/rhev-hypervisor/rhev-hypervisor.iso
Your pxeboot image is complete.

Copy tftpboot/ subdirectory to /tftpboot or a subdirectory of /tftpboot.
Set up your DHCP, TFTP and PXE server to serve /tftpboot/.../pxeboot.0

Note: The initrd image contains the whole CD ISO and is consequently
very large. You will notice when pxebooting that initrd can take a
long time to download. This is normal behaviour.

Copying the generated files

The directory tftpboot/ was generated with the files to create the PXE boot.

Before copying, let's find which directory tftpboot service is setup.

# cat /etc/xinetd.d/tftp | grep -v ^#
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}

In this case, the directory is /var/lib/tftpboot as showed in the server_args parameter.

# cp -Rpv tftpboot/* /var/lib/tftpboot/
`tftpboot/initrd0.img' -> `/var/lib/tftpboot/initrd0.img'
`tftpboot/pxelinux.0' -> `/var/lib/tftpboot/pxelinux.0'
`tftpboot/pxelinux.cfg' -> `/var/lib/tftpboot/pxelinux.cfg'
`tftpboot/pxelinux.cfg/default' -> `/var/lib/tftpboot/pxelinux.cfg/default'
`tftpboot/vmlinuz0' -> `/var/lib/tftpboot/vmlinuz0'

Now it's time to setup the pxelinux.cfg/, this directory holds the files that the pxeboot will look during the boot. Each file be named as the fixed IP address of client converted to hexadecimal, for example (192.168.1.240):

# cd /var/lib/tftpboot/pxelinux.cfg

# gethostip -x 192.168.1.240
C0A801F0

Copying the default settings of RHEV PXE boot
# cp default C0A801F0

Preparing Firewall


Allow the MAC from the client machine.

# iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# iptables -I INPUT 1 -m mac --mac-source 00:15:C5:E0:D3:27 -j ACCEPT
# service iptables save

Ok, everything done, it's time to boot your client machine via PXE (please note that this can take some time)

References about PXE and kickstart


Instalação Automatizada de Servidores com Kickstarts – Parte II – Integrando com Servidores PXE
http://marcelo.mmello.org/2010/04/instalacao-automatizada-de-servidores-com-kickstarts-parte-ii-integrando-com-servidores-pxe/

Comments

Congratulations!!

Hey Doug,

Very nice and useful article!! Thank you for sharing this!

Congrats dude!!

mmello

May 2019

S M T W T F S
   1234
567891011
12131415161718
19202122232425
262728293031 

Tags

Powered by LiveJournal.com