Monday, August 1, 2011

Linux in Hindi - RHEL6 - Setting up a PXE Boot Server

PXE अर्थात Preboot  eXecution  Environment  के द्वारा हम किसी कंप्यूटर को नेटवर्क के माध्यम से बूट करा सकते है. इसका प्रयोग करके हम चाहे तो एक कंप्यूटर पर बिना सीडी या डीवीडी के, नेटवर्क(LAN कार्ड) के माध्यम से Operating सिस्टम इन्स्टाल कर सकते है.

हम जिस कंप्यूटर पर PXE बूट सर्वर बनाने जा रहे है उस कंप्यूटर का IP एड्रेस है 192 .168 .20 .1 /24 . IP  एड्रेस सेट करने के लिए आप "system -config -network " कमांड का प्रयोग कर सकते है.

स्टेप १:

सबसे पहले तो इस बात का ध्यान रखें कि आपके के कंप्यूटर पर firewall एवं selinux बंद होना चाहिए अन्यथा यह बहार से आने वाले connections को रोकेगा और आपका client कंप्यूटर बूट नहीं होगा.
Firewall बंद करने के लिए "system -config -firewall " कमांड का प्रयोग करे और "disable " button पर क्लिक करें.
SELinux बंद करने के लिए या तो "echo  0  > /selinux /enforce " कमांड का प्रयोग करें अथवा "/etc/selinux/config" फाइल को edit करके उसमे "SELINUX=disabled" लाइन सेट करें और कंप्यूटर रिस्टार्ट कर लें.

स्टेप 2 :

अपने कंप्यूटर पर दो packages इन्स्टाल करें;
 अ. VSFTP - FTP सर्वर
 ब. CREATEREPO - YUM Repository बनाने हेतु   

निम्न कमांड्स में "RHEL6(DVD)" कि जगह अपनी डीवीडी का नाम लिख दें.

[root@server1 ~]# rpm -ivh /media/RHEL6(DVD)/Packages/vsftpd-2.2.2-6.el6.x86_64
[root@server1 ~]# rpm -ivh /media/RHEL6(DVD)/Packages/createrepo-0.9.8-4.el6.noarch
[root@server1 ~]# service vsftpd start
[root@server1 ~]# service vsftpd restart
[root@server1 ~]# chkconfig vsftpd on
RHEL6 के नाम से एक फोल्डर बनायें एवं उसमे RHEL6 कि डीवीड की साडी फाइल कॉपी कर दें. इस फोल्डर पर createrepo कमांड चला कर Packages की  लिस्ट  बना लें.

[root@server1 ~]# mkdir /var/ftp/pub/rhel6
[root@server1 ~]# cp -rvf /media/RHEL6(DVD)/* /var/ftp/pub/rhel6/
[root@server1 ~]# createrepo -v /var/ftp/pub/rhel6/Packages
vi एडिटर के द्वारा एक रेपो फाइल बनायें और उसमे निम्न पंक्तिया सेट करें.

[root@server1 ~]# vi /etc/yum.repos.d/server.repo
[Packages]
name=Redhat Enterprise Linux 6
baseurl=ftp://192.168.20.1/pub/rhel6/Packages
gpgcheck=0
enabled=1
save करने के लिए निम्न करें;

ESC
:wq


स्टेप 3 :

निम्न Packages  को इन्स्टाल करें;
१. dhcp
२. nfs
३. syslinux
४. tftp-server


[root@server1 ~]# yum -y install dhcp nfs syslinux tftp-server


स्टेप 4 :

NFS सर्वर को सेट करने एवं चालू करने के लिए निम्न कमांड चलायें;

[root@server1 ~]# vi /etc/exports
/var/ftp/pub/rhel6 192.168.20.0/24(rw,sync)

save करने के लिए निम्न करें;

ESC
:wq

सर्विस चालू करें;

[root@server1 ~]# service nfs start
[root@server1 ~]# service nfs restart
[root@server1 ~]# chkconfig nfs on


स्टेप 5 :

DHCP सर्वर को निम्न कमांड्स के द्वारा सेट करके चालू करें;

[root@server1 ~]# vi /etc/dhcp/dhcpd.conf
ddns-update-style interim;
allow booting;
allow bootp;

subnet 192.168.20.0 netmask 255.255.0.0 {
range 192.168.20.11 192.168.20.50;
next-server 192.168.20.1;
filename "pxelinux.0";
default-lease-time 600;
max-lease-time 7200;
}
save करने के लिए निम्न करें;

ESC
:wq
सर्विस चालू करें;

[root@server1 ~]# service dhcpd start
[root@server1 ~]# service dhcpd restart
[root@server1 ~]# chkconfig dhcpd on 


Step 6 :

TFTP सर्वर को निम्न कमांड्स के द्वारा सेट करके चालू करें;

[root@server1 ~]# vi /etc/xinetd.d/tftp

disabled=no

save करने के लिए निम्न करें;

ESP
:wq

सर्विस चालू करें;

[root@server1 ~]# service xinetd start
[root@server1 ~]# service xinetd restart

निम्न फाइल को कॉपी करें;

[root@server1 ~]# ls /var/ftp/pub/rhel6/isolinux/
[root@server1 ~]# cp -a /var/ftp/pub/rhel6/isolinux/* /var/lib/tftpboot/
[root@server1 ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@server1 ~]# cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@server1 ~]# chmod -R u+w /var/lib/tftpboot/*
[root@server1 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@server1 ~]# service xinetd restart
[root@server1 ~]# service dhcpd restart

अब आपका सर्वर तैयार है. client कंप्यूटर पर जाएँ और उसमे bios की setting में पहला बूट device "नेटवर्क" को सेट करें;

कंप्यूटर रिस्टार्ट करें और इन्स्टाल करने के लिए बूट स्क्रीन पर TAB दबा कर लिखें;

linux repo=nfs:192.168.20.1:/var/ftp/pub/rhel6

Tuesday, May 24, 2011

CCNA in Hindi - Network Addess Translation

NAT stands for Network address translation and the name specifies that it translates one address into another.

NAT can be used in various scenarios, some most common usage are;

1. Translating an IPv4 Private Address to IPv4 Public Address

2. Translating an IPv4 address into IPv6 Address

3. Translating an IPv4 Address into another IPv4 address, if the addresses ovelap


NAT can be configured on a variety of device including, Windows/Linux Server, Firewalls and Routers.

Following videos explain in detail various NAT flavours and their configuration on Cisco Routers;


CCNA in HINDI - Network Address Translation Part 1-6



CCNA in HINDI - Network Address Translation Part 2-6



CCNA in HINDI - Network Address Translation Part 3-6



CCNA in HINDI - Network Address Translation Part 4-6



CCNA in HINDI - Network Address Translation Part 5-6



CCNA in HINDI - Network Address Translation Part 6-6


Sunday, May 22, 2011

CCNA in Hindi - IP Access Control Lists

What does a router do? It receives traffic on one interface, checks its routing table for the destination network in the packet, and if a route exists, forwards the packet through the outgoing interface present in the route.

A router drops a packet, only if it doesn't find a route for the destination in it's routing table. What if we want the router to drop some packets for us? We can do so by specifying criteria to select packets to drop, by using Access Control Lists or ACL. To filter IP traffic we use IP ACL.

An ACL is a list of rules defined by the administrator that specifies what kind of traffic is permitted through the router. The criteria to select packets can be based on Source and/or Destination IP address, protocol and source and/or destination port nos.


Following six part video series explains various kinds of IP ACLs and their configuration on CISCO routers;


CCNA Hindi - IP Access Control List Part 1




CCNA Hindi - IP Access Control List Part 2



IP Access Control List Part 3





CCNA Hindi - IP Access Control List Part 4




CCNA Hindi - IP Access Control List Part 5




CCNA Hindi - IP Access Control List Part 6


Friday, December 17, 2010

Linux : Syslog

A Log file is a text file that stores various kind of messages generated by Applications, Network Devices or Processes/Daemons.

If something goes wrong with your system, log files can offer you information to help deduce the problem.

Lets start with 'dmesg';

'dmesg' command prints out the information that you usually are not able to see while your system is booting. So its a good place to start to troubleshoot the problem.


Next lets discuss Linux Log files;

Linux log files are stored under the '/var/log' directory. If you issue the 'ls /var/log' command from a terminal you will see all the log files that are stored there. Following are some of the important log files under this directory;

* boot.log – boot information
* cron – cron logs
* cups – directory of all printing logs
* httpd – Apache logs
* mail – Mail server logs
* maillog – The mail log
* messages – Post-boot kernel information
* secure – Security log
* Xorg.0.log – X Server log


You can view the contents of any of these files with 'cat /var/log/filename'. You can add an optional 'less' if the log file is tool large and the output scrolls too fast, like 'cat /var/log/filename | less'. You should be logged in as 'root' to view the contents of these log files.

SYSLOG

There are various daemons in Linux that handle the log files. There is 'klogd' daemon that handles messages generated by kernel, the there is 'syslogd' daemon that handles messages generated by various applications/Network devices/Daemons etc. Additionally some applications handle or manage their own log files like 'Apache' and 'Samba'.

'klogd' and 'syslogd' daemons are part of the 'sysklod' package and are installed when this package is installed. Both these daemons are set to run whenever your system starts.

You can use 'rpm -qa | grep -i sysklogd' to confirm whether this package is installed on your system or not. Also you can use 'rpm -ql sysklogd' to list the files installed by this package.

Following is the output from the 'rpm -ql sysklogd' command;


/etc/logrotate.d/syslog
/etc/rc.d/init.d/syslog
/etc/syslog.conf
/etc/sysconfig/syslog
/usr/sbin/klogd
/usr/sbin/syslogd
/usr/doc/sysklogd-1.3
/usr/doc/sysklogd-1.3/ANNOUNCE
/usr/doc/sysklogd-1.3/INSTALL
/usr/doc/sysklogd-1.3/NEWS
/usr/doc/sysklogd-1.3/README.1st
/usr/doc/sysklogd-1.3/README.linux
/usr/doc/sysklogd-1.3/Sysklogd-1.3.lsm
/usr/man/man5/syslog.conf.5
/usr/man/man8/klogd.8
/usr/man/man8/sysklogd.8
/usr/man/man8/syslogd.8

'/etc/syslog.conf' is the primary configuration file for syslog. Entries in this file can be divided into three parts;

1. Facility (Applications, Network Devices, Daemons etc.)
2. Levels ( 0 to 7)
3. Target (location of the target where to send message: console,log or remote host)


Facility: It is name of the application, daemon or a network device that generates a message. These can be;

1. kern
2. user
3. lpr
4. mail
5.cron
6. authpriv
7. daemon
8. uucp
9. news
10. * - represents all facilities

Level : Messages generated by a facility can be divided into 8 level which represent their importance. Higher the number more important it is. Following are the list of these levels;

1. emergency(level 7)
2. alert(level 6)
3. critical(level 5)
4. error(level 4)
5. warning(level 3)
6. notice(level 2)
7. info(level 1)
8. debug(level 0)


Target: Target represents the location where the messages should be sent. They can be;

1. Terminal - /dev/console
2. Log File - /var/log/messages
3. Remote Host - @192.168.100.75



A Sample Rule in '/etc/syslog.conf': Following is a rule contained in the configuration file. Lets understand what it means.

"mail.info /var/log/mail"

In the above rule 'mail' is the facility which generates messages. Dot "." is used to separate facility from level of message. In this case the level is "info" which means messages generated by 'mail' facility that correspond to 'info' or any level above it will be trapped. The last part of this rule is '/var/log/mail' which represents the target, which is a log file named 'mail' under '/var/log' directory.

So in totality this rule says that messages generated by 'mail' facility that correspond to level 'info' or any higher level will be sent to and stored in '/var/log/mail' log file.

Hope the above information was useful.

You can watch the configuration steps in the following three part video series on 'SYSLOG' in Hindi.


SYSLOG PART 1






SYSLOG PART 2





SYSLOG PART 3