Difference between revisions of "NFS: Konfigurasi Server"

From OnnoWiki
Jump to navigation Jump to search
Line 1: Line 1:
1. Introduction
+
==Pendahuluan==
  
The Network File System is certainly one of the most widely used network services. Network file system (NFS) is based on the Remote procedure call. It allows the client to automount and therefore, transparently access the remote file systems on the network.
+
[[Network File System]] ([[NFS]]) merupakan salah satu layanan jaringan yang banyak digunakan. [[NFS]] memungkinkan client untuk menempelkan harddisk yang ada di jaringan.
2. Scenario
 
  
In this scenario we are going to export the file system from the linuxconfig.org (IP address 10.1.1.200) host and mount it on linuxconfig.local(IP address 10.1.1.100).
 
3. Prerequisites
 
  
At this point, we assume that the NFS service daemon is already installed on your system, including portmap daemon on which NFS setupt depends. Moreover, your system needs to support the NFS file system.
+
==Skenario==
 +
 
 +
Dalam skenario ini kita akan menempelkan harddisk yang ada di linuxconfig.org ([[IP address]] 10.1.1.200) ke client [[IP address]] 10.1.1.100).
 +
 
 +
==Persyaratan==
 +
 
 +
Install [[NFS]]
 +
 
 +
apt-get install nfs-common nfs-kernel-server
 +
 
 +
Pastikan mesin kita mendukung [[NFS]] ketik
  
 
  $ cat /proc/filesystems  
 
  $ cat /proc/filesystems  
 +
 +
nodev nfs
 +
nodev nfs4
 +
nodev nfsd
 +
  
 
NFS file system supported
 
NFS file system supported

Revision as of 14:47, 2 October 2010

Pendahuluan

Network File System (NFS) merupakan salah satu layanan jaringan yang banyak digunakan. NFS memungkinkan client untuk menempelkan harddisk yang ada di jaringan.


Skenario

Dalam skenario ini kita akan menempelkan harddisk yang ada di linuxconfig.org (IP address 10.1.1.200) ke client IP address 10.1.1.100).

Persyaratan

Install NFS

apt-get install nfs-common nfs-kernel-server

Pastikan mesin kita mendukung NFS ketik

$ cat /proc/filesystems 
nodev	nfs
nodev	nfs4
nodev	nfsd


NFS file system supported

NFS daemon should be listening on both standard ports 2049 and portmap on port 111.

NFS daemon port 2049 portmap port 111 Another way to check if NFS is functioning, is to use the rpcinfo command.

# rpcinfo -p  

You should get a response/output similar to one below:

check if NFS is functioning

4. Server export file

All NFS server exports need to be defined in /etc/exports file. 4.1. Most common exports options

Here are the most common export techniques and options: /home/nfs/ 10.1.1.100(rw,sync) export /home/nfs directory for host with IP 10.1.1.100 with read, write permissions, and synchronized mode /home/nfs/ 10.1.1.0/24(ro,sync) export /home/nfs directory for network 10.1.1.0 netmask 255.255.255.0 with read only permissions and synchronized mode /home/nfs/ 10.1.1.100(rw,sync) 10.1.1.10(ro,sync) export /home/nfs directory for host with IP 10.1.1.100 with read, write permissions, synchronized mode, and also export /home/nfs directory for hosts with IP 10.1.1.10 with read only permissions and synchronized mode /home/nfs/ 10.1.1.100(rw,sync,no_root_squash) export /home/nfs directory for host with IP 10.1.1.100 with read, write permissions, synchronized mode and the remote root user will be treated as a root and will be able to change any file and directory. /home/nfs/ *(ro,sync) export /home/nfs directory for any host with a read only permission and synchronized mode /home/nfs/ *.linuxconfig.org(ro,sync) export /home/nfs directory for any host within linuxconfig.org domain with a read only permission and synchronized mode /home/nfs/ foobar(rw,sync) export /home/nfs directory for hostname foobar with read, write permissions and synchronized mode 4.2. Edit exports file

Open up your favorite text editor, for example, vim and edit /etc/exports file and add line /home/nfs/ *(ro,sync) to export /home/nfs directory for any host with read only permissions. edit NFS exports file

Be sure that the directory you export by NFS exists. You can also create a file inside the /home/nfs directory which will help you troubleshoot once you mount this file system remotely.

# touch /home/nfs/test_file 

4.3. Restart NFS daemon

Once you edit /etc/exports file you need to restart NFS daemon to apply changes in the /etc/exports file. Depending on your Linux distribution, the restarting of NFS may differ. Debian users:

# /etc/init.d/nfs-kernel-server restart 

Redhat users

# /etc/init.d/nfs restart 

If you later decide to add more NFS exports to the /etc/exports file, you will need to either restart NFS daemon or run command exportfs:

# exportfs -ra 

Referensi


Pranala Menarik