Showing posts with label INTERVIEW. Show all posts
Showing posts with label INTERVIEW. Show all posts

Wednesday, 6 April 2016

Apache Interview Questions

What is Apache?
Apache is Web server application.

What are feature of Apache?
Following are modules supported by Apache
  • mod_access, 
  • mod_auth, 
  • mod_digest, 
  • mod_auth_digest
  • Secure Sockets Layer 
  • Transport Layer Security support (mod_ssl), 
  • proxy module (mod_proxy)
  • URL rewriter (mod_rewrite)
  • custom log files (mod_log_config)
  • mod_ext_filter.
Is Apache opensource?
Yes, It is

In which language Apache is written?
'C' Language

What is offical website of Apache?
httpd.apache.org

Q: – How to check the version of Apache server ?
rpm -qa |grep httpd
Q: – What is meaning of "Listen" in httpd.conf file ?
Port number on which to listen for nonsecure (http) transfers.
Q: – What is DocumentRoot ?
it is a location of files which are accessible by clients. By default, the Apache HTTP server in RedHat Enterprise Linux is configured to serve files from the /var/www/html/ directory.
Q: – On which port Apache server works ?
http – port 80
https – port 443
Q: – Tell me name of main configuration file of Apache server ?
httpd.conf
Q: – On which version of apache you have worked ?
httpd-2.2
Q: – What do you mean by a valid ServerName directive?
The DNS system is used to associate IP addresses with domain names. The value of ServerName is returned when the server generates a URL. If you are using a certain domain name, you must make sure that it is included in your DNS system and will be available to clients visiting your site.
Q: – What is the main difference between <Location> and <Directory> sections?
Directory sections refer to file system objects; Location sections refer to elements in the address bar of the Web page
Q: – What is the difference between a restart and a graceful restart of a web server?
During a normal restart, the server is stopped and then started, causing some requests to be lost. A graceful restart allows Apache children to continue to serve their current requests until they can be replaced with children running the new configuration.
Q: – What is the use of mod_perl module?
mod_perl scripting module to allow better Perl script performance and easy integration with the Web server.
Q: – If you have added “loglevel Debug” in httpd.conf file, than what will happen?
It will give you more information in the error log in order to debug a problem.
Q: – Can you record the MAC (hardware) address of clients that access your server.
No
Q: – If you have only one IP address, but you want to host two web sites on your server. What will you do?
In this case I will use Name Based Virtual hosting.
ServerName 10.111.203.25
NameVirtualHost *:80
<VirtualHost *:80>
ServerName web1.test.com
DocumentRoot /var/www/html/web1
</VirtualHost>
<VirtualHost *:80>
ServerName web2.test2.com
DocumentRoot /var/www/html/web2
</VirtualHost>
Q: – Can I serve content out of a directory other than the DocumentRootdirectory?
Yes, by using “Alias” we can do this.
Q: – If you have to more than one URL map to the same directory but you don't have multiple Alias directives. What you will do?
In this case I will use “AliasMatch” directives.
The AliasMatch directive allows you to use regular expressions to match arbitrary patterns in URLs and map anything matching the pattern to the desired URL.
Q: – Can you record all the cookies sent to your server by clients in Web Server logs?
Yes, add following lines in httpd.conf file.
CustomLog logs/cookies_in.log "%{UNIQUE_ID}e %{Cookie}i" CustomLog logs/cookies2_in.log "%{UNIQUE_ID}e %{Cookie2}i"
Q: – Can we do automatically roll over the Apache logs at specific times without having to shut down and restart the server?
Yes
Use CustomLog and the rotatelogs programs
Add following line in httpd.conf file. CustomLog "| /path/to/rotatelogs/path/to/logs/access_log.%Y-%m-%d 86400" combined
Q: – What we can do to find out how people are reaching your site?
Add the following effector to your activity log format. %{Referer}
Q: – How you will put a limit on uploads on your web server?
This can be achieved by LimitRequestBody directive.
<Directory "/var/www/html/data_uploads">
LimitRequestBody 100000
</Directory>
Here I have put limit of 100000 Bytes
Q: – I want to stop people using my site by Proxy server. Is it possible?
<Directory proxy:http://www.test.com/myfiles>
Order Allow,Deny
Deny from all
Satisfy All
</Directory>
Q: – What is mod_evasive module?
mod_evasive is a third-party module that performs one simple task, and performs it very well. It detects when your site is receiving a Denial of Service (DoS) attack, and it prevents that attack from doing as much damage. mod_evasive detects when a single client is making multiple requests in a short period of time, and denies further requests from that client. The period for which the ban is in place can be very short, because it just gets renewed the next time a request is detected from that same host.
Q: – If Some One want Apache server should handle multiple requests over a single TCP connection. Which of the following would allow to do this?
A. Expirations
B. BrowserMatch
C. KeepAlive
D. PersistentConnect
E. ChunkEncode
Ans: C
Q: -Which of the following HTTP headers will direct a browser towww.nextstep4it.com after waiting five seconds?
A. Rerwrite 5; URL = http://www.nextstep4it.com/
B. Location 5; URL = http://www.nextstep4it.com/
C. Refresh 5; URL = http://www.nextstep4it.com/
D. Reload http://www.nextstep4it.com/ -t 5
E. Direct -t 5 http://www.nextstep4it.com/
Ans: C
Q: -Cookies can be used by Apache to create a click stream log of user activity. However, for the cookies to work, Apache must be compiled with the _______ module, then the ______ directive must be
A. mod_usertrack; Cookie Tracking on
B. mod_cookies; Cookies on}
C. mod_cookietracking; cookie Tracking on
D. mod_cookielog; Cookielogging on
E. mod_userlog, cookielogging on
Ans: A
Q: – Which of the following are TRUE regarding contains in httpd.conf? (Choose two.)
A. Containers consist of a Paired set of delimiters.
B. If two containers contradict, the first is applied.
C. Containers may only be applied globally.
D. Containers allow individual virtual hosts to have their own settings.
Ans: A,D
Q: -Which of the following best explains why Apache Web servers are able to handles multiple requests?
A. In addition to port 80, Apache opens ports 8080, 8000, and others to handle the additional requests.
B. Apache is able to spawn child processes that handle requests before they die.
C. Apache uses therenice service to load balance between different system daemons.
D. Upon reaching a set number of requests, Apache uses a raw socket to adjust a system's bandwidth to handle the additional requests.
Ans: B
Q: – Consider the file "test.html". Which of the following best describes what code does?
<html>
<from>
<INPUT TYPE=" button" VALUE="set cookie"
onClick = "document. Cookie =`first_name=Fred`;">
<INPUT TYPE = "button" VALUE = "display cookie"
onClick = "alert (document.cokkie);">
</from>
</html>
A. When the user clicks on "set cookie," it prompts the user for value. Once the value is entered, it can be displayed using the "display cookie" button.
B. When the user clicks on "set cookie," thefirst_name cookie is set to "Fred." The first_name cookie can be displayed by clicking the "display cookie" button.
C. When the user first loads "test.html,"first_name is automatically set to "Fred." The value of first_name can be seen with the "display cookie" button. The first_name cookie can be reset to " 3
empty ("") by clicking the "set cookie" button.
D. When the user clicks on the "set cookie" button, a new HTML page is loaded that displays the word "Fred". When the user clicks on the "display cookie" button, it alerts the user that it has been
deleted.
Ans: B
Additional:
http://www.tecmint.com/apache-interview-questions/
http://www.masteringinlinux.com/linux-questions/apache-interview-questions-answers.html
http://www.globalguideline.com/interview_questions/Questions.php?sc=Apache
http://studyhat.blogspot.in/2012/08/apache-question-answer-for-interview.html
Pending: Troubleshooting and Error codes, Logs important entries.

Friday, 11 March 2016

DNS Interview Qeustions - BIND

What does BIND Stands for ?
Ans:  BIND stands for Berkeley Internet Name Domain.


What is Root name server?
Root name server is an authoritative name server for the root domain (for the dot). Each root name server is a primary server, which differentiates it from other name servers. 

What is Stealth name server?
Stealth name server is a secret server. This type of name server is not published anywhere. It is only known to the servers that have its IP address statically listed in their configuration. It is an authoritative server. It acquires the data for the zone with the help of a zone transfer. It can be the main server for the zone. Stealth servers can be used as a local backup if the local servers are unavailable. 

What do you mean by "Resource Records"?
Information on domain names and their IP addresses, as well as all the other information distributed via DNS is stored in the memory of name servers as Resource Records(RR).

Explain "TTL"?
Time to live. A 32-bit number indicating the time the particular RR can be kept valid in a server cache. When this time expires, the record has to be considered invalid. The value 0 keeps nonauthoritative servers from saving the RR to their cache memory.

Tell me 5 Types of DNS records?
A, NS, CNAME, SOA, PTR, MX.

Explain "SOA Record"?
The Start of Authority(SOA) record determines the name server that is an authoritative source of information for the particular domain. There is always only one SOA record in the file, and it is placed at the beginning of the file of authoritative resource records. 

What is "A Record"
A (Address) records assign IP addresses to domain names of computers. The IP address cannot have a dot at the end. 

Explain "CNAME Record"?
Synonyms to domain names can be created using CNAME records. This is often referred to as 'creating aliases for computer names'. 

What are "HINFO and TXT Records"?
HINFO and TXT records are for information only. An HINFO record has two items in its data part. The first item is information about hardware, and the second one is information about software. A TXT record contains a general data string in its data part.
Example :
test.com IN SOA …

mail IN A 192.1.1.2
IN HINFO My_Server UNIX
IN TXT my server 

What are "MX Records"?
MX records specify the mailing server of the domain. An MX record shows to which computer a mail of a particular domain should be sent. The MX record also includes a priority number, which can be used to determine several computers where the mail for the domain can be sent. The first attempt is to deliver the mail to the computer with the highest priority (lowest value). If this attempt fails, the mail goes to the next computer (with a higher priority value), and so on.
test.com IN SOA …

mail                IN        A         192.1.1.2
IN       HINFO    AlphaServer UNIX
IN       TXT       my  server
IN       MX   30    mail2.nextstep4it.com
IN        MX   20    mail3.nextstep4it.com
IN        MX   10    mail2.nextstep4it.com

Explain "PTR Records"?
A Pointer Record(PTR) is used to translate an IP address into a domain name.

What is Dynamic DNS?
Dynamic DNS a method of keeping a domain name linked to a changing IP address as not all computers use static IP addresses. Typically, when a user connects to the Internet, the user's ISP assigns an unused IP address from a pool of IP addresses, and this address is used only for the duration of that specific connection. This method of dynamically assigning addresses extends the usable pool of available IP addresses. A dynamic DNS service provider uses a special program that runs on the user's computer, contacting the DNS service each time the IP address provided by the ISP changes and subsequently updating the DNS database to reflect the change in IP address.

What is the default port of BIND ?
Ans: The BIND server is accessed via the network on port 53. Both TCP and UPD ports are used. Queries are made via UDP & Responses are made via UDP unless the response is too large to fit in a single packet , If the response won’t fit in a single UDP packet, then the response is returned via TCP.


What are zone files in DNS server ?
Ans: The files which contain the data being served by the DNS system are called “Zone Files” They are made up of a series of “Resource Records”. A Zone File will always contain an SOA record as well as additional records.

What are the different types of DNS Server ?
Ans:  
Primary Master : The authoritative server where the master copy of the zone data is maintained is called the primary master server, or simply the primary. Typically it loads the zone contents from some local file edited by humans or perhaps generated mechanically from some other local file which is edited by humans. This file is called the zone file or master file.
Slave Server :  The other authoritative servers, the slave servers (also known as secondary servers) load the zone contents from another server using a replication process known as a zone transfer. Typically the data are transferred directly from the primary master, but it is also possible to transfer it from another slave. In other words, a slave server may itself act as a master to a subordinate slave server.
Caching Name Server : Caching Name server is not authoritative for any zone, all queries are forwarded to other DNS servers if they are not stored in the DNS-cache zone. Answers for all queries are cached in DNS-cache zone for a time.
Forwarding : In this type of DNS server , all queries are forwarded to a specific list of name servers

How the load balancing is achieved using DNS ?
Ans: A primitive form of load balancing can be achieved in the DNS by using multiple records (such as multiple A records) for one name. For example, if you have three WWW servers with network addresses of 10.0.0.1, 10.0.0.2 and 10.0.0.3, a set of records such as the following means that clients will connect to each machine one third of the time
multiple-a-records
When a resolver queries for these records, BIND will rotate them and respond to the query with the records in a different order. In the example above, clients will randomly receive records in the order 1,2, 3; 2, 3, 1; and 3, 1, 2. Most clients will use the first record returned and discard the rest.

How to check syntax of named.conf is correct or not ?
Ans: named-checkconf is the command,  which checks the syntax of  named.conf file.
# named-checkconf /etc/named.conf
If bind is running in chroot environment use below command
# named-checkconf -t /var/named/chroot /etc/named.conf
What are the different types of Resource Records in bind ?
Ans: Below are the list of resource records in bind :
SOA – start of authority, for a given zone
NS – name server
A – name-to-address mapping
PTR – address-to-name mapping
CNAME – canonical name (for aliases)
MX – mail exchanger (host to receive mail for this name)
TXT – textual info
RP – contact person for this zone
WKS – well known services
HINFO – host information
Comments start with ; continue to end of line

Explain Bind chroot environment ?
Ans: Running bind in a chroot environment means named process will be limited to their directory only (/var/named/chroot). This can help improve system security by placing BIND in a ”sandbox”, which will limit the damage done if a server is compromised.

What is domain delegation in Bind ?
Ans: Domain delegation means fully delegate the responsibility for a sub-domain to another name server.
Exmaple :
squid.linuxtechi.com      IN NS       ns2.linuxtechi.com
ns2.linuxtechi.com         IN A          192.168.1.51