Windows.  Viruses.  Notebooks.  Internet.  office.  Utilities.  Drivers

NFS ( Network File System) is mainly designed for sharingfiles And folders between / Unix systems from Sun Microsystems V 1980. It allows you to mount local filesystems over the network and remote hosts to interact with them as if they were mounted locally on the same system. By using NFS, we can set up file sharing between Unix V linux system and linux for the system Unix.

Benefits of NFS

  1. NFS creates local access to remote files.
  2. It uses the standard architecture client/server to exchange files between all machines based on * NIX.
  3. By using NFS no need for both machines to run on the same OS.
  4. By using NFS we can customize the solution centralized storage.
  5. Users receive their data regardless of their physical location.
  6. Automatic update for new files.
  7. Newer Version NFS supports mounting acl, pseudo under root.
  8. Can be protected firewalls And Kerberos.

NFS Services

Service System V launched. Server package NFS includes three tools included in the packages portmap And nfs-utils.

  1. portmap: displays calls made from other machines to the correct service RPC(not required with NFSv4).
  2. nfs: converts remote requests public access to files to queries on the local file system.
  3. rpc.mountd: this service is responsible for mounting And unmount file systems.

Important configuration files for NFS

  1. /etc/exports: its main configuration file NFS, all exported files And catalogs, which are defined in this file and on destination NFS server.
  2. /etc/fstab: To mount NFS directory on your system without reboots, we need to write to /etc/fstab.
  3. /etc/sysconfig/nfs: Configuration file NFS to control which port RPC and other services auditions.

Setting up and mounting NFS on a Linux server

To set up a mount NFS, we will need at least two cars linux/Unix. Here in this tutorial, we will use two servers.

  1. NFS server: nfsserver.example.ru with IP - 192.168.0.55
  2. NFS client: nfsclient.example.ru with IP - 192.168.0.60

Installing NFS Server and NFS Client

We need to install packages NFS on our NFS server and also by car NFS client. We can set it with “ ” ( red hat Linux) and installation package “ apt-get” (Debian And ubuntu).

# yum install nfs-utils nfs-utils-lib # yum install portmap (not required with NFSv4) # apt-get install nfs-utils nfs-utils-lib

Now run services on both machines.

# /etc/init.d/portmap start # /etc/init.d/nfs start # chkconfig --level 35 portmap on # chkconfig --level 35 nfs on

After installing the packages and starting the services on both machines, we need to set up both machines to share files.

Setting up an NFS server

Let's set up the server first NFS.

Setting up an export directory

# mkdir /nfsshare

Now we need to write to " /etc/exports" And restart services to make our directory shared across the network.

# vi /etc/exports /nfsshare 192.168.0.60(rw,sync,no_root_squash)

In the example above, there is a directory under / entitled " nfsshare“, currently shared with client IP “ 192.168.0.60 ” with privileges reading And records (RW), you can also use hostname client instead IP in the above example.

NFS Options

Some other options we can use in files “ /etc/exports” for file sharing is as follows.

  1. ro: With this option, we can provide read-only access to shared files, that is client will only be able read.
  2. rw: This option allows client to server access for both reading And records within the general directory.
  3. sync: Synchronization acknowledges requests to the shared directory only after changes have been committed.
  4. no_subtree_check: This option prevents checking subtree. When a shared directory is a subdirectory of a larger file system, NFS performs a scan of each directory above it to check its permissions and details. Disabling validation subtree can improve reliability NFS, but reduce safety.
  5. no_root_squash: This phrase allows root, connect to a specific folder.

For more options with “ /etc/exports“, it is recommended to read pages guides for export.

Configuring an NFS Client

After setting NFS-server, we need mount this shared directory or partition on client server.

Mounting shared directories on an NFS client

Now on NFS client, we need mount this directory to access it locally. To do this, first we need to find out what resources are available on the remote or NFS server.

# showmount -e 192.168.0.55 Export list for 192.168.0.55: /nfsshare 192.168.0.60

Mounting an accessible directory on NFS

In order to mount general NFS directory, we can use the following mount command.

# mount -t nfs 192.168.0.55:/nfsshare /mnt/nfsshare

The above command will set the shared directory to “ /mnt/nfsshare” on the client server. You can test it with the following command.

# mount | grep nfs sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) nfsd on /proc/fs/nfsd type nfsd (rw) 192.168.0.55:/nfsshare on /mnt type nfs (rw,addr=192.168.0.55)

The above mount command mounts on NFS shared directory on NFS Client temporarily to mount an NFS directory constantly on your system regardless of reboots, we need to make an entry in “ /etc/fstab“.

#vi /etc/fstab

Add the following new line as shown below.

192.168.0.55:/nfsshare /mnt nfs defauls 0 0

Testing the Behavior of an NFS Installation

We can test our installing an NFS server by creating test file on the server side and check for its existence on NFS Client side or vice versa.

Server side nfsserver

We have created a new text file named “ nfstest.txt” in this shared directory.

# cat > /nfsshare/nfstest.txt This is a test file to test the working of NFS server setup.

Client side nfsclient

Change to the shared directory at client server and you will find the shared file without any manual update or service restart.

# ll /mnt/nfsshare total 4 -rw-r--r-- 1 root root 61 Sep 21 21:44 nfstest.txt [email protected]~]# cat /mnt/nfsshare/nfstest.txt This is a test file to test the working of NFS server setup.

Removing an NFS mount

If you want to unmount this shared directory from the server after you are done with file sharing you can just unmount this particular directory with the command “ umount“. See this example below.

[email protected]~]# umount /mnt/nfsshare

You can see that the mount has been removed on the file system.

# df -h -F nfs

You will see that these shared directories are no longer available.

Important commands for NFS

Some more important commands for NFS .

  1. showmount -e: Shows available shared objects on local computer
  2. showmount -e : List of available shared objects on remote server
  3. showmount -d: List of all subdirectories
  4. exportfs -v: Displays a list of shared files And options on server
  5. exportfs -a: Export all available objects listed in /etc/exports, or name
  6. exportfs -u: Re-export all available objects listed in /etc/exports, or name
  7. exportfs -r: Update server list after change /etc/exports

It's all about NFS mount on this moment, if interested, you can read the guide about . Leave your

The essence of the problem: at one time, Samsung began to produce TVs that support the DLNA technology developed by leading manufacturers of household appliances, based on the principle of "digital home". This technology made it possible to integrate TVs into the local home network, which made it possible to exchange media content between a TV and a computer, and in particular, to watch movies on TV stored on a computer via local network or via WiFi. However, the multimedia solution proposed by Samsung to implement this technology, to put it mildly, leaves much to be desired. So, films viewed over the network in the media player built into the TV are not rewound in most cases. In addition, while watching movies on the network, as opposed to watching movies from a flash drive or portable hard drive connected to the TV via the USB port, the seamless playback function (blue button on the remote control) is not supported. Finally, the very need to run Samsung PC Share Manger on your computer every time and make corrections after each deletion or addition of video files to the disk is a little annoying.

Not only to eliminate the existing problems with watching movies on TV over a local network, but also to increase the data transfer rate (which can be an important factor when watching large HD movies), the inclusion of the NFS (Network File System) network protocol will help us. After we make necessary installation and setting up the NFS server, our computer will be perceived by the TV as if we had connected a portable HDD to TV via USB port (the only difference will be only in the data exchange rate, which is determined by the maximum throughput your local network or WiFi connection).

NFS is network protocol organized according to the "server-client" principle. We will have a computer as a server, and a TV as a client. We have already covered the inclusion of NFS support on the TV in the previous section during the setup and installation of the SamyGO Auto application on the TV. If you remember, in the settings of the SamyGO Auto configurator, we checked the box next to the NFS section and also registered the IP address of the NFS server (192.168.xxx.xxx), that is, the address of our computer:
In this section, we will look at installing and configuring an NFS server on our computer. There are many different programs on the Internet for installing and configuring an NFS server. We will use the application haneWIN NFS Server(it is shareware, and after a certain period it requires registration of a serial number, but, as you understand, there are always craftsmen on the Internet who can solve this problem). So let's get started:

Note: Sometimes the Windows firewall or the firewall built into the antivirus can block the operation of the NFS server. Whatever happens, in Windows firewall(or if you have a different firewall, then in it) you need to allow access to the network to two applications: nfsd.exe and pmapd.exe (they are located in the server installation folder C:\Program Files\nfsd).


Finally, let's turn on the TV and make sure our NFS server is running. In the previous section, when we installed the SamyGO Auto program on the TV, we specified the parameter for autorun in it. Therefore, when you turn on the TV, it should automatically detect our NFS (this does not happen immediately, but approximately 20 seconds after turning on the TV). So, turn on the TV, then go to the media player and see a new device there - NFS Server.

If you pay attention, there is a USB connection icon next to NFS. This is what we talked about earlier, now your TV will treat the computer as a hard drive or USB flash drive. You can go to the Movie section and enjoy watching movies online. You no longer need to run Samsung PC Share Manger on your computer. Just add the movie to your movie folder on your computer and it will automatically "load" into your TV's media player.

In the next section, we will talk about how to record TV programs to a USB flash drive or, since we now have NFS, then to the movie folder on the computer.


Good time, readers and guests. There was a very long break between posts, but I'm back in battle). In today's article, I'll look at operation of the NFS protocol, and setting up NFS server and NFS client on Linux.

Introduction to NFS

NFS (Network File System - network file system) in my opinion - an ideal solution in a local network where fast (faster compared to SAMBA and less resource-intensive compared to encrypted remote file systems - sshfs, SFTP, etc ...) data exchange is needed and is not at the forefront security of transmitted information. NFS protocol allows mount remote filesystems over the network into a local directory tree, as if it were a mounted disk file system. Thereby local applications can work with the remote file system as with the local one. But you need to be careful (!) with configuring NFS , because with a certain configuration, you can hang the client operating system waiting for endless I/O. NFS protocol based on work RPC protocol, which is beyond my understanding yet)) so the material in the article will be a little vague... Before you can use NFS, be it a server or a client, you must make sure that your kernel has support for the NFS file system. You can check if the kernel supports the NFS file system by looking for the corresponding lines in the file /proc/filesystems:

ARCHIV ~ # grep nfs /proc/filesystems nodev nfs nodev nfs4 nodev nfsd

If the specified lines in the file /proc/filesystems does not appear, then you need to install the packages described below. This will most likely install dependent kernel modules to support the desired filesystems. If, after installing the packages, NFS support is not displayed in the specified file, then it will be necessary to enable this feature.

Story Network File System

NFS protocol developed by Sun Microsystems and has 4 versions in its history. NFSv1 was developed in 1989 and was experimental, worked on the UDP protocol. Version 1 is described in . NFSv2 was released in the same 1989, described by the same RFC1094 and also based on the UDP protocol, while allowing to read no more than 2GB from a file. NFSv3 finalized in 1995 and described in . The main innovations of the third version were support for large files, added support for the TCP protocol and large TCP packets, which significantly accelerated the technology's performance. NFSv4 finalized in 2000 and described in RFC 3010, revised in 2003 and described in . The fourth version included performance improvements, support for various authentication tools (in particular, Kerberos and LIPKEY using the RPCSEC GSS protocol) and access control lists (both POSIX and Windows types). NFS version v4.1 was approved by the IESG in 2010 and was given the . An important innovation in version 4.1 is the specification pNFS - Parallel NFS, a mechanism for NFS client parallel access to data from multiple distributed NFS servers. The presence of such a mechanism in the network file system standard will help to build distributed "cloud" ("cloud") storage and information systems.

NFS server

Since we have NFS- This network file system, you need . (You can also read the article). Next is necessary. On Debian, this is the package nfs-kernel-server And nfs-common, in RedHat it is a package nfs-utils. And also, it is necessary to allow the launch of the daemon at the required run levels of the OS (the command in RedHat is /sbin/chkconfig nfs on, in Debian - /usr/sbin/update-rc.d nfs-kernel-server defaults).

Installed packages in Debian are run in the following order:

ARCHIV ~ # ls -la /etc/rc2.d/ | grep nfs lrwxrwxrwx 1 root root 20 Oct 18 15:02 S15nfs-common -> ../init.d/nfs-common lrwxrwxrwx 1 root root 27 Oct 22 01:23 S16nfs-kernel-server -> ../init.d /nfs-kernel-server

That is, first run nfs-common, then the server itself nfs-kernel-server. In RedHat the situation is similar, with the only exception that the first script is called nfslock, and the server is called simply nfs. Pro nfs-common The debian site literally tells us the following: shared files for an NFS client and server, this package must be installed on the machine that will act as an NFS client or server. The package includes programs: lockd, statd, showmount, nfsstat, gssd and idmapd. By viewing the contents of the startup script /etc/init.d/nfs-common you can track the following sequence of work: the script checks for the presence of an executable binary file /sbin/rpc.statd, checks for presence in files /etc/default/nfs-common, /etc/fstab And /etc/exports options that require daemons to start idmapd And gssd , starts the daemon /sbin/rpc.statd , then before launch /usr/sbin/rpc.idmapd And /usr/sbin/rpc.gssd checks for the presence of these executable binaries, then for daemon /usr/sbin/rpc.idmapd checks for availability sunrpc, nfs And nfsd, as well as file system support rpc_pipefs in the kernel (that is, its presence in the file /proc/filesystems), if everything is successful, then it launches /usr/sbin/rpc.idmapd . Additionally, for the demon /usr/sbin/rpc.gssd checks rpcsec_gss_krb5 kernel module and starts the daemon.

If you view the content NFS server startup script on Debian ( /etc/init.d/nfs-kernel-server), then the following sequence can be traced: at startup, the script checks for the existence of the file /etc/exports, Availability nfsd, availability of support NFS file system in (that is, in the file /proc/filesystems), if everything is in place, then the daemon starts /usr/sbin/rpc.nfsd , then checks if the parameter is set NEED_SVCGSSD(set in the server settings file /etc/default/nfs-kernel-server) and, if given, starts the daemon /usr/sbin/rpc.svcgssd , last to start the daemon /usr/sbin/rpc.mountd . This script shows that The operation of an NFS server consists of daemons rpc.nfsd, rpc.mountd, and if Kerberos authentication is used, then the rcp.svcgssd daemon. The rpc.rquotad and nfslogd daemons are still running in the red hat (For some reason, I did not find information about this daemon and the reasons for its absence in Debian, apparently removed ...).

From this it becomes clear that The Network File System server consists of the following processes (read - daemons) located in /sbin and /usr/sbin directories:

In NFSv4, when using Kerberos, daemons are additionally launched:

  • rpc.gssd- NFSv4 daemon provides authentication methods via GSS-API (Kerberos authentication). Works on client and server.
  • rpc.svcgssd- An NFSv4 server daemon that provides server-side client authentication.

portmap and RPC protocol (Sun RPC)

In addition to the above packages, NFSv2 and v3 require additional package portmap(in newer distributions replaced by renamed to rpcbind). Current Package usually installed automatically with NFS as dependent and implements the work of the RPC server, that is, it is responsible for dynamic port assignment for some services registered with the RPC server. Literally, according to the documentation, this is a server that converts RPC program numbers ( Remote Procedure Call) to TCP/UDP port numbers. portmap operates on several entities: RPC calls or requests, TCP/UDP ports,protocol version(tcp or udp), program numbers And software versions. The portmap daemon is started by the /etc/init.d/portmap script before the NFS services start.

In short, the job of an RPC (Remote Procedure Call) server is to process RPC calls (so-called RPC procedures) from local and remote processes. Using RPC calls, services register or delete themselves in / out of the port mapper (aka portmapper, aka portmap, aka portmapper, aka, in new versions, rpcbind), and clients using RPC calls direct requests to portmapper receive the necessary information. User-friendly program service names and their corresponding numbers are defined in the /etc/rpc file. As soon as any service has sent the corresponding request and registered itself on the RPC server in the port mapper, the RPC server assigns the TCP and UDP service the ports on which the service started and stores in the kernel the relevant information about the running service (about the name), a unique number service (according to /etc/rpc) , the protocol and port on which the service is running and the version of the service, and provides the specified information to clients upon request. The port resolver itself has a program number (100000), a version number of 2, TCP port 111 and UDP port 111. Above, when specifying the composition of the NFS server daemons, I indicated the main RPC program numbers. I probably confused you a little with this paragraph, so I will say the main phrase, which should clarify: the main function of the port mapper is to return to him (the client) the port on which the requested program is running. Accordingly, if a client needs to contact RPC with a specific program number, it must first contact the portmap process on the server machine and determine the port number to communicate with the RPC service it needs.

The operation of the RPC server can be represented by the following steps:

  1. The port resolver should start first, usually when the system boots. This creates a TCP endpoint and opens TCP port 111. It also creates a UDP endpoint that waits for a UDP datagram to arrive on UDP port 111.
  2. At startup, a program running through an RPC server creates a TCP endpoint and a UDP endpoint for each supported version of the program. (An RPC server can support multiple versions. The client specifies the required version when making an RPC call.) A dynamically assigned port number is assigned to each version of the service. The server registers each program, version, protocol, and port number by making the appropriate RPC call.
  3. When an RPC client program needs to get the information it needs, it invokes a port resolver procedure to obtain a dynamically assigned port number for the given program, version, and protocol.
  4. In response to this request, the server returns the port number.
  5. The client sends an RPC Request message to the port number obtained in step 4. If UDP is used, the client simply sends a UDP datagram containing the RPC Call message to the UDP port number on which the requested service is running. In response, the service sends a UDP datagram containing an RPC response message. If TCP is used, the client actively opens to the TCP port number of the requested service and then sends a message RPC call on the established connection. The server responds with an RPC response message over the connection.

To get information from the RPC server, use the utility rpcinfo. When specifying parameters -p host the program lists all registered RPC programs on the host host. Without specifying a host, the program will display services on localhost. Example:

ARCHIV ~ # rpcinfo -p program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 59451 status 100024 1 tcp 60872 status 100021 1 udp 44310 nlockmgr 100021 3 udp 44310 nlockmgr 100021 4 udp 44310 nlockmgr 100021 1 tcp 44851 nlockmgr 100021 3 tcp 44851 nlockmgr 100021 4 tcp nfs 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100005 1 udp 51306 mountd 100005 1 tcp 41405 mountd 100005 2 udp 51306 mountd 100005 2 tcp 41405 mountd 100005 3 udp 51306 mountd 100005 3 tcp 41405 mountd

As you can see, rpcinfo displays (in columns from left to right) the registered program number, version, protocol, port, and name. With rpcinfo you can remove the registration of a program or get information about a particular RPC service (more options in man rpcinfo). As you can see, version 2 portmapper daemons are registered on udp and tcp ports, rpc.statd version 1 on udp and tcp ports, NFS lock manager versions 1,3,4, nfs server daemon version 2,3,4, and mount daemon versions 1,2,3.

The NFS server (more precisely, the rpc.nfsd daemon) receives requests from the client in the form of UDP datagrams on port 2049. Although NFS works with a port resolver, which allows the server to use dynamically assigned ports, UDP port 2049 is hardwired to NFS in most implementations .

Operation of the Network File System Protocol

Remote NFS Mount

The process of mounting a remote NFS file system can be represented as follows:

Description of the NFS protocol when mounting a remote directory:

  1. An RPC server is started on the server and client (usually at boot), maintained by the portmapper process and registered on the tcp/111 and udp/111 ports.
  2. Services are launched (rpc.nfsd, rpc.statd, etc.), which register on the RPC server and register on arbitrary network ports (if a static port is not specified in the service settings).
  3. the mount command on the client computer sends the kernel a request to mount the network directory indicating the type of file system, host, and the directory itself, the kernel sends an RPC request to the portmap process on the NFS server on the udp/111 port (if the option to work through tcp is not set on the client )
  4. The NFS server kernel polls RPC for the presence of the rpc.mountd daemon and returns to the client kernel network port The on which the daemon is running.
  5. mount sends an RPC request to the port where rpc.mountd is running. The NFS server can now validate the client based on its IP address and port number to see if the client can mount the specified file system.
  6. The mount daemon returns a description of the requested file system.
  7. The client's mount command issues the mount system call to associate the file descriptor obtained in step 5 with a local mount point on the client's host. The file descriptor is stored in the client's NFS code, and from then on, any user processes accessing files on the server's file system will use the file descriptor as a starting point.

Communication between client and NFS server

A typical access to a remote file system can be described as follows:

Description of the process of accessing a file located on an NFS server:

  1. The client (user process) doesn't care if it accesses a local file or an NFS file. The kernel deals with interacting with the hardware through kernel modules or built-in system calls.
  2. kernel module kernel/fs/nfs/nfs.ko, which acts as an NFS client sends RPC requests to the NFS server via the TCP/IP module. NFS usually uses UDP, however newer implementations may use TCP.
  3. The NFS server receives requests from the client in the form of UDP datagrams on port 2049. Although NFS can work with a port resolver, which allows the server to use dynamically assigned ports, UDP port 2049 is hardwired to NFS in most implementations.
  4. When an NFS server receives a request from a client, it is passed to a local file access routine that provides access to local disk on server.
  5. The result of the disk access is returned to the client.

Setting up an NFS server

Server Tuning in general is to specify the local directories that are allowed to be mounted by remote systems in a file /etc/exports. This action is called directory hierarchy export. The main sources of information about exported catalogs are the following files:

  • /etc/exports- the main configuration file that stores the configuration of the exported directories. Used when starting NFS and using the exportfs utility.
  • /var/lib/nfs/xtab- contains a list of directories mounted by remote clients. Used by the rpc.mountd daemon when a client attempts to mount a hierarchy (a mount entry is created).
  • /var/lib/nfs/etab- a list of directories that can be mounted by remote systems, indicating all parameters of the exported directories.
  • /var/lib/nfs/rmtab- list of directories that are not unexported at the moment.
  • /proc/fs/nfsd- a special file system (kernel 2.6) for managing the NFS server.
    • exports- list of active exported hierarchies and clients to which they were exported, as well as parameters. The kernel receives this information from /var/lib/nfs/xtab.
    • threads- contains the number of threads (can also be changed)
    • using filehandle you can get a pointer to a file
    • and etc...
  • /proc/net/rpc- contains "raw" (raw) statistics, which can be obtained using nfsstat, as well as various caches.
  • /var/run/portmap_mapping- information about services registered in RPC

Note: In general, there are a lot of interpretations and formulations of the purpose of xtab, etab, rmtab files on the Internet, I don’t know who to believe Even on http://nfs.sourceforge.net/ the interpretation is not unambiguous.

Configuring the /etc/exports file

In the simplest case, /etc/exports is the only file that needs to be edited to set up an NFS server. This file controls the following aspects:

  • Which clients can access files on the server
  • Which hierarchies? directories on the server can be accessed by each client
  • How custom customer names will displayed on local names users

Each line in the exports file has the following format:

exportpoint client1(options) [client2(options) ...]

Where export_point the absolute path of the exported directory hierarchy, client1 - n the name of one or more clients or IP addresses, separated by spaces, that are allowed to mount export_point . Options describe the mount rules for client before options .

Here is a typical exports file configuration example:

ARCHIV ~ # cat /etc/exports /archiv1 files(rw,sync) 10.0.0.1(ro,sync) 10.0.230.1/24(ro,sync)

In this example, the computers files and 10.0.0.1 are allowed access to the /archiv1 export point, while the files host is read/write, and the host 10.0.0.1 and subnet 10.0.230.1/24 are read-only.

Host descriptions in /etc/exports are allowed in the following format:

  • Individual node names are described as files or files.DOMAIN.local.
  • The description of the domain mask is made in the following format: *DOMAIN.local includes all nodes of the DOMAIN.local domain.
  • Subnets are specified as IP address/mask pairs. For example: 10.0.0.0/255.255.255.0 includes all hosts whose addresses start with 10.0.0.
  • Specifying the netgroup name @myclients that has access to the resource (when using a NIS server)

General export options for catalog hierarchies

The following general options are used in the exports file(first, the options used by default in most systems are indicated, non-default ones in brackets):

  • auth_nlm (no_auth_nlm) or secure_locks (insecure_locks)- specifies that the server should require authentication of lock requests (using the NFS Lock Manager protocol).
  • hide (hide)- if the server exports two directory hierarchies, with one nested (mounted) within the other. The client must explicitly mount the second (child) hierarchy, otherwise the child hierarchy's mount point will appear as an empty directory. The nohide option results in a second directory hierarchy without an explicit mount. ( note: I haven't been able to get this option to work...
  • ro(rw)- Allows only read (write) requests. (Ultimately, whether read/write is possible or not is determined based on the file system permissions, while the server is not able to distinguish between a file read request and an execute request, so it allows reading if the user has read or execute permissions.)
  • secure (insecure)- requires NFS requests to come from secure ports (< 1024), чтобы программа без root rights could not mount directory hierarchy.
  • subtree_check (no_subtree_check)- If a subdirectory of the filesystem is exported, but not the entire filesystem, the server checks if the requested file is in the exported subdirectory. Disabling verification reduces security but increases data transfer speed.
  • sync (async) Specifies that the server should only respond to requests after the changes made by those requests have been written to disk. The async option tells the server not to wait for the information to be written to disk, which improves performance but reduces reliability. Loss of information is possible if the connection is interrupted or equipment fails.
  • wdelay (no_wdelay)- instructs the server to delay executing write requests if a subsequent write request is pending, writing the data in larger blocks. This improves performance when sending large queues of write commands. no_wdelay specifies not to delay execution of the write command, which can be useful if the server receives a large number of commands that are not related to each other.

Export symbolic links and device files. When exporting a hierarchy of directories containing symbolic links, the link object must be available to the client (remote) system, that is, one of the following rules must be true:

The device file refers to the interface . When you export a device file, this interface is exported. If the client system does not have a device of the same type, then the exported device will not work. On the client system, when mounting NFS objects, the nodev option can be used so that device files in the mounted directories are not used.

The default options in different systems may vary, they can be found in the file /var/lib/nfs/etab. After describing the exported directory in /etc/exports and restarting the NFS server, any missing options (read: default options) will be reflected in the /var/lib/nfs/etab file.

Display (Match) Options for User IDs

For a better understanding of the following, I would advise you to read the article. Every Linux user has its own UID and main GID, which are described in the files /etc/passwd And /etc/group. The NFS server believes that the remote host's operating system has authenticated the users and assigned them the correct UID and GID. Exporting files gives users of the client system the same access to those files as if they were logging in directly to the server. Accordingly, when an NFS client sends a request to a server, the server uses the UID and GID to identify the user in local system, which can lead to some problems:

  • a user may not have the same identities on both systems and thus may be able to access another user's files.
  • because the root user ID is always 0, then given user is mapped to the local user depending on the options specified.

The following options set the rules for displaying remote users in local ones:

  • root_squash (no_root_squash)- With option set root_squash, requests from the root user are mapped to the anonymous uid/gid, or to the user specified in the anonuid/anongid parameter.
  • no_all_squash (all_squash)- Does not change the UID/GID of the connecting user. Option all_squash sets ALL users (not just root) to be displayed as anonymous or specified in the anonuid/anongid parameter.
  • anonuid= UID And anongid= GID - Explicitly sets the UID/GID for an anonymous user.
  • map_static= /etc/file_maps_users - Specifies a file that can be used to map remote UID/GIDs to local UIDs/GIDs.

An example of using a user mapping file:

ARCHIV ~ # cat /etc/file_maps_users # Mapping users # remote local comment uid 0-50 1002 # mapping users with remote UID 0-50 to local UID 1002 gid 0-50 1002 # mapping users with/span to remote GID 0-50 to local GID 1002

NFS Server Management

The NFS server is managed using the following utilities:

  • nfsstat
  • showmsecure (insecure)ount

nfsstat: NFS and RPC statistics

The nfsstat utility allows you to view the statistics of RPC and NFS servers. Command options can be found in man nfsstat .

showmount: display NFS state information

showmount utility queries the rpc.mountd daemon on the remote host for mounted filesystems. By default, a sorted list of clients is returned. Keys:

  • --all- a list of clients and mount points is given, indicating where the client mounted the directory. This information may not be reliable.
  • --directories- list of mount points
  • --exports- a list of exported file systems is given from the point of view of nfsd

Running showmount with no arguments will print to the console information about the systems that are allowed to mount local directories. For example, host ARCHIV provides us with a list of exported directories with IP addresses of hosts that are allowed to mount the specified directories:

FILES ~ # showmount --exports archive Export list for archive: /archiv-big 10.0.0.2 /archiv-small 10.0.0.2

If you specify a hostname / IP in the argument, then information about this host will be displayed:

ARCHIV ~ # showmount files clnt_create: RPC: Program not registered # this message tells us that the NFSd daemon is not running on host FILES

exportfs: managing exported directories

This command serves the exported directories specified in the file /etc/exports, it would be more accurate to write does not serve, but synchronizes with the file /var/lib/nfs/xtab and removes non-existent ones from xtab. exportfs is executed when the nfsd daemon is started with the -r argument. The exportfs utility in kernel mode 2.6 talks to the rpc.mountd daemon through files in the /var/lib/nfs/ directory and does not talk directly to the kernel. Without parameters, returns a list of currently exported file systems.

exportfs options:

  • [client:dir-name] - add or remove the specified file system for the specified client)
  • -v - display more information
  • -r - re-export all directories (sync /etc/exports and /var/lib/nfs/xtab)
  • -u - remove from export list
  • -a - add or remove all file systems
  • -o - options separated by commas (similar to options used in /etc/exports; thus, you can change the options of already mounted filesystems)
  • -i - do not use /etc/exports when adding, only options of the current command line
  • -f - reset the list of exported systems in the 2.6 kernel;

NFS client

Before accessing a file on a remote file system, the client (client OS) must mount it and receive from the server pointer to it. NFS mount can be done with or with the help of one of the prolific automatic mounters (amd, autofs, automount, supermount, superpupermount). The mounting process is well demonstrated in the illustration above.

On NFS clients no daemons need to be started, client functions executes a kernel module kernel/fs/nfs/nfs.ko, which is used when mounting a remote file system. Exported directories from the server can be mounted on the client in the following ways:

  • manually using the mount command
  • automatically at boot, when mounting filesystems described in /etc/fstab
  • automatically with the autofs daemon

I will not consider the third method with autofs in this article, due to its voluminous information. Perhaps in the following articles there will be a separate description.

Mounting the Network Files System with the mount command

An example of using the mount command is presented in the post. Here I will look at an example of the mount command for mounting an NFS file system:

FILES ~ # mount -t nfs archiv:/archiv-small /archivs/archiv-small FILES ~ # mount -t nfs -o ro archiv:/archiv-big /archivs/archiv-big FILES ~ # mount ..... .. archiv:/archiv-small on /archivs/archiv-small type nfs (rw,addr=10.0.0.6) archiv:/archiv-big on /archivs/archiv-big type nfs (ro,addr=10.0.0.6)

The first command mounts the exported directory /archiv-small on server archive to local mount point /archivs/archiv-small with default options (i.e. read and write). Although mount command in the latest distributions, it can understand what type of file system is used even without specifying the type, still specify the parameter -tnfs desirable. The second command mounts the exported directory /archiv-big on server archive to local directory /archivs/archiv-big with read-only option ( ro). mount command without parameters clearly displays the result of the mount. In addition to the read-only option (ro), it is possible to specify other basic NFS mount options:

  • nosuid- This option disables the execution of programs from the mounted directory.
  • nodev(no device) - This option disables character and block special files as devices.
  • lock (no-lock)- Enables NFS locking (default). nolock disables NFS locking (does not start the lockd daemon) and is useful when dealing with older servers that do not support NFS locking.
  • mounthost=name- The name of the host running the NFS mount daemon is mountd.
  • mountport=n - The port used by the mountd daemon.
  • port=n- port used to connect to the NFS server (default is 2049 if the rpc.nfsd daemon is not registered on the RPC server). If n=0 (the default), then NFS sends a request to the portmap on the server to determine the port.
  • size=n(read block size - read block size) - The number of bytes read at one time from the NFS server. The default is 4096.
  • wsize=n(write block size - the size of the write block) - The number of bytes written at one time to the NFS server. The default is 4096.
  • tcp or udp- To mount NFS, use TCP or UDP respectively.
  • bg- If you lose access to the server, retry in the background so as not to block the system boot process.
  • fg- If you lose access to the server, try again in priority mode. This option can block the system boot process by retries to mount. For this reason, the fg option is used primarily for debugging purposes.

Options affecting attribute caching on NFS mounts

File attributes, stored in (inodes), such as modification time, size, hard links, owner, usually change infrequently for regular files and even less frequently for directories. Many programs, such as ls, access read-only files and do not change file attributes or content, but waste system resources on expensive network operations. To avoid wasting resources, you can cache data attributes. The kernel uses the modification time of a file to determine if the cache is out of date by comparing the modification time in the cache and the modification time of the file itself. The attribute cache is periodically updated according to the specified parameters:

  • ac (noac) (attribute cache- attribute caching) - Enable attribute caching (default). Although the noac option slows down the server, it avoids attribute aging when multiple clients are actively writing information to a common hierarchy.
  • acdirmax=n (attribute cache directory file maximum- attribute caching maximum for directory file) - The maximum number of seconds NFS waits before updating directory attributes (default 60 sec.)
  • acdirmin=n (attribute cache directory file minimum- minimum attribute caching for directory file) - The minimum number of seconds NFS waits before updating directory attributes (30 sec by default)
  • accregmax=n (attribute cache regular file maximum- attribute caching maximum for a normal file) - The maximum number of seconds NFS waits before updating the attributes of a normal file (default 60 sec.)
  • aregmin=n (attribute cache regular file minimum- minimum attribute caching for a regular file) - The minimum number of seconds NFS waits before updating the attributes of a regular file (default 3 sec.)
  • actimeo=n (attribute cache timeout- attribute caching timeout) - Overrides the values ​​for all of the above options. If actimeo is not set, then the above values ​​default.

NFS Error Handling Options

The following options control what NFS does when there is no response from the server or when I/O errors occur:

  • fg (bg) (foreground- foreground, background- background) - Attempt to mount a failed NFS in the foreground/background.
  • hard (soft)- prints the message "server not responding" to the console when the timeout is reached and continues mounting attempts. With the given option soft- on timeout informs the program that called the operation about an I/O error. (soft option is advised not to use)
  • nointr(intr) (no interrupt- do not abort) - Prevents signals from aborting file operations in a hard-mounted directory hierarchy when a large timeout is reached. intr- enable interrupt.
  • retrans=n (retransmission value- retransmission value) - After n small timeouts, NFS generates a large timeout (default 3). A large timeout terminates operations or prints a "server not responding" message to the console, depending on the hard/soft option specified.
  • retry=n (retry value- retry value) - Number of minutes NFS retries mounts before giving up (default 10000).
  • timeo=n (timeout value- timeout value) - The number of tenths of a second the NFS service waits before retransmitting in case of RPC or low timeout (default 7). This value is incremented at each timeout up to a maximum value of 60 seconds or until a large timeout occurs. If the network is busy, the server is slow, or the request is passing through multiple routers or gateways, increasing this value can improve performance.

Automatic NFS mount at boot (description of filesystems in /etc/fstab)

Choose the optimal time for certain value transmitted packet (values ​​rsize / wsize), you can use the ping command:

FILES ~ # ping -s 32768 archiv PING archiv.DOMAIN.local (10.0.0.6) 32768(32796) bytes of data. 32776 bytes from archiv.domain.local (10.0.0.6): icmp_req=1 ttl=64 time=0.931 ms from archiv.domain.local (10.0.0.6): icmp_req=3 ttl=64 time=1.03 ms 32776 bytes .domain.local (10.0.0.6): icmp_req=5 ttl=64 time=1.08 ms ^C --- archive.DOMAIN.local ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4006ms rtt min/avg/max/mdev = 0.931/1.002/1.083/0.061ms

As you can see, when sending a packet of size 32768 (32Kb), its travel time from the client to the server and back floats around 1 millisecond. If this time goes off scale for 200 ms, then you should think about increasing the timeo value so that it exceeds the exchange value by three to four times. Accordingly, it is advisable to do this test during a heavy network load.

Starting NFS and configuring Firewall

The note was copied from the blog http://bog.pp.ru/work/NFS.html, for which many thanks to him!!!

Start NFS server, mount, lock, quota and status with "correct" ports (for firewall)

  • it is desirable to pre-unmount all resources on clients
  • stop and disable rpcidmapd from starting if NFSv4 is not planned: chkconfig --level 345 rpcidmapd off service rpcidmapd stop
  • if necessary, enable the portmap, nfs and nfslock services to start: chkconfig --levels 345 portmap/rpcbind on chkconfig --levels 345 nfs on chkconfig --levels 345 nfslock on
  • stop nfslock and nfs services if necessary, start portmap/rpcbind, unload modules service nfslock stop service nfs stop service portmap start # service rpcbind start umount /proc/fs/nfsd service rpcidmapd stop rmmod nfsd service autofs stop # somewhere later you need to run it rmmod nfs rmmod nfs_acl rmmod lockd
  • open ports in
    • for RPC: UDP/111, TCP/111
    • for NFS: UDP/2049, TCP/2049
    • for rpc.statd: UDP/4000, TCP/4000
    • for lockd: UDP/4001, TCP/4001
    • for mountd: UDP/4002, TCP/4002
    • for rpc.rquota: UDP/4003, TCP/4003
  • for the rpc.nfsd server, add the line RPCNFSDARGS="--port 2049" to /etc/sysconfig/nfs
  • for the mount server, add the MOUNTD_PORT=4002 line to /etc/sysconfig/nfs
  • to configure rpc.rquota for new versions, you need to add the line RQUOTAD_PORT=4003 to /etc/sysconfig/nfs
  • to configure rpc.rquota needed for older versions (however, you need to have the quota 3.08 package or newer) add to /etc/services rquotad 4003/tcp rquotad 4003/udp
  • check /etc/exports for validity
  • start the services rpc.nfsd, mountd and rpc.rquota (at the same time rpcsvcgssd and rpc.idmapd are started if you remember to delete them) service nfsd start or in newer versions service nfs start
  • for the lock server for new systems, add the lines LOCKD_TCPPORT=4001 LOCKD_UDPPORT=4001 to /etc/sysconfig/nfs
  • for a lock server for older systems add directly to /etc/modprobe[.conf]: options lockd nlm_udpport=4001 nlm_tcpport=4001
  • bind status server rpc.statd to port 4000 (for older systems run rpc.statd with -p 4000 in /etc/init.d/nfslock) STATD_PORT=4000
  • start lockd and rpc services.statd service nfslock start
  • make sure all ports are bound properly with "lsof -i -n -P" and "netstat -a -n" (some ports are used by kernel modules that lsof doesn't see)
  • if before "rebuilding" the server was used by clients and they could not be unmounted, then you will have to restart the automatic mount services on the clients (am-utils , autofs)

NFS server and client configuration example

Server Configuration

If you want to make your NFS-partitioned directory open and writable, you can use the option all_squash in combination with options anonymous And anonymous. For example, to set permissions for the user "nobody" in the group "nobody", you can do the following:

ARCHIV ~ # cat /etc/exports # Read/write access for client at 192.168.0.100, with rw access for user 99 with gid 99 /files 192.168.0.100(rw,sync,all_squash,anonuid=99,anongid=99) ) # Read and write access for client at 192.168.0.100, with rw access for user 99 with gid 99 /files 192.168.0.100(rw,sync,all_squash,anonuid=99,anongid=99))

This also means that if you want to allow access to the specified directory, nobody.nobody must be the owner of the shared directory:

man mount
man exports
http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.prftungd/doc/prftungd/nfs_perf.htm - NFS performance from IBM.

Sincerely, Mc.Sim!

The combination of “NFC” (Near field communication) is increasingly found in the specifications of modern smartphones and tablets. In this article, we will try to consider this interface from the point of view of practical use, so that readers can independently conclude that it is necessary to have it on their phone.

In testing, we used two models of smartphones that have already been discussed in detail on our resource: Acer CloudMobile S500 and Sony Xperia acro S. We also want to note that most of the information, including the described programs and usage scenarios, will only apply to smartphones on Android based. It is this operating system that is the most “friendly” today when it comes to working with NFC.

Introduction

At first glance, it may seem that numerous wireless interfaces today already cover all possible popular tasks and scenarios, so another option is simply not needed. However, if you look at the development of modern technologies, you can see that more and more attention is paid to energy consumption issues, especially if we are talking O mobile devices. In particular, version 4.0 of the well-known family of Bluetooth protocols is just focused on reducing battery costs. The second point worth mentioning is that not every task requires a long range. It even happens the other way around - you want to explicitly limit the distance between interacting devices. In addition to the obvious reduction in consumption, this also affects safety. Yes, and about the volume of transmitted data, you can also make a similar remark. So the idea of ​​a non-fast wireless interface running on short distances and characterized by low power consumption, it has a right to exist.

The starting point in the history of NFC development can be taken in 2004, when Nokia, Philips and Sony announced the creation in order to develop and standardize the interaction interface various devices, based on touch. However, the first versions of the specifications were created a little earlier. Perhaps, by modern standards, the technology can be considered very young (if you do not take into account the history of RFID), but it is already quite common in real products and services. In particular, at the Mobile World Congress 2013 held at the end of February, many stands and demonstrations were devoted to this topic.

This sign can be found on devices with NFC technology.

The formal characteristics of the interface are as follows: work at a distance of several centimeters, the maximum information exchange rate is about 400 Kbps, full-duplex data exchange is supported, the operating frequency is 13.56 MHz, the connection establishment time does not exceed 0.1 s, the operation mode is point-to-point. It can be seen that these parameters fundamentally distinguish NFC from other popular wireless interfaces.

If we talk about devices, then in addition to active controllers in NFC, there are also passive options (they are usually called tags), which receive power wirelessly from the active controller. One example is modern maps for public transport. Labels are simply data storage, typically less than 4 KB in size. Most often, only read mode is provided for them, but there are options with write support.

One of the simplest options for a passive NFC tag

The compact size of the controller and its low consumption allows NFC to be implemented even in small designs such as SIM cards or cards microSD memory. However, for full operation, the use of a special antenna is required. In phones, it is usually located on the back of the battery cover or built into back panel if the device does not have a removable battery.

The NFC antenna is often placed on back cover smartphone

The short range can be detrimental when using tablets - finding the right place to "attach" may not be as easy as we would like. To solve this problem, some manufacturers mark the location of the antenna with a special sign. As for the range, in our case, the connection worked at a distance of no more than four centimeters - both between phones and with a passive tag.

From a security point of view, the developers did not implement elements of protection against interception and relay attacks. This of course makes it difficult to implement secure solutions, since it requires the applications themselves to protect themselves at a higher level. Note that in fact, such a well-known protocol as TCP / IP behaves similarly. So from a practical point of view, it seems more dangerous to lose the phone without additional protection with customized payment systems programs than interception of communications.

Perhaps the most important thing to know about NFC today is that the interface itself does not provide any real practical use cases or solutions. Unlike, for example, Bluetooth, whose profiles clearly describe how to transfer a file, how to connect a headset or provide network access, NFC is only a base, and direct work scenarios are provided by additional software that works through it. On the one hand, this opens up wide opportunities for developers, and on the other hand, it is a problem for them when ensuring interaction. different applications and devices.

Interestingly, any programs installed on a smartphone or tablet can register in the operating system as NFC-related event handlers, and then when you externally “call”, you will see the standard menu “how do you want to perform this action?”. Since some scenarios for using NFC involve convenient automation of actions, it is advisable not to overload the device with such utilities.

The NFC forum tries to help with this uncertainty by offering to standardize protocols for certain scenarios (notably NDEF for storing short messages on tags and SNEP (Simple NDEF Exchange Protocol) for exchanging information between devices), but practical determination of the compatibility of specific devices is usually difficult due to the lack of detailed information from the manufacturer and diagnostic tools. Here is another helper Google which proposed in latest versions Android own development of Android Beam. It allows certain types of information to be exchanged between compatible devices.

Android Beam

First you need to make sure that both devices have NFC enabled, Android Beam active, and their screens are unlocked. On the models we tested, NFC only works if the screen is on and the device is fully unlocked. But it is possible that another algorithm will be used in other devices. In any case, the active interface requires very little battery power to operate, and so far the approach described seems to be quite reasonable. One of the options to simplify the work is to turn off the lock screen. In this case, to recognize the tag, it will be enough just to turn on the smartphone. Another inconvenience is the need to confirm the operation by touching the screen after the devices find each other. This is not always easy to do without breaking the connection, especially when both devices are in the hands of two different people.

The next step is to select one of the applications on the device from which the transfer is planned. In particular, these may be:

  • Google Chrome - transfer of the current open link;
  • YouTube client - transfer of a video clip (as a link);
  • Google Maps- transfer of a place or route;
  • Contacts - send a contact card;
  • Google Play— application transfer;
  • Gallery - transfer photos.

Next, bring the devices closer to each other. When a partner is found, you will hear a tone on the sending device and the desktop image will shrink. At this point, you need to touch the screen image and hold your finger until you hear the second signal - about a successful transfer.

We have tried the options in the list, and almost all of them really work. Even the fact that our devices were produced by different manufacturers did not prevent them from finding mutual language. But a few comments are still worth making. There are no problems with routes in Google Maps, and the location option is not very interesting, because only the current map display is transmitted. The point marked on the screen of the source phone does not reach the recipient. The situation is corrected by using the "Addresses" application, which transfers the data correctly. When sending contacts, a photo is lost because, from a technical point of view, the transfer format corresponds to text files vcf. If we talk about applications, then you can send not only those installed on your phone, but also just open cards on Google Play. Similarly, books and other content from the store are supported. Naturally, we are talking about the transfer of links, and not the downloaded or purchased elements themselves. There was a problem with sending photos: the Sony device was unable to work with this type of data. The official wording is "The recipient's device does not support large data transfers via Android Beam." Here you have the first sign of the youth of the interface or the lack of detail in the technical specifications of the devices. Formally, we have both NFC and Android Beam in two devices, but in practice their real capabilities differ significantly, and you can find out about this only as a result of verification. What can we say about less famous manufacturers - their implementation of this technology can be completely unpredictable.

Incidentally, as regards android work Beam. The description of the technology indicates that for data transfer, the establishment of a connection via Bluetooth is used after the initial negotiation of settings via NFC. Considering that all working formats assumed a really small amount of transmitted data, NFC speed was quite enough for them, but for photos it would be clearly not enough. So we can assume that Sony just did not implement switching to a faster interface. It is not possible to understand whether this problem is software (recall that Android 4.0.4 is installed on this device) or hardware.

We also tried to send our own music and videos in the same way from the respective apps, but nothing appeared on the receiver.

Reading and writing labels

The described Android Beam uses the ability to transmit and process short information messages. However, in reality, they can not only be transmitted from the phone, but also read from passive tags. In a sense, this technology is similar to the well-known QR codes that are read by the phone's camera. Wherein helpful information(for example, a link to a website page) takes just a few tens of bytes. Tags can be used by companies, for example, to promote their products or services. Given the compact size of the passive tag (more precisely, the thickness comparable to a sheet of paper - because of the antenna, the area will still be significant, no less than a five-ruble coin), it can be placed almost anywhere: on a box with a product, in a magazine, on an information rack and other places.

Passive NFC tags can be made into key fobs

If we talk about hand-made labels, then this is a completely feasible scenario. To do this, you need to purchase blank blanks and, using a special program for the phone, write down the required information on them. For example, we bought several different options: a sticker of minimum thickness, a protected circle made of plastic and key chains. All of them had a very small amount of memory - only 144 bytes (there are options on the market for 4 KB). The number of rewrite cycles was not specified, but for most application scenarios this parameter is not critical. To work with tags, NXP Semiconductors programs - TagInfo and TagWriter - can be recommended.

The first will allow you to read the data from the tag and decrypt the information according to the NDEF standard, and the second will help you create your own tags. At the same time, several NDEF sub-variants are supported: contact, link, text, SMS, mail message, phone number, Bluetooth connection, geographic location, local file link, application launch, URI. Please note that when creating a record, you need to take into account the amount of data stored. For example, a contact photo can take up several kilobytes, messages or text can also easily go beyond 144 bytes. By the way, the NFC TagInfo program from the NFC Research Lab with a special plug-in can read and show you a color photo from a biometric passport. With a data volume of one and a half dozen kilobytes, reading them via NFC takes about 20 seconds. An additional layer of protection in this case provided by the need to specify some details of the passport for reading data from the chip.

Note that the automatic processing of read tags depends on the content. In particular, sometimes additional confirmation is required to carry out the action itself. For example, in the case of SMS, a completed message form opens, but the actual sending must be confirmed by the user. But the recorded web link can immediately open in the browser. Any automation is associated with a loss of control, so the described features should be used with caution, because by simply replacing or reprogramming labels, attackers can redirect you to a fake site instead of the original one. We did not find regular OS settings to limit such autorun (unless you disable NFC itself).

Another important point when using labels in public places - protection against overwriting. When writing a label, you can set a protection flag that will block all attempts to change information, but it will be impossible to remove it. So the label will continue to be used in read-only mode. For home use, this is in most cases not very critical.

Let's mention a few more programs for writing labels:

Using predefined tags to manage a device

One of the active participants in the implementation of NFC is Sony. Her devices are pre-installed Smart program Connect that supports original Sony tags. If you wish, using the SmartTag Maker utility, you can create them yourself from blank blanks. The system uses the NDEF URI format with the tag number/color encoded in the text link. In total, the system provides up to eight labels, which are designated as “home”, “office”, “car”, “bedroom”, “listen”, “play”, “activity”, “watch”.

Variant of original Sony SmartTags

The Smart Connect program itself works not only with NFC tags, but also with other devices connected to the phone, including headsets, power supply, Bluetooth devices. Conveniently enough, the standard settings already correspond well to the above scenarios. In this case, the user can reprogram all circuits; each of them specifies a set of conditions and actions.

As a condition, you can use tag recognition or device connection, in addition, you can limit the operation time of the circuit. The set of actions is quite wide, it includes launching the application, opening a link in the browser, launching music, adjusting the volume and mode, connecting a Bluetooth audio device, sending SMS, calling, managing wireless interfaces, brightness adjustment, and more. Moreover, they can also be assigned to exit this mode, which is carried out by re-identifying the tag, by a new event / tag, or by the expiration of the specified time interval.

But in fact, it is not necessary to use Sony branded tags - you can also find use for ready-made tags that do not allow information to be overwritten. For example, it can be used transport cards. The fact is that each of them has its own unique identifier that can be tied to certain actions. special programs. As a possible reaction, such operations as changing the profile, enabling / disabling interfaces, and many others can act.

The Play Store has several utilities for this scenario, to mention a couple of them:

Recall that you should not install several such programs at once. Convenience from this mode will not be added, since when a label is detected on the phone screen, a dialog box will appear with the choice of a program for processing it.

While searching for programs to work with labels, we also came across another class of utilities that may be of interest in the case of writable labels. These programs use their own original recording format, which only they themselves can work with. In this case, the set of possible actions is almost the same as those described above:

Recall that at the moment the label is read only when the device is unlocked. So the scenario “came home, put the phone on the nightstand - automatically switched the profile, turned off the call and Bluetooth, set the alarm” will require some actions from the user. This behavior still limits the possibilities of programs a little.

Exchange of information between devices

With the exception of Android Beam, the scenarios described above assume the operation of one phone with a tag or specialized terminal. If we talk about the direct connection of the devices to each other, then the main issue here is compatibility. Of course, in the case of products from one manufacturer, especially a large one, it is possible to simply install the appropriate program into the firmware. But if the devices are produced by different manufacturers, everyone will have to use the same utilities. And it’s not at all a fact that your partner will have the same program installed as you.

Considering that the native speed of NFC is very slow, Bluetooth or Wi-Fi is usually used for fast file transfer, and NFC only works during the connection negotiation and pairing phase. To test this scenario, we tried several file transfer programs that claim to support NFC on our devices.

send! File Transfer (NFC) to free version allows you to share files of photos, music and videos. You can use NFC or QR codes to establish a connection. The transmission is carried out via Bluetooth or Wi-Fi (in case both devices support Wi-Fi Direct, which in the used Sony phone did not appear). As a result, we managed to see a speed of 65 KB / s, which, of course, is too low even for photos.

Blue NFC, as the name suggests, also simplifies Bluetooth file sharing by replacing the power, search, and pairing steps with touch and NFC sharing. The speed of work is not very high - at the level of the program mentioned above.

File Expert HD also uses Bluetooth, but the speed is already 100-200 KB/s. True, in fairness it is worth noting that this program has many other file sharing modes.

Conclusion

As of spring 2013, we can say that NFC technology is already confidently taking its place in modern smartphones top and middle levels. Indirectly, interest in it can be estimated by the number of programs in the Play Store: there are already several hundred free projects alone. Considering market dominance (especially in terms of number of models) Android platforms, it is she who is today the most popular for NFC devices. iOS does not provide native tools for NFC, but Windows phone 8 has significantly limited NFC capabilities for third-party applications.

By itself, NFC technology has several features that allow it to occupy a unique position:

  • contactless data transmission;
  • work only at short distances;
  • the ability to exchange information with other devices or passive tags;
  • low cost solution;
  • low power consumption;
  • low data rate.

At the moment, for smartphones and tablets, there are three most relevant options for using NFC: data exchange between devices (contacts, applications, links, photos and other files), reading tags with special information and changing device modes / settings / profiles, quick pairing with peripherals (such as headsets). In the first case, you can try to work with the standard Android program Beam or install alternative options. They can be useful if you need a high exchange rate (via Wi-Fi), but require the same program on every device.

Passive tags can be used almost anywhere, from posters to magazines and product tags. They can record information about the product, a link to the site, wifi settings, Contact details, geographical coordinates or other small amount of data. The spread of this method of information exchange directly depends on the number of compatible devices users have. This scenario can be compared to common QR codes, which today are perhaps easier to implement and more popular.

For change system settings even non-writable labels can be used with some programs, so many users will be able to try this scenario in practice. True, it should be noted that in this case the set of options will be written in specific device, and there can be difficulties with transferring it to another device. Most utilities of this purpose still require their own recorded tags, which allows them to store all the required information in an encoded form directly in the tag (or cloud), so that in order to use these settings on another device, it will be enough to have the same program on it.

We have not considered in this article such NFC use cases as payment systems, electronic wallets and micropayments, tickets and coupons, transport cards and passes. These topics, especially the first one, deserve separate consideration. We will try to return to them in the presence of reader interest and the dissemination of such solutions.

When it comes to computer networks, you can often hear the mention of NFS. What does this abbreviation mean?

It is a distributed file system protocol originally developed by Sun Microsystems in 1984 that allows a user on a client computer to access files over a network, similar to accessing local storage. NFS, like many other protocols, is based on the Open Network Computing Remote Procedure Call (ONC RPC) system.

In other words, what is NFS? It is an open standard, defined in the Request for Comments (RFC), allowing anyone to implement the protocol.

Versions and variations

The inventor used only the first version for his own experimental purposes. When the development team added significant changes to the original NFS and released it outside of Sun's authorship, they designated the new version as v2 so that interoperability could be tested and backed up.

NFS v2

Version 2 originally ran only on the User Datagram Protocol (UDP). Its developers wanted to keep the server side without locking implemented outside of the core protocol.

The virtual file system interface allows for a modular implementation reflected in a simple protocol. By February 1986, solutions were demonstrated for operating systems such as System V release 2, DOS, and VAX/VMS using Eunice. NFS v2 only allowed the first 2 GB of a file to be read due to 32-bit limitations.

NFS v3

The first proposal to develop NFS version 3 at Sun Microsystems was announced shortly after the release of the second distribution. The main motivation was to try to mitigate the performance problem of synchronous writes. By July 1992, practical improvements resolved many of the shortcomings of NFS version 2, leaving only insufficient file support (64-bit file sizes and file offsets).

  • support for 64-bit file sizes and offsets to handle data larger than 2 gigabytes (GB);
  • support for asynchronous writing on the server to improve performance;
  • additional file attributes in many answers to avoid having to re-extract them;
  • a READDIRPLUS operation to get data and attributes along with filenames when scanning a directory;
  • many other improvements.

During the introduction of version 3, support for TCP as a transport layer protocol began to increase. The use of TCP as a means of transferring data, made using NFS over the WAN, began to allow the transfer of large file sizes for viewing and writing. As a result, developers were able to overcome the 8 KB limit imposed by the User Datagram Protocol (UDP).

What is NFSv4?

Influenced by the Endre File System (AFS) and Server Message Block (SMB, also called CIFS), version 4 includes performance improvements, provides better security, and introduces a protocol with set conditions.

Version 4 was the first distribution developed in target group Internet Engineering Task Force (IETF) after Sun Microsystems outsourced protocol development.

NFS version 4.1 aims to provide protocol support for leveraging server cluster deployments, including the ability to provide scalable parallel access to files distributed across multiple servers (pNFS extension).

The latest file system protocol, NFS 4.2 (RFC 7862), was officially released in November 2016.

Other extensions

With the development of the standard, the corresponding tools for working with it have appeared. For example, WebNFS, an extension for versions 2 and 3, allows the protocol network access to file systems, it is easier to integrate into web browsers and enable work through firewalls.

Various third party protocols have also become associated with NFS. Of these, the most famous are:

  • Network Lock Manager (NLM) with byte protocol support (added to support UNIX System V file locking API);
  • remote quota (RQUOTAD), which allows NFS users to view storage quotas on NFS servers;
  • NFS over RDMA - An adaptation of NFS that uses remote direct memory access (RDMA) as the transfer medium;
  • NFS-Ganesha is a user-space NFS server that supports CephFS FSAL (File System Abstraction Layer) using libcephfs.

Platforms

Network File System is often used with operating systems Unix (such as Solaris, AIX, HP-UX), Apple's MacOS, and Unix-like operating systems (such as Linux and FreeBSD).

It is also available for platforms such as Acorn RISC OS, OpenVMS, MS-DOS, Microsoft Windows, Novell NetWare and IBM AS/400.

Alternative protocols remote access to files include Server Message Block (SMB, also called CIFS), Apple Transfer Protocol (AFP), NetWare Core Protocol (NCP), and OS/400 Server File System (QFileSvr.400).

This is due to the requirements of NFS, which are geared towards Unix-like "shells" for the most part.

However, the SMB and NetWare (NCP) protocols are used more frequently than NFS on systems running Microsoft Windows. AFP is most widely used on Apple Macintosh platforms, while QFileSvr.400 is most common on OS/400.

Typical implementation

Assuming a typical Unix-style scenario in which one computer (client) needs access to data stored on another (NFS server):

  • The server implements the Network File System processes, running by default as nfsd, to make its data publicly available to clients. The server administrator determines how to export directory names and options, typically using the /etc/exports configuration file and the exportfs command.
  • Server security administration ensures that it can recognize and approve a trusted client. Its network configuration ensures that appropriate clients can negotiate with it through any firewall system.
  • The client machine requests access to the exported data, usually by issuing an appropriate command. It queries a server (rpcbind) that uses an NFS port and subsequently connects to it.
  • If everything proceeds without errors, users on the client machine will be able to view and interact with the installed file systems on the server within the allowed parameters.

It should also be noted that automation of the Network File System process can also take place - perhaps using etc/fstab and/or other similar means.

Development to date

By the 21st century, the competing protocols DFS and AFS had not achieved any major commercial success compared to the Network File System. IBM, which previously acquired all commercial rights to the above technologies, donated most of the AFS source code to the free developer community software in 2000. The Open AFS project still exists today. In early 2005, IBM announced that it was ending sales of AFS and DFS.

In turn, in January 2010, Panasas offered NFS v 4.1, based on a technology that improves the ability to parallel access to data. The Network File System v 4.1 protocol defines a method for separating file system metadata from the location of specific files. So it goes beyond simple name/data separation.

What is NFS of this version in practice? The above feature distinguishes it from the traditional protocol, which contains the names of files and their data under one binding to the server. With the implementation of Network File System v 4.1, some files can be distributed between multi-site servers, but client participation in the separation of metadata and data is limited.

In the implementation of the fourth distribution of the protocol, an NFS server is a collection of server resources or components; they are assumed to be controlled by the metadata server.

The client still contacts one metadata server to traverse or interact with the namespace. As it moves files to and from the server, it can interact directly with the data set owned by the NFS group.

If you notice an error, select a piece of text and press Ctrl + Enter
SHARE: