Tuesday, June 16, 2015

NFS Interview Q




Q. What is NFS?

NFS is a network file system, which allows remote hosts to mount file system over a network and interact with those file systems as though they are mounted locally.


Q. NFS uses?

NFS is used for sharing files and directories throughout the network.


Q. What are the port numbers for nfs?

2049(nfsd), 111(port map)


Q. what are the demons for nfs?

Rpc.nfsd, rpc.lockd, rpc.quota.d, rpc.mountd


Q. NFS uses which protocol?

Nfsv4 uses TCP, nfsv3 and nfsv2 uses UDP


Q: - Explain this entry /shared 192.168.1.0/24(sync,rw)

Allows all systems with 192.168.1.* IP addresses read-write access to the /shared directory


Q: - What will happened if a space is given in between allowed hosts and (options) If a space is included, the options are applied to any and all IP addresses, which can be quite dangerous if write permission is granted.


Q: - What is the role of "sync" option for NFS server sync is used to synchronize the data from server to client. The sync option is recommended because it follows the NFS protocol.


Q: - How to retrieve a list of clients connected to the NFS server? To retrieve a list of clients connected to the NFS server, use the showmount command from a shell prompt. To also show the directories the clients are connected to, use the ex: showmount –e 192.168.0.112

Q: - Name of Configuration file for NFS Server? /etc/exports

Q: - What is meaning of "no_root_squash" option ? Treat remote root user as local root. Do not map requests from root to the anonymous user and group ID.


Q: - What is NFS ? NFS stands for Network File System. NFS was originally developed by Sun Microsystems in the 1980's. NFS allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.


Q: - Which NFS versions are available ? NFS Version 2 NFS Version 3 NFS Version 4


Q: - What is different between NFS Version 2 & 3 ? nfs 2 default 8kb transfer rate,it did not check the authentication at the time connection.client wants to access unauthorized file it shows error messages like "write error","read error" nfs 3 32kb transfer rate. It check at the time connection- ACL Support


Q: - Can we grant access by Username and password for nfs share?

No, access is granted only for IP address.


Q: - What is the role of "all_squash" option?

Treat all client users as anonymous users. Map all user and group IDs to the anonymous user and group ID.


Q: - What is the role of "root_squash" option?

All requests from the user root are translated or mapped as if they came from the user anonymous (default).


Q: - Explain option "all_squash"?

The UID and GID of exported files are mapped to the user anonymous. It is good for public directories.


Q: - Explain "exportfs" command?

The exportfs command is used to maintain the current table of exported file systems for NFS.


Q: - Explain command "/usr/sbin/exportfs -f"?

It will flush everything out of the kernels export table. Any clients that are active will get new entries added by mountd when they make their next request.


Q: - Which option is used with exportfs command to display the current export list, also displays the list of export options?

exportfs –v


Q: - Which option is used with exportfs command to re-export all directories?

exportfs –r


Q: - Is rpc.mountd daemon supports TCP_WRAPPERS?

Yes, The rpc.mountd daemon is protected by the tcp_wrappers. You have to give the clients access to rpc.mountd if they should be allowed to use NFS Server.


Q: - Explain "nfsstat" command?

The nfsstat command displays the statistics about NFS client and NFS server activity.


Q: - What do you understand by "nfsstat -o all -234" command?

It will Show all information about all versions of NFS.


Q: - What do you understand by "nfsstat --nfs --server -4" command?

It will show statistics for NFS version 4 server.


Q: - Can NFS share mounted on Window XP and Justify your answer?

No, Window XP operating system doesn’t support nfs protocol.


Q: - 192.168.0.117:/data is exported by NFS Server and i want to add this NFS share to client /etc/fstab file. How you will add this entry in /etc/fstab file?

#Device name #mount-point # fs-type #options #dump #fsckorder

192.168.0.117:/data /mnt nfs defaults 0 0

Q: - Explain "Soft Mounting" option at NFS Client? if a file request fails, the NFS client will report an error to the process on the client machine requesting the file access. if it cannot be satisfied (for example, the server is down), then it quits. This is called soft mounting.


Q: - Explain "Hard Mounting" option at NFS Client?

If a file request fails, the NFS client will report an error to the process on the client machine requesting the file access. if it cannot be satisfied, then it will not quit until the request is satisfied. This is called Hard mounting.


Q: Explain "intr" option at NFS Client?

Allows nfs requests t be interrupted or killed if the server is unreachable


Q: Explain "nolock" option at NFS Client?

It disables the file locking and allows the interoperation


Q: - What is "portmap"?

The portmapper keeps a list of what services are running on what ports. This list is used by a connecting machine to see what ports it wants to talk to access certain services.


Q: - How you will check "portmap" service is running or not?

rpcinfo –p 192.168.0.117


Q: - I am unable to mount a NFS share. How will you trace out the reason?

Firstly, check that you have permissions to mount nfs share or not. Check /etc/exports file.

Secondly you can get RPC error: Program Not Registered (or another "RPC" error)

For this check your NFS server and portmap service running or not by "rpcinfo -p"


Q: Can I modify export permissions without needing to remount clients in order to have them take effect?

Yes. The safest thing to do is edit /etc/exports and run "exportfs -r"


Q. How to restart the services for nfs?

Service nfs restart


Q. How to enable the nfs server after reboot?

Chkconfig nfs on

Interview questions on Port numbers


Q. What Is a Port Number?

 A port number is part of the addressing information used to identify the senders and receivers of messages. Port numbers are most commonly used with TCP/IP connections. Home network routers and computer software work with ports and sometimes allow you to configure port number settings. These port numbers allow different applications on the same computer to share network resources simultaneously.

-----------------------------------------------------------------------------------------------

Q. What is the range of ports or how many ports are there? Port numbers can vary from 0 to 65535, so total we can get 65536 ports -----------------------------------------------------------------------------------------------
Q. Why port numbers are just 65536? This is because limitation in TCP/IP stack where the port field is just 16bit size. So we get only 2^16 port which is equal to 65536 ports

Port numbers have a range of 0..65535 (although often 0 has special meaning). In the original BSD TCP implementation, only root can bind to ports 1..1023, and dynamically assigned ports were assigned from the range 1024..5000; the others were available for unprivileged static assignment. These days 1024..5000 is often not enough dynamic ports, and IANA has now officially designated the range 49152..65535 for dynamic port assignment. However even that is not enough dynamic ports for some busy servers, so the range is usually configurable (by an administrator). On modern Linux and Solaris systems (often used as servers), the default dynamic range now starts at 32768. Mac OS X and Windows Vista default to 49152..65535.

-----------------------------------------------------------------------------------------------

[root@desktop12 ~]# cat /proc/sys/net/ipv4/ip_local_port_range

32768   61000

solaris$ /usr/sbin/ndd /dev/tcp tcp_smallest_anon_port tcp_largest_anon_port

32768

65535

macosx$ sysctl net.inet.ip.portrange.first net.inet.ip.portrange.last

net.inet.ip.portrange.first: 49152

net.inet.ip.portrange.last: 65535

vista> netsh int ipv4 show dynamicport tcp

Protocol tcp Dynamic Port Range

Start Port : 49152

Number of Ports : 16384

-----------------------------------------------------------------------------------------------
Q.What are the well-known ports?
Well known ports are from 0 to 1023(total 2^10=1024 ports)
-----------------------------------------------------------------------------------------------
Q.What are the Registered Ports, and    (Range:  1024 to 49151 )

Used by specific service upon applications such as Oracle database listener (1521), MySql (3306), Microsoft Terminal server (3389) etc.

-----------------------------------------------------------------------------------------------

Q.What are the Dynamic and/or Private Ports. (Range: 49152 to 65535 )

These ports can’t be registered by IANA. 
This is used for custom or temporary purposes and for automatic allocation of short-lived (or ephemeral ) ports which is used internally by application/processes.
 You can see these ports by running ‘netstat’ command under “Local address” column.

-----------------------------------------------------------------------------------------------
Q.What do you mean by default port?

Default port is a designated port for particular well-known server.
 -----------------------------------------------------------------------------------------------
 Q.Can we change default port for a service(example Apache, squid)?

 Yes, we can change
 -----------------------------------------------------------------------------------------------
 Q.What are the protocol numbers for TCP and UDP?

 TCP protocol number:6 UDP protocol number:17
 -----------------------------------------------------------------------------------------------
 Q.How to find which ports are open? You can find the ports in your linux server with the nmap command

#netstat -ntlp   here n ->
 display the host by numbers          
 t  ->shows tcp protocols           
 u ->to check udp protocols           
 l ->listening ports         
 p -> displays which process controls the port

-----------------------------------------------------------------------------------------------
Q.How to find printer open ports  ?

[root@desktop1 Desktop]# netstat -ntlp |grep cups tcp        0      0  127.0.0.1:631               0.0.0.0:*                   LISTEN      1525/cupsd         tcp        0      0   ::1:631                             :::*                        LISTEN      1525/cupsd   

 -----------------------------------------------------------------------------------------------


Q. How to detect remote server openports?
 [root@desktop1 Desktop]# nmap -sT 192.168.0.250
 it will show like this PORT     STATE SERVICE
 21/tcp   open  ftp
 22/tcp   open  ssh
 25/tcp   open  smtp
 80/tcp   open  http
 -----------------------------------------------------------------------------------------------
 Q. How to change SSH port number?

[root@desktop1 Desktop]# netstat -ntlp | grep ssh tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1646/sshd          tcp        0      0 :::22                               :::*                        LISTEN      1646/sshd   

go to the configuration file

[root@desktop1 Desktop]# vim /etc/ssh/sshd_config

port=2200

save and quit
[root@desktop1 Desktop]# service sshd restart

Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

[root@desktop1 Desktop]# netstat -ntlp | grep ssh tcp   
0      0 0.0.0.0:2200                0.0.0.0:*                   LISTEN      11904/sshd         tcp        0      0 :::2200                          :::*                        LISTEN      11904/sshd      

now port num changed successfully

-----------------------------------------------------------------------------------------------
Q. rempte loggin with port number?


ssh -p 22 root@192.168.0.1


Some important port numbers:

20-FTP Data (For transferring FTP data)


21-FTP Control (For starting FTP connection)


22-SSH(For secure remote administration which uses SSL to encrypt the transmission)


23-Telnet (For insecure remote administration


25-SMTP(Mail Transfer Agent for e-mail server such as SEND mail)


53- DNS(Special service which uses both TCP and UDP)


68-DHCP


69-TFTP(Trivial file transfer protocol uses udp protocol for connection less transmission of data)


80 -HTTP/WWW(apache)


88-Kerberos


110-POP3(Mail delivery Agent)


123-NTP(Network time protocol used for time syncing uses UDP protocol)


137-NetBIOS(nmbd)


139,138,445-SMB-Samba(smbd)


143-IMAP


161-SNMP(For network monitoring)


389-LDAP(For centralized administration)


443-HTTPS(HTTP+SSL for secure web access)


514-Syslogd(udp port)


995-POP3s


3260-ISCSI


3128-squid proxy


631-Printers(cups)


2049-NFS(nfsd, rpc.nfsd, rpc, portmap)


*If protocol is not mention then the above port are solely for TCP. Some service use UDP as mention in above list.