Saturday, February 5, 2011

DHCP Server Configuration for Linux

DHCP Server Configuration for Linux

This guide will help you setup a dhcp server to provide network configuration information to clients on the network. These instructions were written with Red Hat 7.x systems in mind but the basic concepts provided here can be applied to other distributions as well.


   1. Download dhcp rpm package from Red Hat and install:

      # rpm -ivh dhcp-2.0pl5-8.i386.rpm

   2. Open file /etc/sysconfig/dhcpd and edit the first line as follows:

      DHCPDARGS=eth1

      Replace 'eth1' above with the network interface that you want to use for dhcp; this should be an internal network interface; denial of service attacks are possible if dhcp is running on an external interface.

   3. Copy /usr/share/doc/dhcp-2.0pl5/dhcpd.conf.sample to /etc

      # cp /usr/share/doc/dhcp-2.0pl5/dhcpd.conf.sample /etc/dhcpd.conf

      This sample file is a good starting point for our /etc/dhcpd.conf file, which by default is not installed. Alternatively, copy the file from a working server.

   4. Edit /etc/dhcpd.conf to suit your needs. An example file is included below for reference:

      #################file begin######################
      subnet 10.0.0.0 netmask 255.255.255.0 {
      # --- default gateway
              option routers                  10.0.0.1;
              option subnet-mask              255.255.255.0;

      #       option nis-domain               "mydomain.com";
              option domain-name              "mydomain.com";
              option domain-name-servers      216.227.56.120, 64.34.4.36;

              option time-offset              -28800; # Pacific Standard Time
      #       option ntp-servers              192.168.1.1;
      #       option netbios-name-servers     192.168.1.1;
      # --- Selects point-to-point node (default is hybrid). Don't change this unless
      # -- you understand Netbios very well
      #       option netbios-node-type 2;

              range 10.0.0.50 10.0.0.254;
              default-lease-time 604800;
              max-lease-time 604800;

              host test {
      #               option dhcp-client-identifier   "test";
                      hardware ethernet 00:e0:18:90:28:b2;
                      fixed-address   10.0.0.10;
              }
              # we want the nameserver to appear at a fixed address
      #       host ns {
      #               next-server marvin.redhat.com;
      #               hardware ethernet 12:34:56:78:AB:CD;
      #               fixed-address 207.175.42.254;
      #       }
      }
      ########################file end##########################

      Notes: specific settings always override global settings; in the above, the range 10.0.0.50 to 10.0.0.254 have been set side for dynamic hosts; this allows anything between 10.0.0.1 and 10.0.0.49 to be set aside as static ips. In the example, host 'test' is given a static ip using its mac address. The option 'dhcp-client-identifier' may work as an alternative to mac address, but may require some additional configuration on the client. The max lease time of 604800 translates to 7 days. Lease times are automatically renewed by clients once 50% of the expiration date is reached. Because of this, very long lease times should be unnecessary. If a very long one is required, provide the client a static ip using the host declaration. Also, the option time-offset setting is in seconds according to the manual page; Red Hat's configuration document erroneously lists this setting in hours. Use option host-name "apex.example.com" in a host declaration to provide hostnames to clients.

   5. Check that the lease database has been created; the rpm should create this file automatically; if not, create the file:

      # touch /var/lib/dhcp/dhcpd.leases

      The lease database is recreated from time to time so that it is not too large. First, all known leases are saved in a temporary lease database. The dhcpd.leases file is renamed dhcpd.leases~, and the temporary lease database is written to dhcpd.leases.

      The DHCP daemon could be killed or the system could crash after the lease database has been renamed to the backup file but before the new file has been written. If this happens, there is no dhcpd.leases file that is required to start the service. Do not create a new lease file if this occurs. If you do, all the old leases will be lost and cause many problems. The correct solution is to rename the dhcpd.leases~ backup file to dhcpd.leases and then start the daemon.

   6. Run 'setup' and check dhcpd to have it load at system boot

   7. Start/restart the server

      # service dhcpd start (restart)

      Changes to the file /etc/dhcpd.conf require the dhcp server to be restarted

   8. Test to make sure it works.

Monday, January 3, 2011

Cluster Concepts

Cluster:

As Linux is used more widely for mission-critical applications, support for high availability through application failover is becoming more important. Improving Linux high availability involves employing both hardware and software technologies, including:

1. Server redundancy, including application failover and server clustering

2. Storage redundancy, including RAID and I/O multipathing

3. Network redundancy

4. Power system redundancy

These features provide away to achieve scalable performance and high availability at low cost. In this article, we focus on the open source Red Hat Cluster Manager Application failover software package, describing its basic principles and operations. In addition, we outline how increasing levels of availability (at increasing cost) can be achieved with Linux using Cluster Manager and related redundancy techniques.

High Performance Computing (HPC) has become easier, and two reasons are the adoption of open source software concepts and the introduction and refinement of clustering technology. This first of two clusters discusses the types of cluster available, uses for those clusters, reason clusters have become popular for HPC, some fundamentals of HPC, and the role of Linux in HPC.

Linux clustering is popular in many industries these days. With the advent of clustering technology and the growing acceptance of open source software, super computers can now be created for a fraction of the cost of traditional high-performance machines.

This two-part article introduces the concepts of High Performance Computing (HPC) with Linux cluster technology and shows you how to set up cluster and write parallel programs. This part introduces the different types of clusters, use of clusters, some fundamentals of HPC, the role of Linux and the reason for growth of clustering technology. Part two covers parallel algorithm, how to write parallel programs, how to set up clusters and cluster benchmarking.

Sunday, October 31, 2010

Increase available disk space by decreasing the reserved blocks in extended filesytems ext2/3/4 using tune2fs

Have you ever noticed that after formatting a partition or external storage device - hard disk etc. into ext2/3/4 decreases the total available disk space by some amount? That's because the file-system reserves some part of the space to privileged processes. This is done to make sure that in case of file-system fill up, when user processes may not be allowed to write to disk, privilege system processes(or root user) may still be able to function properly(write on disk) e.g. syslogd etc.

This space by default is around 5% of the total. And considering the amount of hard-drive or partitions available these days, this reserved memory could be huge e.g. 5% of 500GB hard disk is 25GB, which is too much for critical cases. And this memory is only needed in the root(/) partition and it doesn't make much sense to reserve blocks on /home partitions or external storage devices, because privileged processes don't usually write on home partition.

It should be noted that this reserved space is also used to reduce fragmentation. So, it plays a major role in avoiding fragmentation by preventing the disk to be filled completely.

So, if you think 5% of your partition/disk is more than enough for reserved blocks then you can save some space by decreasing this amount. You can do this by using the tune2fs utility.

[root]# tune2fs -m 3 /dev/sda1

The -m option is used to set the new percentage share, we used 3%. /dev/sda1 is my root(/) partition.

We can set the value to 0 for home partition, assuming that you haven't configured any privileged process to write in /home directory. A word of warning here, since these reserved blocks are also used to prevent fragmentation, leaving some amount is a good idea.

[root]# tune2fs -m 0 /dev/sda2

where /dev/sda2 is the home partition.

You can even check the current number of reserved blocks on a partition or disk using tune2fs.

[root]# tune2fs -l /dev/sda2 | grep -i reserve

Reserved block count: 1257387
Reserved GDT blocks: 1018
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)

Thursday, July 31, 2008

Lindows


Lindows was developed by Michael Robertson with the goal of developing a Linux-based operating system.

Lindows was changed as Linspire.

Wednesday, July 30, 2008

Introduction of Linux

Linux:

The name "Linux" comes from the Linux kernel, originally written in 1991 by Linus Torvalds.

Linux Flavours:

1. RedHat

2. Debian

3. SuSE

4. Knoppix and more..