Monday, February 15, 2016

Debian Network Configuration


                                                Debian  Network Configuration

l  IP Setting (Static+DHCP)
l  DHCP
l  DNS (BIND9)
l  APT-PROXY

IP Setting (Static+DHCP)
l  IP Setting (Static)
                        Open Interfaces file and add the these lines.
                        #>vi   /etc/networking/interfacse
                                    auto lo
                                    interfaces lo inet loopback
                                    address 127.0.0.1
                                    netmask   255.0.0.0            
                                          
                                    ath0
                                    iface eth0 inet static
                                    address 192.168.1.12
                                    netmask  255.255.255.0
                                    getway    192.168.1.1
                                    netmask  255.255.255.0

l  IP Setting (DHCP)
                                     ath0
                                     iface eth0 inet dhcp
                                        
                                                            DHCP
l  Install DHCP on the debain with the help of
                                    #>  apt-get install dhcp3-server

l  Open dhcp.conf file to define the range and domain name and etc.

                                    #>vi /etc/dhcp3/dhcp.conf

                                    ddns-update-style  none;
                       
                                    option domain-name “emergen.org” ;
                                    option domain-name-server 192.168.2.1;

                                    Increase default-lease-time & Max-lease-time
             
                                    subnet 192.168.2.0   netmask 255.255.255.0{
                                                range 192.168.2.1  192.168.2.100;
                                                option subnet-mask 255.255.255.0;
                                                option routers  192.168.2.1;
                                    }
                        
                        If you want to assign the static IP address to any special machine with the help of dhcp               
                        that define the mack address of that machine NIC.

                        host hostname {
                                hardware ethernet 00:2E:4B:5R:EE;
                                fixed-address  192.168.2.15;
                       }
                        when ever you are going to restart the DHCP or the system it's have same IP address that                         u assign.
                      
                                                DNS  (BIND9)
l  Primary DNS

l  Install DIND9
                                    #>  apt-get install bind9
l  Stop that service
                                    #> /etc/init.d/bind9 stop

l  For defining the forword and reverse zone open name.cof file

                                    #>vi /etc/bind/name.conf & define zone's

                        Don't delete the previous configuration just add these zone in name.conf file.
l  Forward Zone
                                    zone  “emergen.org”{
                                                type master;
                                                notify no;
                                    file “/etc/bind/emergen.org.db”;
                                    }
l  Reverse Zone
                                    Zone “2.168.192.in-addr.arpa”{
                                                type master;
                                                notify no;
                                                file “2.168.192.db”;
                                    } 
l  Now create the forward & reverse zone file open a file.
                                    #>vi /etc/bind/emergen.org.db






                                    And add this script

            $TTL   2d
            @   IN SOA  emergen.org.  root.emergen.org. (
                                                22     ;serial  
                                                3h     ;refresh
                                                1h     ;retry
                                                1w     ; expiry
                                                1d )   ; Minimum

                                    emergen.org.   IN  NS   dns1.emergen.org.

                                                            IN  A    192.168.3.1
                                    www               IN  A    192.168.3.1
                                    server               IN  A    192.168.3.1

                        ; If you want to define more host names that just add them
                                                mail           IN  A    192.168.3.1
                                                smtp           IN  A    192.168.3.1
                                                pop            IN  A    192.168.3.1


l  Now create reverse zone file
                                                #> vi /etc/bind/2.168.192.db

            And add these line
                        $TTL     2d
                        @ IN SOA  emergen.org. root.emergen.org.(
                                      2004111601            ; Serial
                                      8H                    ;  Refresh
                                      4H            ; Retry
                                      4W                            ;  Expire
                                      1D    )            ; Default TTL
                     
                                     IN NS   dns1.emergen.org.

                        1.3.168.192.in-addr.arpa.  IN PTR  www.emergen.org.

l  Start the BIND9 Service
                                     #> /etc/init.d/bind9 start

l  Test your BIND9 configuration
                                    #> ping www.emergen.org  or mail.emergen.org

l  Again install bind9 DNS package with the same configuration files on second machine just you have to add some extra lines.

                        Add Zones in name.conf

                                    zone "emergen.org"{
                                                       type  slave;
                                                       file "/etc/bind/emergen.org.db";
                                                    masters{
                                                         192.168.3.1;
                                                    };
                                    };
                                    zone "3.168.192.in-addr.arpa"{
                                                       type  slave;
                                                       file "/etc/bind/3.168.192.db";
                                         masters{
                                             192.168.3.1;
                                         };
                                     };

l  Create file for foreword zone.
                                    vi /etc/bind/emergen.org
                                   
                                     ------ same like previous file. 
                                    emergen.org.   IN  NS   dns1.emergen.org.
                                                            IN  NS   dns2.emergen.org. // Add this line after that one.                                                                                                  
                                     ------ same like previous file. 

l  Create file for reverse zone.
                                    vi /etc/bind/3.168.192.db

                                     ------ same like previous file. 
                                                 IN NS   dns1.emergen.org.
                                                 IN NS   dns2.emergen.org. // Add this line after that one.
                                     ------ same like previous file. 

l  Now restart the bind9 service
                                    /etc/init.d/bind restart


                
                         And add  one more line in the dhcp.conf file
                                     ------ same like previous file. 
                                                option domain-name-servers 192.168.3.1; // this IP address of your                                                                                                                         second DNS machine.
                                     ------ same like previous file. 

l  For testing you need a three machines one for primary DNS and second for secondry DNS and one use as a client. Now test your DNS server form the client console it
                         resolving or not.
                                    #>nslookup emergen.org or 192.168.3.1

l  If you found no error after executing this commad than stop one DNS server
                                    #>/etc/init.d/bind stop

                        And than again execute
                                    #>nslookup emergen.org or 192.168.3.1

l  Now if u didn't find any error it means that configuration is goes fine





                                                            APT-PROXY
l  Install Apt-proxy
                        #> apt-get install apt-proxy

l  Add mirrors in apt-proxy-v2.conf. we can find the mirrors on the web with the help  of google.com and define the IP, PORT and cache-dir where u want to store download packages.

                        #>  vi /etc/apt-proxy/apt-proxy-v2.conf   
                                    address 192.168.1.12
                                    port = 9999;
                                    cache-dir= “/var/cache/apt-proxy”
                                    and Define the mirror's.


l  some time's your firewall is not allow to go direct on the internet without username or password or you request is unable to find the proxy setting bcouse u did't define than if you want to define the http proxy than type
                                    export http_proxy=”192.168.1.1”
                                    I.E_ 192.168.1.1 this is the address of ur firewall machine.

l  On the Client side open source.list file add some mirrors but with your apt-proxy server address.

                        deb http://192.168.1.12:8080/kubuntu/ dapper main restricted
                        Add resources like this and run

l  #>apt-get update
                        to download the new available updates & stores in local cache.




No comments:

AWS EC2 - SSH locked with UFW

Need to update the instance's user data: 1. Stop the instance 2. Right click (windows) or ctrl + click (Mac) on the instance to open a c...