Code Snipset

My notebook Toshiba Satellite A25, and old version of Toshiba, but still capable to run a bunch of application. I really want to utilize it.

And finally Fedora releases its latest version, Fedora 7. As usual, I want to make a try to this powerful operating system, the LINUX Operating System.

Wow… wait a moment, after downloading the 2.8 GByte DVD ISO images, I cant burn it into a DVD media. First, I don’t have a DVD burner, the second one, although I can burn it some where else, but, my Notebook’s DVD combo has already broken.

Therefore I should try to use other approach. Fortunately, the Toshiba A25 support the network booting mechanism through PXE. And also I have a computer running Linux fedora 4 to be utilize as the booting server

My goal for this are:

  • To install the Fedora 7 on my Notebook but still keep the Win XP as my main working environment
  • To use the Windows XP boot loader, and not replacing it with one from Linux (such as GRUB or LILO)


Before starting the installation, first, we need to prepare the environment. A small network system, and isolated from main network to prevent the interference with the production system, since we use a DHCP server. A small network connected with UTP cross cable is an ideal environment.


The first step for this installation is to prepare the boot and installation server. This server provide facility as a booting server and to store the installation source file. I use my old Linux box for this task. Following application are needed on this server:

  • http server to server the installation file. This server can be replaced by NFS server or FTP server
  • dhcp server: to provide the automatic IP assignment and as the starting point of PXE boot mechanism
  • tftp server: Trivial File Transfer Server, to host the kernel files and serve the PXE request mechanism

HTTP Server

Basicaly, this server provides a mechanism to transfer the installation source file to the installer. You may choose any method supported by Fedora7 distribution, such as NFS, FTP, HTTP, or local disc (fat, FAT32 and VFat. Unfortunately the NTFS isn’t support yet).

Next make the ISO DVD image accessible by the server, by mounting it as a directory in our linux box directory. For example we will mount our ISO DVD under /mnt/linuxdvd. Make a directory /mnt/linuxdvd, and from the directory where your dvd file located, issue following command:(remember to replace the filename with your ISO dvd file name.

mount -o loop linux_dvd_iso_file_name /mnt/linuxdvd

Now, the directory /mnt/linuxdvd will contain the Linux installation DVD. You should be able to see all installation file, and RPMs under this directory structure.

Finally make this directory browsable to the world from your HTTP server. The simplest way is to make symbolic link from the http document root directory to /mnt/linuxdvd directory. Make sure to check if it has already available through your http server. For example This URL depend on your configuration. You may choose other method which is the easiest for you.


To configure the DHCP server, modify the /etc/dhcpd.conf. Following are my configuration:

ddns-update-style interim;
ignore client-updates;

subnet netmask {

allow booting;
allow bootp;

# — default gateway
option routers;
option subnet-mask;

option nis-domain “”;
option domain-name “”;
option domain-name-servers;

option time-offset -18000; # Eastern Standard Time

range dynamic-bootp;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
host ns {
# change with your Server MAC Address
hardware ethernet 00:50:04:ba:e7:1d;


host MyNewLinuxBox {
# change with your New linux box
hardware ethernet 00:08:0D:3C:2A:DD;
option host-name “MyNewLinuxBox”;
filename “pxelinux.0″;

After modifying the file, restart the dhcp server

TFTP Server

The Fedora linux distribution has already include the TFTP server, and it may installed as part of xinetd super server. Although it can be started as standalone process, but starting it via xinetd is preferable. Find the configuration under /etc/xinetd.d/tftp. Modify the file to enable the tftp server by setting the “disable = no”, and set the “server_args = -s /tftpboot”. Your configuration file may look like below

service tftp
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4

After modifying it, check the directory /tftpboot, and make sure it is exists and readable by the world.

During the PXE booting mechanism, the PXE boot room first will load the dhcp configuration, and from the the DHCP record, the PXE will load the pointed boot file “pxelinux.0″ through the “next-server″ as specified by the dhcp server configuration. This files will be transfered via tfp mechanism. This file then will be executed and it will load the configuration under pxelinux.cfg directory on your /tftpboot directory. From the configuration, it will the load the kernel images, loaded it into memory and transfer the boot process to the kernel image.

Next we will copying the PXE boot image. The file named “pxelinux.0″in your DHCP server. This files can be copied from your linux box under /usr/lib/syslinux. Copy it to /tftpboot directory and make sure it is readable from the world.

Create a directory named /tftpboot/pxeboot_install. We will copy the installation Linux kernel to this directory. Copy the kernel files from your source directory “/mnt/linuxdvd”. The file is located under directory “image/pxeboot”. Copy the initrd.img and vmlinuz file to the “/tftpboot/pxeboot_install” and make the directory and files readable to the world.

After copying the install kernel file, we will make a configuration file to give hint to the pxelinux.0 program the location of our kernel. make a file named 01-<your-new-linux-box-mac-address>. For example, my notebook mac address is 00:08:0d:3c:2a:dd then i will make a file named 01-00-08-0d-3c-2a-dd. Put this file under /tftpboot/pxelinux.cfg directory, and make it readable from the world. The content of this file is:

prompt 1
default linux
timeout 100

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

Now restart the tftp service by restarting the xinetd service.

Up to this step, our boot server is ready. We ready to test our server. To boot from this server, modify the boot priority on your new linux box BIOS setting. Use the PXE boot first, instead of harddrive or cdrom.Boot your box, if everything OK, your box will boot from network and the installation program will begin.


Follow the installation step by step.  Remember our goal is to install the Fedora 7 but still use the XP boot loader as our main boot loader. To achive this goal, remember to install the GRUB linux boot loader BUT DO NOT  install it on your MBR, install it under your partition boot record on which the /boot directory located. This configuration can be modified by check the option “advance boot configuration” when the installation step confirm you about installing boot loader.

If you follow this option, then after the installation is completed, your computer will boot still using Windows XP, and your new linux installation will disappear.  And there is now way to boot your computer using your latest linux installation.

Don’t worry, following procedure is used to activate your linux boot  partition. Before you proceed with this procedure, use must make sure that during the installation, you have installed the GRUB on the boot record of your /boot partition. I assume that your linux partition is /dev/sda3.

What you need is just to take the boot record image of your linux partition. Use the windows version of dd unix command.  You may find it under or from the cygwin installation. Wich one you prefer.

Get the first sector of your boot record of the linux partition, save it into a file, put it on your c:\ drive. Give a name such as boot.linux.

Now add a configuration under c:\boot.ini file of your winxp. Add a line c:\boot.linux=”Fedora Core 7″ on this file. your boot ini may look like below.

[boot loader]
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=”Microsoft Windows XP Professional” /noexecute=optin /fastdetect
c:\boot.linux=”Fedora Core 7″

Restart your computer, and your linux installation will be available for you.

Note: Some  problem may occured if your bios doesn’t support LBA32


Ok, thats all, but i have some thing interesting for you. After reading and perform above step, I believe you have already understand on how to boot your linux server from the network.

Now the game is: DO NOT use the windows version of dd to get your copy of boot record, instead, boot your computer from network using your kernel and initrd.img that has already installed on your /boot directory under your linux partition.  Following tool is useful to extract the files of your linux partition from Windows environement.

After booting, take the partition boot record, perform the boot.ini configuration, and your linux is ready for you.

C U on my next articles

This articles is the description of my previous project, An Hotspot Management System. It is a computer system designed to manage user network connection, primarily from wireless network or other subsystem, and send the usage information to other system based on RADIUS protocol for further processing.

This articles will be devided into multiple parts. All of them will have the same title with series, so be sure to check this blog, if you want to read the overall of my article.

Overall System Overview

The Overall system is divided into 3 sub systems:

  • The Connection Point sub system: Physically this is collection of Wireless Access Point or any type of network connection base on Ethernet Protocol.
  • The Hotspot sub system: The main sub system to be built, consists of 3 part which are
    • The controller we will call it with “netaccess” is a program written in C language. The main function is to manage and control the user state, control the user connection through the Web Interface, and firewall sub system and and perform user data query and usage data with the radius server.
    • The Web Interface, is a web interface provided for user to perform login to the system, previewing their current status and terminating their connection.
    • The firewall susbsystem, is used to open and close the user connection to the external network (internet) and also perform the bandwidth management.
  • The user data storage and connection usage processing sub system. This system is a radius protocol based system

From the system perspective, we may call the both first subsystem (the connection point and the hotspot susbsystem) as NAS (Network Access Service)

Environment Selection

  • The connection point is an Ethernet base network connection, since it is widely used in the networking currently. Although this system firstly designed to provide services for wireless network, but it can be used to manage any type of network based on the Ethernet protocol
  • The Hotspot subsystem. This subsystem run under Free BSD 5.3 and above. I also rewritten the system in Linux system with more facility provided. Depend on your knowledge of the Operating system base firelwall system, I strongly suggest you to build this system under Linux if you want to provide a complex firewall and connection bandwidth management for your user. Otherwise if you need the simplicity and speed and lightweight system, consider to use Free BSD. Both of the are free.
    • The netaccess or ontroller is written using C language. Some library is also required. We need the radius client library (radius free library), posix thread and other standard library
    • The web Interface, I use the apache http server with mod rewrite installed. The script is written in PHP
    • The firewall subsystem depend on the OS used. For FreeBSD we use IPFW, for Linux we use Iptables and TC. Don’t worry, we will use shell script to access the functionality.
  • For the user data storage and connection usage processing sub system we use Radius based subsystem. If you don’t have a commercial one, you may use the Free Radius implementation which is available both on Linux and Free BSD.

That for the basic overview, on the next article we will discuss how the subsystem interact each other to provides the hotspot services to the client.

If you need to know how this system work and also the source code, please drop me a line at

I will post the next part soon. So be patient guys..

This code is a basic code for linked list in C language. Don’t use it on your project. I found these files when I tried to collect my files when I was in college.