NFS server resource usage Problems

Source: Internet
Author: User

We have explained how to install and configure NFS servers. Here we will mainly discuss NFS security and resource usage issues. First, let's take a look at NFS security issues. In some firewall configurations, we can perform the following operations.

NFS security questions:

1 Iptables Firewall

If our NFS server is behind the firewall, you need to add the following policies to the fire prevention policy:

 
 
  1. -A INPUT -p tcp -m state --state NEW -m multiport --dport 111,2049,4001,32764:32767 -j ACCEPT  
  2. -A INPUT -p udp -m state --state NEW -m multiport --dport 111,2049,4001,32764:32767 -j ACCEPT 

2. Use/etc/hosts. allow and/etc/hosts. deny to control Client Access

The/etc/hosts. allow and/etc/hosts. deny files are the configuration files of The tcpd server. The tcpd server can control the access of external IP addresses to local services. The two configuration files are in the following format:

# Service process name: Host list: optional command operation when the rule matches

 
 
  1. server_name:hosts-list[:command] 

/Etc/hosts. allow controls access to the local IP address, and/etc/hosts. deny controls prohibit access to the local IP address. If the configurations of the two files conflict, use/etc/hosts. deny. The following is an example of/etc/hosts. allow:

 
 
  1. ALL: 127.0.0.1 # Allow the local machine to access ALL service processes on the local machine
  2. Smbd: 192.168.0.0/255.255.255.0 # Allow IP addresses of the 192.168.0. network segment to access the smbd service

The "ALL" keyword matches ALL cases. The "Deny t" keyword matches ALL cases EXCEPT some items. PARANOID matches the IP address you want to control and the domain name does not match (the domain name is disguised.

For example, set the/etc/hosts. deny file on the server as follows:

 
 
  1. # cat /etc/hosts.deny  
  2. portmap:192.168.102.15 

Then load the shared directory on the client 192.168.102.15.

 
 
  1. #  mount 192.168.102.47:/home/share /mnt  
  2. mount to NFS server '192.168.102.47' failed. 

We found that the shared directory cannot be loaded now.

Resource usage

In addition to using the mount command to manually mount shared resources, you can also use other methods to automatically mount shared resources:

1. automatic mounting upon startup

Modify the/etc/fstab file of the client and add the following lines:

 
 
  1. 192.168.102.47:/home/share      /mnt    nfs     rsize=8192,wsize=8192,timeo=14,intr 

Restart the client to automatically mount shared resources when the system starts.

2. Use autofs to mount Resources

Autofs uses the automount daemon to manage your mount points. It dynamically mounts them only when the file system is accessed. Autofs queries the master configuration file/etc/auto. master to determine which mount points to define. Then, it starts the automount process using parameters that apply to each mount point. Each row in the main configuration defines a mount point, and then uses a separate configuration file to define the file system to be mounted under the mount point
.
Install autofs on the NFS server

 
 
  1. # aptitude  install autofs 

Modify the/etc/auto. master File and add the following content:

 
 
  1. /mnt      /etc/auto.nfs 

Create the/etc/auto. nfs file as follows:

 
 
  1. nfs -rw,soft,intr,rsize=8192,wsize=8192 192.168.102.47:/home/share 

In this way, whenever you enter the/mnt/nfs directory, the system will try to mount the server's shared resources to this directory. Note that the nfs directory is dynamically created by automount and does not exist on the customer's machine.

 
 
  1. tonybox2:/# cd /mnt  
  2. tonybox2:/mnt# ls  
  3. tonybox2:/mnt# cd nfs  
  4. tonybox2:/mnt/nfs# ls  
  5. 123  
  6. tonybox2:/mnt/nfs# ls -l  
  7. total 4  
  8. -rw-r--r-- 1 nobody nogroup 6 2006-08-22 07:50 123  
  9. tonybox2:/mnt/nfs# 

If the/etc/auto. master configuration file is modified, run

 
 
  1. #/etc/init.d/autofs reload 

Reload the NFS server.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.