Thursday, July 30, 2009

Turn off icmp request

How to turn off ping request?

Open /etc/sysctl.conf in vi editor and write as follows

#sysctl –a |grep icmp

net.ipv6.icmp.ratelimit = 250
net.ipv4.netfilter.ip_conntrack_icmp_timeout = 30
net.ipv4.icmp_ratemask = 6168
net.ipv4.icmp_ratelimit = 250
net.ipv4.icmp_errors_use_inbound_ifaddr = 0
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_echo_ignore_all = 1

(Copy the last line and paste that into /etc/sysctl.conf)

#vi /etc/sysctl.conf

net.ipv4.icmp_echo_ignore_all=1

#/sbin/sysctl –P or reboot

Restart your box

Network Installation Server

We can install Linux by four types of Network installation method

By FTP server
By HTTP server
By NFS server
By PXE server

Keep ready of FTP server
This is the slowest installation method comparative above four methods.
Mount RHEL5 DVD into /mnt

#yum –y install vsftpd
#mkdir /var/ftp/pub/rhel5
#cp -a /mnt/* /var/ftp/pub/rhel5

#service vsftpd start
(Note: – Give anonymous access to this folder if you want makes this as http server)

By HTTP server
This is comparatively fast installation over ftp

Now no need copy once again rhel5 DVD into your web server directory
Because it’s already in /var/ftp/pub/rhel5, just give a link as follows

#yum –y install httpd
#ln –s ../../ftp/pub/rhel5 /var/www/html/pub/rhel5

#service httpd start

By NFS server

This is faster installation method over ftp and httpd

Now make an image of rhel5 DVD.

You can do image in two method

By mounting DVD
Insert your DVD into CD drive
#dd if=/dev/cdrom of=rhel5.iso

By mounting the folder
We already copied rhel5 DVD in /var/ftp/pub/rhel5
#dd if=/var/ftp/pub/rhel5 of=rhel5.iso

#yum –y install nfs portmap
#vi /etc/exports
/var/ftp/pub/rhel5 192.168.0.0/255.255.255.0 (ro,sync) (Your local lan)

#service portmap start
#service nfs start

By PXE server
This is the fastest method over the others
We will discussed about this in next blog

Linux LVM Partition

Adding of LVM Partition

#fdisk –l (To see the partition)
#fdisk /dev/sda
n (Create new partition)
p (Create a primary partition)
1 (Donate it as primary partition)
Press enter (Accept the default)
t (Automatically select only one partition)
L (List all the currently supported partition)
8e (LVM partition type)
P (Display partition)
w (write partition)

#partprobe
#pvcreate /dev/sda8 (For my setup)
#vgcreate –s 16M lvmcore /dev/sda8
#lvcreate –L 400M –n test lvmcore
#mkfs –t ext3 –m 1 –v /dev/lvmcore/test
#mkdir /data
#mount –t ext3 /dev/lvmcore/test /data

Entry this mount point in /etc/fstab

Delete of LVM Partition

#fdisk –l
#umount /data
#lvremove /dev/lvmcore/test
#vgreduce lvmcore /dev/sda8
#pvremove /dev/sda8
#partprobe
#fdisk –l

Reboot your system once

Increase Volume of LVM Partition

#fdisk –l
#df -h
# lvcreate –L 400M –n test lvmcore
# lvcreate –L 600M –n demo lvmcore
#lvmextend –L 40M /dev/lvmcore/test
#resize2fs /dev/lvmcore/test
#df –h
#e2fsck –f /dev/lvmcore/test

Reducing Volume of LVM Partition

#df –h
#umount /data
#fsck –f /dev/lvmcore/test
#resize2fs /dev/lvmcore/test 40M
#lvreduce /dev/lvmcore/test –L 40M
#y
#mount /dev/lvmcore/test /data
#df –h

Backup and formatting of a LVM partition Drive

#lvcreate –L 2000M –P r –s –n databack /dev/lvmcore/test
#mkdir /databackup
#mount –o ro /dev/lvmcore/databack /databackup
#dump -0u –f /databackup.dump /databackup
#ls –lah /databackup.dump
#umount /databackup
#lvremove /dev/lvmcore/databack
#umount /data
#mkfs.ext3 /dev/lvmcore/test
#mount /dev/lvmcore/test /data
#cd /data
#restore –rf /databackup.dump