Monday, 29 December 2014

DHCP Configuration in Debian 6



DHCP Server Configuration :

Features:
  1. Provide automatic IP configuration to the clients.
  2. All network settings can be supplied by DHCP server such as IP Address, Subnet mask, Gateway, DNS server, Option Domain name etc.
  3. DHCP server bound to UDP port 67 and client UDP:68

Installation :
  1. apt-get install dhcp3-server

Important binaries:
  1. '/etc/dhcp/dhcpd.conf' – main configuration files
  2. ''/etc/init.d/isc-dhcp-server' main deamon for controlling DHCP service.
  3. '/var/lib/dhcp ' - DHCP db for IP lease information

DHCP Configuration to your environment :
  1. nano /etc/dhcp/dhcpd.conf – Place the following directives
#### DHCP Server Configuration File
option domain-name-servers 192.168.1.1;
option domain-name "linux.internal";
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;

authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.50 192.168.1.253;
default-lease-time 600;
max-lease-time 7200;
}
### Host binding with specific IP address
host linuxmint {
hardware ethernet 20:16:d8:58:31:8f ;
fixed-address 192.168.1.10;
}

Starting DHCP service:
  1. service isc-dhcp-server start | stop | restart | reload
  2. /etc/init.d/isc-dhcp-server start | stop | restart | reload
  3. invoke-rc.d isc-dhcp-server start | stop | restart | reload
All the above three method does the same thing.

Enabling Log facility with rsyslog
  1. nano /etc/rsyslog.conf – and make the follownig changes
    local7.* /var/log/dhcpd.log
  2. service rsyslog restart

Saturday, 27 July 2013

How to limit the bandwidth using Yum

Open yum.conf file
#vim /etc/yum.conf
#add the following line
throttle=50k
It will limit the speed 50KB/S while installing the package from the online repo using yum

How to create a password protected website using Linux

                                                                     
                                                                     
                                                                     
                                             
######### Creating a Passowrd Protected Website #################
1. Create your default website and check its working on browswer
When the website is working

2. Create a htpasswd file in /etc/httpd/conf/
[root@dhcppc9 conf]# htpasswd -c .htpasswd mind
New password: 
Re-type new password: 
Adding password for user mind

3. Set .htpasswd file permission 0644 so that it is accessed to apache user and group of apache server.
chmod 0644 .htpasswd 

4. Now create .htaccess file in your document root where the website is placed (/var/www/html/site1)
#vim /var/www/html/site1/.htaccess
Now paste the following lines in this file
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/httpd/conf/.htpasswd                 -- path of htpasswd file
require valid-user
5. set permission 0644 to this file so that it is access to apache user and group.
[root@dhcppc9 conf]# chmod 0644 /var/www/html/site1/.htaccess 

6. Now open httpd.conf file and paste the following lines in your virutal host 
<Directory "/var/www/html/site1">  --- path of your document root
  AllowOverride AuthConfig
  # The Options below is an example. Use what you deem is necessary.
  Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  Order allow,deny
  Allow from all
</Directory>

7. Service httpd restart