Showing posts with label DNS. Show all posts
Showing posts with label DNS. Show all posts

Tuesday, July 2, 2013

Linux Interview Questions

1. How to find out the execution details of a cronjob ?
#crontab –l –u <usename>

2. How to modify the kernel parameters on the fly ?
Usually its done by sysctl and also by echo <value> redirect to /proc/some-files.

3. How to make the modification of the kernel parameters permanent across reboot ?
I think you can add your parameters and values into sysctl.conf. after reboot, it will be read by the run level scripts. Need to check again yar. Another way to do is to write a shell script and add that to init run level scripts.

4. How does a server resolve DNS queries? What are the configuration files which assist in resolving a DNS query of a server ?
Don’t know how does the server resolves DNS query. But this is the concept:
When a client host requests information from a nameserver, it usually connects to port 53. The nameserver then attempts to resolve the name requested. If it does not have an authoritative answer, or does not already have the answer cached from an earlier query, it queries other nameservers, called root nameservers, to determine which nameservers are authoritative for the name in question, and then queries them to get the requested name.
In RHEL, you edit the named.conf, add FQDN of a host into it. This FQDN is called resource record. And is stored in tree structure e.g. in. is top level domain (root), then hcl is sub-domain, like that.

On server, named.conf resolves DNS queries. On client side, resolv.conf is used to find the nameserver.

5 What is the port by which default traffic of NFS is allowed to pass ?
Port 2049 I guess. I tried this:
#grep nfs /etc/services

6. How does the NFS communication between NFS server and client happen ?
#Make entries of dir into /etc/exports
#service nfsd start
On client, mount the nfs share of the server.
#mount -t nfs -o options host:/remote/export /local/directory

The communication happens over TCP/UDP. Client connects to mountd on server via RPC. RPC connects to nfsd on server.

There is also autofs, using which you do not need to mount the server FS every time.do it in /etc/auto.master

7. How can a NFS exported filesystem be mounted manually on a NFS client ?
Described above

8. How can a file system be exported at boot time ?
Make an entry into /etc/fstab like this
server:/remote/export /local/directory nfs options 0 0

Thursday, June 27, 2013

Lets try Networking

Lets ping


Script to ping the network:

#/bin/bash
for i in 10.112.1.1..255}
do
ping $i > /dev/null
[$? -eq 0] && echo $i is up
trap "exit" SIGINT
done

Run the script.

Configure Network:

ifconfig = for static IP.
dhclient == for dynamic IP using DHCP.

#ifconfig -a
This shows the interface devices available.
Output as:
+ eth0 is ethernet card.
+ lo is loopback device.
+ wlan0 is wireless LAN card.

Assign Static IP:
#ifconfig eth0 10.112.1.15

The see the information on eth0:
#ifconfig eth0

Setting the subnet mask:
#ifconfig eth0 10.112.1.15 netmask 255.255.255.0

Now get your ethernet up (or down)
#ifup eth0
#ifdown eth0

Wireless Networking
Use following commands:
#iwconfig
#iwconfig wlan0 essid <name of wireless network>
#iwconfig wlan0 essid <name of wireless network> key <KEY>

Scan and check availability of wireless networks:
#iwlist
#iwlist wlan0 scan
#ifconfig wlan0 <IP>
#dhclient wlan0

The IP settings assigned above for LAN or WLAN, is not persistent after system reboot. For that:

#vi /etc/networks/interfaces
 Add below lineto configure eth0 as DHCP:
 auto eth0
iface eth0 inet dhcp

For static:
auto eth0
iface eth0 inet static
 address <IP>
netmask <netmask>
gateway <gw ip>

If its a wireless network, add below also:
wireless-essid <network-name>
wireless-key <key>

Now, restart network daemon:
#/etc/init.d/network restart

Spoofing a MAC ID:
#ifconfig eth0 hw ether <new hw address>
Use this command to change the MAC address of your network card.

DNS:
It provides name resolution. Look at below file for name server's IP.
#cat /etc/resolv.conf
nameserver <IP>

Search more at www.opendns.org

SSH
Make remote logins to other machines.
[MachineA]#ssh test@<IP>
[MachineB]$

sftp is extension of SSH to transfer files.
#sftp  test@<IP>
sftp>get abc

To download files, use get command. To upload files, use put command.

sshfs is another extension of SSH to mount directories ona remote machine.
#sshfs test@<IP>:/home/test /mnt/test