Monday, April 27, 2009

Setting up a PXE-Boot Server


Setting up a PXE-Boot Server




This documents how to setup a PXE boot server for Linux. This assumes that you're using Redhat/FC as the PXE boot server. The vast majority of the information has been obtained from the following webpages:

http://dev.brantleyonline.com/wiki/index.php/General_Network_%28PXE%29_Booting
http://dev.brantleyonline.com/wiki/index.php/PXE_Booting_-_Fedora_Core

0) The first thing to note is that you need to setup your own mini-network that is completely disconnected from the network, since part of this process requires setting up a DHCP server which could conflict with the corporate DHCP server if they were both running on the same network simultaneously. So get yourself a switch from IT up front. You do *NOTneed the switch immediately, so just put it aside until I mention it again
later on.

1) The next step is to choose a box to be the PXE boot server. This can really be any box at all, as long as you have a NIC in it that works reliably under Linux. For the purposes of this documentation, I'm going to assume that you've loaded Fedora Core 4 on this box (do that now, if you've not already). Get this box onto the network with DHCP (just like a normal installation).

2) Next you'll need to install the following packages (which ship with FC4 already, so if you did an 'everything' OS install, you should have them already. If not, you can install them easily with yum): 
tftp-server
dhcp
httpd
syslinux

If you use yum to install them, then it will be generally alot easier:
yum install tftp-server dhcp httpd syslinux
answer Y to all dependency/installation questions.

3) Now you need to setup the DHCP server. With the FC4 RPM for dhcp, all you need to do is create /etc/dhcpd.conf with the following contents:

ddns-update-style interim;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.254;
default-lease-time 3600;
max-lease-time 4800;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "llama.net";
option time-offset -8;
}

host llama0 {
hardware ethernet 04:4B:80:80:80:03;
fixed-address 192.168.0.254;
option host-name "llama0";
filename "pxelinux.0";
}

In a nutshell, this sets up a DNS server that will assign IP address 192.168.0.254 to your client box that has MAC address 04:4B:80:80:80:03 assigned to its PXE-boot capable NIC. Another thing to note is that we're reserving the private 192.168 subnet for this setup. The only thing you need to change in the above, is the MAC address to match that of the NIC on your client box.

4) Next you need to activate tftp within xinetd. All that is neccesary is to change disable=yes to disable=no in /etc/xinetd.d/tftp . Then restart xinetd. For future reference, the tftp RPM for FC4 stores its servable content under /tftpboot.

5) Now we need to setup your PXE server to use a static IP on the new private subnet. Create the file /etc/sysconfig/network-scripts/ifcfg-eth0.static with the following contents:

DEVICE=eth0
BOOTPROTO=STATIC
ONBOOT=no
TYPE=Ethernet
IPADDR=192.168.0.2
NETMASK=255.255.255.0
GATEWAY=192.168.0.1

6) Now we need to setup the PXE boot environment on the server. To do this, you need to have either the Linux distribution that you wish to install over PXE either in CD format, or all the content of the CDs available on the network.
On the first CD of every RH/FC distribution there is a subdirectory called 'isolinux'. In that directory you will find two files, vmlinuz and initrd.img. These are the kernel & initrd.img that the RH/FC bootable CDs use to get the installer (anaconda) booted for performing the installation. Copy both of those files into /tftpboot and make sure that they are world readable. If you are planning to allow more than one version/distribution to be PXE boot installable, then you should rename both files so that its clear that they are for whatever version/distribution they came from (such as vmlinuz-RHEL4, initrd-RHEL4).

Next, you need the actual pxe boot linux kernel (what is actually run immediately after your PXE boot client box gets a DHCP lease). In this case, that file is pxelinux.0, and is part of the syslinux RPM. For FC4, you can find it at /usr/lib/syslinux/pxelinux.0. Copy that file into /tftpboot and make sure that it is world readable.

7) Next we need to configure pxelinux. First create the directory /tftpboot/pxelinux.cfg (and make it world readable). Inside that directory you need to create a number of zero size files (use touch):
01-04-4B-80-80-80-03
C
C0
C0A
C0A8
C0A80
C0A800
C0A800F
C0A800FE
01-04-4B-80-80-80-03

The first 8 are the hex representation of the 192.168.0.254 IP address that your PXE boot client will be assigned. The permutations allow a broader IP subnet to be searched first for matches. The last entry is the MAC address of your PXE boot client's NIC (with dashes substituted for the colons), with '01' pre-pended. The "01" at the front represents a hardware type of Ethernet, so pxelinux.0 see's the configuration string as an IP address.

8) Now create the default pxelinux configuration inside the new file
/tftpboot/pxelinux.cfg/default:
prompt 1
default linux
timeout 100

label linux
kernel vmlinuz
append initrd=initrd.img ramdisk_size=9216 noapic acpi=off


9) Now you need to put the full contents of your Linux distro (all CDs) somewhere on disk. I put it under /tftpboot/RHEL4U1. In order to allow for installation over HTTP (apache), edit/etc/httpd/conf/httpd.conf and add the following:

Options Indexes
AllowOverride None

Alias /linux /tftpboot/RHEL4U1


10) At this stage, you're ready to hook up the switch. You should have CAT5 running between the switch & the PXE boot server, and the client box.

11) On the PXE boot server, bring down your DHCP network connected eth0 (ifdown eth0), disconnect the CAT5 connected to the network, and plug in the cat5 connected to your private switch. Now bring up the static IP for the PXE server with (ifup eth0.static). You can verify that it came up successfully by verifying that you have IP address 192.168.0.2 in ifconfig.

12) Now start dhcpd & apache and activate tftp by running the following:
service dhcpd start
service xinetd restart
service httpd start

and verify that they are all in your process list.

13) Plug the PXE client box's CAT5 into the switch, and verify that the NIC appears first in the BIOS boot order. (re)boot and you should get a DHCP lease, and start booting successfully off the network.

14) When you get into the RH/FC installer which asks you for the install method, choose HTTP. Fill in 192.168.0.2 for the name, and 'linux' for the path, and you should be all set.

15) If you run into any problems, check /var/log/messages for errors (that's where all dhcp & tftp stuff will get logged). /var/log/httpd is where apache logs, but if you get that far, your problem is an apache configuration/setup issue, and not a PXE boot issue.

Friday, April 24, 2009

Unlimited Network Monitoring Tool

Easily Mount ISO Images with a Well-Designed API

GMount ISO is a virtual drive for Linux written using PyGTK and Glade. It is a frontend to the mount command that allows you to convert CDs and unencrypted DVDs into virtual drives that run directly on your hard drive, getting rid of the need for physical discs and your CD-ROM drive. The access rate for the virtual disc is about 200 times faster than that of a physical CD.

GMount ISO is available from the repositories. You can search for "gmountiso" in Synaptic, or you can run the following command:

sudo apt-get install gmountiso

Wednesday, April 22, 2009

Origin of Famous Names..

There are many companies / brands / products whose
names were derived from strange circumstances.
Mercedes
This was actually the financier's daughter's name.

Adobe
This came from name of the river Adobe Creek that ran
behind the house of founder John Warnock.
Apple Computers
It was the favorite fruit of founder Steve Jobs. He
was three months late in filing a name for the
business, and he threatened to call his company Apple
Computers if the other colleagues didn't suggest a
better name by 5 O'clock.
CISCO
It is not an acronym as popularly believed. It is
short for San Francisco.

Compaq
This name was formed by using COMp, for computer, and
PAQ to denote a small integral object.
Corel
The name was derived from the founder's name Dr.
Michael Cowpland. It stands for COwpland REsearch
Laboratory.

Google
The name started as a joke boasting about the amount
of information the search-engine would be able to
search. It was originally named 'Googol', a word for
the number represented by 1 followed by 100 zeros.
After founders- Stanford graduate students Sergey Brin
and Larry Page presented their project to an angel
investor, they received a cheque made out to 'Google'
Hotmail
Founder Jack Smith got the idea of accessing e-mail
via the web from a computer anywhere in the world.
When Sabeer Bhatia came up with the business plan for
the mail service, he tried all kinds of names ending
in
'mail' and finally settled for hotmail as it included
the letters "html" - the programming language used to
write web pages. It was initially referred to as
HoTMaiL with selective uppercasing.
Hewlett Packard
Bill Hewlett and Dave Packard tossed a coin to decide
whether the company they founded would be called
Hewlett-Packard or Packard-Hewlett.

Intel
Bob Noyce and Gordon Moore wanted to name their new
company 'Moore Noyce'but that was already trademarked
by a hotel chain so they had to settle for an acronym
of INTegrated ELectronics.
Lotus (Notes)
Mitch Kapor got the name for his company from 'The
Lotus Position' or 'Padmasana'. Kapoor used to be a
teacher of Transcendental Meditation of Maharishi
Mahesh Yogi.
Microsoft
Coined by Bill Gates to represent the company that was
devoted to MICROcomputer SOFTware. Originally
christened Micro-Soft, the '-' was removed later on.

Motorola
Founder Paul Galvin came up with this name when his
company started manufacturing radios for cars. The
popular radio company at the time was called Victrola.

ORACLE
Larry Ellison and Bob Oats were working on a
consulting project for the CIA (Central Intelligence
Agency). The code name for the project was called
Oracle (the CIA saw this as the system to give answers
to all questions or something such). The project was
designed to help use the newly written SQL code by
IBM. The project eventually was terminated but Larry
and Bob decided to finish what they started and bring
it to the world. They kept the name Oracle and created
the RDBMS engine. Later they kept the same name for
the company.
Sony
It originated from the Latin word 'sonus' meaning
sound, and 'sonny' a slang used by Americans to refer
to a bright youngster.
SUN
Founded by 4 Stanford University buddies, SUN is the
acronym for Stanford University Network. Andreas
Bechtolsheim built a microcomputer; Vinod Khosla
recruited him and Scott McNealy to manufacture
computers based on it, and Bill Joy to develop a
UNIX-based OS for the computer.

Yahoo!
The word was invented by Jonathan Swift and used in
his book 'Gulliver's Travels'. It represents a person
who is repulsive in appearance and action and is
barely human. Yahoo! Founders Jerry Yang and David
Filo selected the name because they considered
themselves yahoos.

Thursday, April 16, 2009

VITE 49-O

Did you know that there is a system in our constitution, as per the 1969 act, in section "49-O" that a person can go to the polling booth, confirm his identity, get his finger marked and convey the presiding election officer that he doesn't want to vote anyone!

Yes such a feature is available, but obviously these seemingly notorious leaders have never disclosed it. This is called "49-O".

Why should you go and say "I VOTE NOBODY"... because, in a ward, if a candidate wins, say by 123 votes, and that particular ward has received
"49-O" votes more than 123, then that polling will be cancelled and will have to be re-polled. Not only that, but the candidature of the contestants will be removed and they cannot contest the re-polling, since people had already expressed their decision on them. This would bring fear into parties and hence look for genuine candidates for their parties for election. This would change the way; of our whole political system... it is seemingly surprising why the election commission has not revealed such a feature to the public.....

Please spread this news to as many as you know...Seems to be a wonderful weapon against corrupt parties in India... show your power, expressing your desire not to vote for anybody, is even more powerful than voting... so don't miss your chance. So either vote, or vote not to vote (vote 49-O) and pass this info on...

Wednesday, April 15, 2009

Programming Songs

1.Two Recursive functions calling each other
Mujhe kuchh kehna hein
mujhe bhi kuchh kehna hein
pehle tum, pehle tum

2. The debugger

Jab koi baat bigad jaye
Jab koi mushkil pad jaye
Tum dena saath mera hamnawaz

3. From VC++ to VB

Yeh haseen vaadiyan
Yeh khula asmaan
Aa gaye hum kahan


4. Untrackable bug --

aye ajnabi, tu bhi kabhi,
awaaz de kahin se


5. Unexpected bug (esp. during presentation to client)

Ye kya hua, Kaise hua, Kab hua, Kyon hua


6. And then to the client

Jab hua, Tab hua, O chhodo, ye na socho


7. Load Balancing

Saathi haath badhana
ek akela thak jayega
mil kar bojh uthana


8. Modem - talk on a busy connection

suno - kaho,
kaha - suna,
kuch huwa kya?
Abhee to nahin...
kuch bi nahin

9. Windows getting open sourced

Parde mein rahne do
parda na uthao
parda jo uth gaya to bhed khul jayega
allah meri tauba, allah meri tauba

10. Local variable

Jeena Yahan Marna Yahan,
Iske siva Jana kaahan.

11. Global variable

Musafir hoon yaaron,

na ghar hai na thikana


12. Null pointers

Mera jeevan kora kagaz kora hi reh gaya ..


13. Dangling pointers

Maut bhi aati nahi jaan bhi jati nahin.


14. GOTO

Ajeeb dastan hai yeh
Kahan shuru kahan khatam
Ye manzilen hain kaun si
Na woh samajh sake na hum

15. Hidden or Private scope Variable/value

Jaanejan .. dhoondta phir raha,

Hoon tujhe raat din,
main yahan se wahan

Friday, April 3, 2009