Monday, December 31, 2012

Making Scientific Linux 6.2 a Router with Squid Proxy


My internet facing server has 2 nic,the nic connected to the internal network has

ip address 10.10.0.1/24 

So at first type at terminal

sysctl -w net.ipv4.ip_forward=1

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

see current iptables configuration by

iptables -L -t nat (to see the nat table)or iptables -L(to see the generel iptables setting)


we will remove the 2 reject statement in the input section and the forwarding section

iptables -t filter -D INPUT -j REJECT --reject-with icmp-host-prohibited

iptables -t filter -D FORWARD -j REJECT --reject-with icmp-host-prohibited

yum install squid

nano /etc/squid/squid.conf

go to this line

http_port 3128

make this line

http_port 3128 intercept

to use a transparent proxy

save the file

service squid restart


to make sure all client's traffic(the intercepted traffic) from port 80 use port 3128 on the squid server

iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to 10.10.0.1:3128


Now we need to make sure clients can only use port 3128 to access net

iptables -t filter -A INPUT -p tcp --dport 3128 -j ACCEPT

iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited

By default there is a line in iptables in the INPUT section which accepts anything from anywhere

you can see this by

iptables -L

In my case it is the third line

I had to delete it to make sure the clients use 3128 port

iptables -t filter -D INPUT 3

so at the end the input section of my iptables configuration looks like this

Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere           
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:squid
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

at the client at the browser set the proxy with port 3128

Save this configuration by

 iptables-save > iptables.conf

This will create iptables.conf(in whatever directory you are in) which have the current iptables configuration

make a backup of the original iptables

cp /etc/sysconfig/iptables /etc/sysconfig/iptables_back

now replace the original iptables with our custom iptable configuration

mv /etc/iptables.conf /etc/sysconfig/iptables

now

service restart iptables

to load a iptables configuration temporarily

iptables-restore < iptables.conf


Wednesday, December 26, 2012

Install Oracle 10g Express on Scientific Linux 6 step by step


Ok so can not try oracle 11g express as it comes only in 64 bit(my old pc does not support 64 bit virtualization),so had to find the oracle 10g express edition.


I got the oracle-xe-10.2.0.1-1.0.i386.rpm from the book Oracle for Professionals,the book is heavy but supposed to be good,I have just started.


10g requires the following packages


glibc-2.3.2


and


libaio=0.3.96


you can see if they are installed by


rpm -qa | grep glibc


 rpm -qa | grep libaio


I tried rpm -ivh  oracle-xe-10.2.0.1-1.0.i386.rpm and faced the following errors


Preparing...                ########################################### [100%]

error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
error: %pre(oracle-xe-univ-10.2.0.1-1.0.i386) scriptlet failed, exit status 255
error:   install: %pre scriptlet failed (2), skipping oracle-xe-univ-10.2.0.1-1.0

but rpm -uvh oracle-xe-10.2.0.1-1.0.i386.rpm worked flawlessly


Thanks to the link


http://pb.zambale.com/2012/02/03/road-to-oracle-dba-installing-oracle-database-express-edition-oracle-database-xe/


you can set the password of the system account in the installation process


/etc/init.d/oracle-xe start


Now I can go to the


127.0.0.1:8080/apex


and login as syetem and enable the locked hr account


logout


Now


cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin


./oracle_env.sh


Now


nano /root/.bashrc


add the following line at the end


/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh


save the file


source /root/.bashrc


to make the system read .bashrc


/etc/init.d/oracle-xe restart


Now I have faced an error


when trying sqlplus from the command line like


sqlplus system


sqlplus command not found


So I tried


export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server


export PATH=$PATH:$ORACLE_HOME/bin


export ORACLE_SID=XE



and restarted the oracle-xe


/etc/init.d/oracle-xe restart


then from bash


sqlplus system worked fine


Then I added these 3 lines to the /root/.bashrc


nano /root/.bashrc


add these 3 lines at the end


export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server


export PATH=$PATH:$ORACLE_HOME/bin


export ORACLE_SID=XE


save the file


source /root/.bashrc





 


Sunday, December 16, 2012

Creating a PXE Server with Scientific Linux 6 step by step

yum install nano dhcp tftp-server httpd syslinux ftp

Disable the firewall

 nano /etc/sysconfig/selinux

change the line to

SELINUX=disabled

save the file

nano /etc/xinetd.d/tftp

disable=no

save the file

service restart xinetd

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot
cp /usr/share/syslinux/memdisk /var/lib/tftpboot
cp /usr/share/syslinux/mboot.c32 /var/lib/tftpboot
cp /usr/share/syslinux/chain.c32 /var/lib/tftpboot


Create the directory for your PXE menus

mkdir /var/lib/tftpboot/pxelinux.cfg

mkdir /var/lib/tftpboot/images

mkdir /data

mount -ro loop /media/centos.iso /data


create /etc/dhcp/dhcpd.conf


#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;

option option-128 code 128 = string;
option option-129 code 129 = text;


set vendorclass=option vendor-class-identifier;

subnet 192.168.163.0 netmask 255.255.255.0 {

option routers 192.168.163.2;
option domain-name-servers 192.168.163.2;
option subnet-mask 255.255.255.0;
range 192.168.163.100 192.168.163.105;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.163.25;
}

service dhcpd restart

copy the pxeboot folder in images folder in the Centos dvd

cp -rv pxeboot/* /var/lib/tftpboot/images/

cd /var/lib/tftpboot/pxelinux.cfg

create a file named default

nano default

#this file should contain this


default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

MENU TITLE PXE Menu


LABEL CentOS 5 PXEBOOT
       MENU LABEL CentOS 5 
        KERNEL images/vmlinuz
        APPEND initrd=images/initrd.img ramdisk_size=100000 ksdevice=eth1 ip=dhcp


#save the file


service start httpd

mkdir /var/www/html/install

mount the cent os DVD in the install folder

service httpd restart

Now the client should boot and get an ip from the pxe server and start booting

Wait this process is troublesome and I have faced several errors

First I faced the PXE-E32: TFTP open timeout error

Then I faced PXE- T01 File not found error because my tftpboot was in / instead of in /var/lib/tftpboot

at first the client is not even able to find the boot files

The reason was I first created the tftpboot directory in the /,which didn't work for me

so I moved the tftpboot folder in the /var/lib/tftpboot like this path is mentioned in /etc/xinetd.d/tftp file

then I faced the infamous "permission denied" error,the error is actually like this

pxe t00 permission denied

Now I don't know much about security,but I found this solution in his page

http://unix.stackexchange.com/questions/31809/permission-denied-trying-to-get-a-file-using-tftp


The solution is like this
   

"Probably a selinux problem. Do a ls -alZ in the directory. On RHEL5/Centos5 the context should be user_u:object_r:tftpdir_t.

You can run restorecon -Rv /tftproot to fix it.

Edit: Just saw the fedora tag. It seems you're using not F16 but an earlier version, so the instructions above should work for you. With F16 the tftproot is in /var/lib and the context is system_u:object_r:tftpdir_rw_t:s0."

So I used this command and finally felt sane again as the pxe server worked finally.

restorecon -Rv /var/lib/tftpboot/


Now I am ready to sleep,it's 4.50 in the morning.


Sourav Bhattacharya

Linux Faculty for 7 years

Saturday, December 15, 2012

Installing linux from NFS image



Okey this process is not smooth unlike ftp and http based installation.


Here how I did it.

I have used Scientific Linux (The best distro right now according to me)


I want to deploy CentOS through NFS image in the network,I boot the client PC using boot.iso in the images folder of the Cent OS 5.3 DVD,after booting I set the path to NFS server and the path of the CentOS image.

First I copied the CentOS 5.3 ISO(DVD Image) in my desktop.

Then

I created a folder named souravdvd in my home directory

mount -o loop /home/Desktop?CentOS5.3.ISO /home/sourav/souravdata

Then I created a folder name NFS in the root partition.

mount --bind /home/sourav/souravdata /nfs


Then

nano /etc/exports

/nfs  192.168.163.25(rw,sync,root_squash,anonuid=1001,anongid=1001)


(probably the rw should be ro,because the filesystem is read only rather than read write enabled,but anyway the problem went away) 

 now save the file

exportfs -a 

go to /etc/fstab

nano /etc/fstab

adda a line 

192.168.163.25:/nfs     /nfs         nfs          defaults          0           0 

 save the file

service nfs restart 




test it from another machine



create a folder there named test

mount -t 192.168.163.25:/nfs /test

or 

mount  192.168.163.25:/nfs /test 

may or may not work,I don't know

now boot the client machine using boot.iso,you need to configure dhcp in the nfs server,the client will aquire an IP and in then you need to choose NFS as the install media

The server will be 


192.168.163.25

The Path will be

/nfs 

Friday, December 14, 2012

Open FTP ports(20 and 21) through iptables

My IP Address is 192.168.163.25

go to

/etc/sysconfig/iptables

and the add the following lines before the first reject statement


-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.163.25 --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -s 192.168.163.25 --sport 21 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.163.25 --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -p tcp -s 192.168.163.25 --sport 1024:65535 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

-A OUTPUT -p tcp -s 192.168.163.25 --sport 20 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.163.25 --dport 20 -m state --state ESTABLISHED -j ACCEPT


Wednesday, December 5, 2012

Set a banner for ssh


nano /etc/motd

**************************************************************

Hello you,

Welcome to Sourav's area.

Have fun.

**************************************************************

save the file

service iptables restart

an error service not found

just create a symbolic link

ln -s /sbin/service /usr/bin

then service iptables restart will work fine


Change default port and disable root login in ssh and configure iptables accordingly


nano /etc/ssh/sshd_config



uncomment the line


#Port 22


and make it


Port 31111


then go to 


#PermitRootLogin   yes


and make it


PermitRootLogin   no


save the file


service sshd restart

now if I try to access my server using ssh with 31111 port

ssh -p 31111 10.10.1.1


it won't be accessible,we need to configure IPTABLES to make the port 31111 accessible from outside  

go to 

nano /etc/sysconfig/iptables

After the line


-A FORWARD -i eth1 -o eth0 -j ACCEPT

put this line

-A INPUT -p tcp -m state --state NEW -m tcp --dport 31111 -j ACCEPT

save the file

service iptables restart

ssh -p 31111 10.10.1.1

will prompt you to login with root

thoough you can not login with root as expected

so

useradd subrata

passwd subrata

set subrata's password

add subrata to the wheel group

nano /etc/group

go to the line 


wheel:x:10:root

make it


wheel:x:10:root,subrata

save the file

now subrata is in wheel group

go to 

nano /etc/sudoers

go to 


## Allows people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL

uncomment the second line so that it looks like


## Allows people in group wheel to run all commands
 %wheel        ALL=(ALL)       ALL

save the file

now using subrata you can do every thing



ssh -p 31111 subrata@10.10.1.1 will work just fine.







Tuesday, December 4, 2012

Securing Linux,enabling an user to be root only if it is in wheel group



nano /etc/pam.d/su


go to

#Uncomment the following line to require a user to be in the "wheel" group.

#auth                   required                          pam_wheel.so use_uid

uncomment the line so that it looks like 


auth                   required                          pam_wheel.so use_uid

DHCP configuration file in CentOS 5

It is  /etc/dhcpd.conf  in CentOS 5

The commented out lines are for address reservation.


#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample 




ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;

set vendorclass=option vendor-class-identifier;

subnet 10.10.1.0 netmask 255.255.255.0 {

option routers 10.10.1.1;
option domain-name-servers 192.168.163.2;
option subnet-mask 255.255.255.0;
range 10.10.1.15 10.10.1.25;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server 10.10.1.1;
}



#host  client {

#hardware-ethernet 00:0C:29:BC:55:9C ;
#fixed-address  10.10.1.15;
#}









Sunday, December 2, 2012

Configure Cisco ASA 8.4 in GNS 3 step by step



 Download the ASA 8.4 files for GNS3 from this link


http://www.mediafire.com/download.php?l010dd0c1nayf0d

Now configure ASA under QEMU in GNS 3 like this

Qemu Options: -vnc none -vga none -m 1024 -icount auto -hdachs 980,16,32

Kernel cmd line: -append ide_generic.probe_mask=0x01 ide_core.chs=0.0:980,16,32 auto nousb console=ttyS0,9600 bigphysarea=65536






activation-key 0x4a3ec071 0x0d86fbf6 0x7cb1bc48 0x8b48b8b0 0xf317c0b5

activation-key 0xb23bcf4a 0x1c713b4f 0x7d53bcbc 0xc4f8d09c 0x0e24c6b6

source:http://www.xerunetworks.com/2012/02/cisco-asa-84-on-gns3/

Tuesday, November 27, 2012

Thursday, November 22, 2012

Install apache,mysql,php (LAMP) on Centos 6/Scientific Linux 6

sudo yum install httpd

sudo service httpd start

sudo chkconfig httpd on

find your ip address by

ifconfig eth0 | grep inet | awk '{ print $2 }'

To check if Apache is installed, direct your browser to your server’s IP address (for example http://192.168.0.2). The page should display the words “It works!"

sudo yum install mysql-server

sudo service mysqld start

set mysql root pasword by

sudo /usr/bin/mysql_secure_installation

sudo chkconfig mysqld on

sudo yum install php php-mysql

search php modules by

yum search php-

install the module by

sudo yum install name of the module

to know more about this module

yum info name of the module

Test your webserver

sudo nano /var/www/html/info.php

write

phpinfo();
?>

save and exit

sudo service httpd restart

http://localhost/info.php

Monday, November 19, 2012

Make a service available to a particular or multiple runlevels



chkconfig --level 2345 iptables on 


This will make the service iptables available on runlevel 2,3,4,5.

Checking to see a service is available or not to which runlevels


chkconfig --list iptables

the output is

iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off

So the iptables service is available in runlevel 2,3,4,5.

Friday, November 16, 2012

Configure basic NAT using iptables in Centos 5

If you are running a recent 2.6 Linux Kernel this four step process should work for you. This has been specifically tested on Fedora Core 3, 4, 5, and 6, but should work on any modern Linux distribution. All of these commands must be executed as the root user. First you need to tell your kernel that you want to allow IP forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward

Then you'll need to configure iptables to forward the packets from your internal network, on /dev/eth1, to your external network on /dev/eth0. You do this will the following commands:

# /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i eth0 -o eth1 -m state
--state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

You should now be NATing. You can test this by pinging an external address from one of your internal hosts. The last step is to ensure that this setup survives over a reboot. Obviously you should only do these last two steps if your test is a success.

You will need to edit /etc/sysctl.conf and change the line that says net.ipv4.ip_forward = 0 to net.ipv4.ip_forward = 1. Notice how this is similar to step number one? This essentially tells your kernel to do step one on boot. Ok last step for Fedora/RHEL users. In order for your system to save the iptables rules we setup in step two you have to configure iptables correctly. You will need to edit /etc/sysconfig/iptables-config and make sure IPTABLES_MODULES_UNLOAD, IPTABLES_SAVE_ON_STOP, and IPTABLES_SAVE_ON_RESTART are all set to 'yes'.

For non-Fedora/RHEL users you can simply setup an init script for this or simply append these commands to the existing rc.local script so they are executed on boot. Or if you want to get even more fancy, you can use the commands iptables-save and iptables-restore to save/restore the current state of your iptables rules.


source:http://www.revsys.com/writings/quicktips/nat.html

Wednesday, November 14, 2012

200 port command successful consider using pasv solved



Very irritating,I used mget rather than get and it worked just fine.

mget filename/foldername

Vsftp error “500 OOPS: cannot change directory:/some/directory solved

yum install vsftpd

then start it by 


service vsftpd start

verify it's opened port(whether it's 21) by

netstat -tulpn | grep :21


go to system-> administration-> firewall and check the ftp

the firewall will be started and it will open the 21 port

Now the famous error "Vsftp error “500 OOPS: cannot change directory:/some/directory"

you can not log in with any local user

to solve it

[root@sun02 vsftpd]# getenforce


Enforcing


[root@sun02 vsftpd]# getsebool -a | grep ftp


allow_ftpd_anon_write –> off
allow_ftpd_full_access –> off
allow_ftpd_use_cifs –> off
allow_ftpd_use_nfs –> off
allow_tftp_anon_write –> off
ftp_home_dir –> on (change that to on in ur case this option is off)
ftpd_disable_trans –> off
ftpd_is_daemon –> on
httpd_enable_ftp_server –> off
tftpd_disable_trans –> off


[root@sun02 vsftpd]# setsebool -P ftp_home_dir on


setsebool command may not be found,it is in the /usr/sbin folder,create a softlink to /usr/bin

and you are done,restart vsftpd,the last command took a little time,that's all

source:http://blog.arithm.com/2009/06/15/defeating-vsftp-error-500-oops-cannot-change-directorysomedirectory/

Some irritating things solved when trying to compile c++ and java on Scientific Linux 6



Installed openjdk,java command working but javac command not found error

solved by

sudo yum install java-1.6.0-openjdk-devel

gcc installed but g++ command not found error

solved by

yum install gcc-c++

compiling a cpp file with g++ works find but code blocks shows an error with a return code from the gnome terminal 255

Solved by

yum install xterm

now run codeblocks from the terminal or application->programming-codeblocks

hope those works on Cent os or Fedora too

Sunday, November 11, 2012

Thursday, October 4, 2012

file * is better than ls -l,well sometimes

Yes file * will show all files with their types in the current directory,very useful sometimes.

Aptitude in Debian 5


dpkg -l shows all packages

dpkg -l | grep -i ssh will search for installed package ssh,the search will be case insentisitive

netstat -ntl | grep 22 will find the service that runs on 22 which is ssh

dpkg -L package name will show the contents of the package

dpkg -L openssh-client

when executing commnd such as dpkg -L openssh-client ,/usr/bin/scp will be shown in the results.so scp is a member package of openssh-client

if someone wants to find out which package belongs to which

dpkg -S /usr/bin/scp

will result in 

openssh-client

to install a package

dpkg - i packagename.deb

to remove a package

dpkg -r packagename.deb

to search for a package

aptitude search packagename

for example

aptitude search openssh

aptitude install packagename looks the /etc/apt/sources.list file and try to get the package from the resource specified there

aptitude remove packagename removes package

aptitude command take to interactive mode

search for package an + to mark it to be installed

press g to install

Tuesday, September 11, 2012

Install Enlightenment on Ubuntu 12.04



sudo add-apt-repository ppa:hannes-janetzek/enlightenment-svn


sudo apt-get update


sudo apt-get install e17

        
source:http://www.noobslab.com/2012/05/install-enlightenment-desktop-in.html 

Friday, September 7, 2012

Install Cinnamon on Ubuntu 12.04


sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable

sudo apt-get update 

Then install Cinnamon by typing sudo apt-get install cinnamon

source:http://www.linuxbsdos.com/2012/04/26/install-the-latest-and-greatest-cinnamon-desktop-on-ubuntu-12-04/

Make your lan parmently full duplex 100 mb/s in linux


Under Debian or Ubuntu Linux just create a script as follows:

# nano /etc/init.d/100Mbs

OR
$ sudo nano /etc/init.d/100Mbs

Append following lines:
#!/bin/sh
ETHTOOL="/sbin/ethtool"
DEV="eth0"
SPEED="100 duplex full"
case "$1" in
start)
echo -n "Setting eth0 speed 100 duplex full...";
$ETHTOOL -s $DEV speed $SPEED;
echo " done.";;
stop)
;;
esac
exit 0
Save and close the file. Setup executable permission:
# chmod +x /etc/init.d/100Mbs
OR
$ sudo chmod +x /etc/init.d/100Mbs

Now run script when Debian or Ubuntu Linux boots up. Use update-rc.d command install System-V style init script links:
# update-rc.d 100Mbs defaults
OR
# sudo update-rc.d 100Mbs defaults
Output:

 Adding system startup for /etc/init.d/100Mbs ...
   /etc/rc0.d/K20100Mbs -> ../init.d/100Mbs
   /etc/rc1.d/K20100Mbs -> ../init.d/100Mbs
   /etc/rc6.d/K20100Mbs -> ../init.d/100Mbs
   /etc/rc2.d/S20100Mbs -> ../init.d/100Mbs
   /etc/rc3.d/S20100Mbs -> ../init.d/100Mbs
   /etc/rc4.d/S20100Mbs -> ../init.d/100Mbs
   /etc/rc5.d/S20100Mbs -> ../init.d/100Mbs
Reboot the system to take effect or just type scrit name:
# /etc/init.d/100Mbs start
OR
$ sudo /etc/init.d/100Mbs start


source:http://www.cyberciti.biz/tips/howto-linux-add-ethtool-duplex-settings-permanent.html

Thursday, August 23, 2012

Managing LVM part 2


scan utilities

pvscan

for showing up the physical volumes,suppose pvcreate didn't work,in that case pvscan can show you the physical volumes

vgscan

for showing up the volume groups

lvscan for searching the logical volumes

lvrename volumegroup001 lvol0 logvol0(new name)

is for renaming logical groups

to add another partition from a different hard disk 

say /dev/sdb

create a partition there by fdisk /dev/sdb

n and then specify it's size,type to t to set it LVM(code is 8e)

if there is an error in writing the partition table try rebooting,if still there is an error try pvcreate the partition and then write the partition table

now to add this partition to the existing volume group

we have to use the vgextend command

vgextend volumegroup001 /dev/sdb2

now as we added another partition from another hard drive the logical volume size should be increased to utilize the extra space that we added,previuosly we set the logical volume as 2.5 GB usable,to extend it we have to use the lvextend command

lvextend /dev/volumegroup001/logvol0 -L +1G(we want to increase by say 1 GB)

but df -h or df -h lvm1/ will show as 2.5 GB

if we unmount the logical volume from lvm1 and then mount again it will still ahow as 2.5 GB

so it basically means although we resized the logical volume at the filesystem the mount point is not increased so we have to use an utility resize

To resize the logical volume so that we can use the extra space

resize2fs resize ext2 and ext3 filesystem

resize2fs /dev/volumegroup001/logvol0 3G(will resize the filesystem to 3GB from 3.5 GB,but it supports only ext3 and not ext2)

now df -h will show lvm1 as 3.0 GB

wow resize2fs really helped me in online resizing

what a relief isn't it,haha.

now resize2fs only support online(that is when mounted) increment,it doesn't support online decrement,so we can not make the size of lvm1 from 3GB to 2.8G,it does not support values like 3.1G,we have to use 3100MB to make it work

so to shrink it we have to unmount first,that is called offline

umount lvm1/

now if I put command as 

resize2fs /dev/volumegroup001/logvol0 2800M

it will instruct me to first run 

e2fsck -f /dev/volumegroup001/logvol0 to prevent data loss,as we are shrinking,not extending,shrinking has the possibility of losing data

so we have to first run

e2fsck -f /dev/volumegroup001/logvol0

then we have to run

resize2fs /dev/volumegroup001/logvol0 2800M

then mount by

mount /dev/volumegroup001/logvol0 lvm1/

now df -h will show it as 2.8GB 







Some info about managing LVM in Debian 5


The hierarchy of LVM is


1.Physical volume(lowest layer)

2.Volume Groups

3.Logical Volume

Use fdisk to create partion in one or separate harddisk,make it's type LVM(8e),writing partition table might throw an error,in that case try pvcreate first then write the partition table

pvcreate /dev/hda1 /dev/hda2 /dev/hda4 to create Physical volumes

pvdisplay will show the physical volumes

vgcreate volumegroup001 /dev/hda1 /dev/hda2 /dev/hda5

lvcreate -L 2.5GB volgroup001

lvdisplay or

lvdisplay volumegroup001

find the the location of the logical volume from the output of the command lvdisplay

in my case it is

/dev/volumegroup001/lvol0

then

mkfs.ext3 /dev/volumegroup001/lvol0(to enable a journaling filesystem)

create a folder

mkdir souravlvm

mount /dev/volumegroup001/lvol0 souravlvm/ && echo $?

see the mounted folder by


df -h

put it in the /etc/fstab file to make it available after reboot

/dev/volumegroup001/lvol0 /home/sourav/souravlvm ext3 defaults 0 2

unmount it by umount souravlvm/

then run mount -a which will read the fstab entry and then if you do df -h you will see the logical volume mounted in souravlvm again

Install qbasic in Ubuntu 10.10



sudo apt-get install dosboxThis should install dosbox on your ubuntu desktop. 


http://www.4shared.com/file/0CfT8EWS/OLDDOS.html

Open your home directory and right-click the downloaded olddos.exe file. Open it with archive manager. Extract it to a new folder, I suggest QBasic.

Now in the terminal type:


dosbox


After "dosbox" opens type the following:


mount c /home/username/QBasic/
C:
QBASIC.EXE

Thursday, August 16, 2012

Some info about OSPF

OSPF uses hello protocol


In OSPF Hello messages are sent every 10(some people tune it,make it even 2 seconds) seconds on broadcast/point to point networks and every 30 seconds on NBMA(Non Broadcast Multi Access such as Frame Relay) Networks

Hello message contains information such as

Router ID(name of the router)

Hello and Dead Timers(how often they are saying and this has to match between the neighbours)

Network Mask(subnet mask and this has to match between the neighbours)

Area ID(the area they are in and this has to match between the neighbours)

Neighbours(they have to match)

Router Priority

DR/BDR IP Adress

Authentication Password(this has to match)