1. Trang chủ
  2. » Công Nghệ Thông Tin

Bài giảng Quản trị Linux: Network File System - Đặng Thanh Bình

33 99 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 33
Dung lượng 902,42 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Bài giảng Quản trị Linux này trình bày kiến thức về Network File System. Nội dung chính trong chương này gồm có: How It Works, NFS client configuration, autofs, common NFS mount options, starting and stopping NFS, NFS server configuration, securing NFS, NFS and portmap, using NFS over TCP.

Trang 1

Đặng Thanh Bình

Network File System

Trang 2

• How It Works

• NFS Client Configuration

• autofs

• Common NFS Mount Options

• Starting and Stopping NFS

• NFS Server Configuration

• Securing NFS

• NFS and portmap

• Using NFS over TCP

Trang 3

• A Network File System (NFS) allows remote hosts

to mount file systems over a network andinteract with those file systems as though theyare mounted locally

• This enables system administrators to consolidateresources onto centralized servers on thenetwork

• This chapter focuses on fundamental NFSconcepts and supplemental information

Trang 4

HOW IT WORKS

Trang 5

– NFS version 4 (NFSv4) works through firewalls and on the Internet, no longer requires portmapper, supports ACLs, and utilizes stateful operations

Trang 6

How It Works

• All versions of NFS can use Transmission Control Protocol (TCP) running over an IP network, withNFSv4 requiring it

• NFSv2 and NFSv3 can use the User Datagram Protocol (UDP) running over an IP network toprovide a stateless network

• NFSv4 has no interaction with portmapper,

rpc.mountd, rpc.lockd, and rpc.statd, sinceprotocol support has been incorporated into thev4 protocol

Trang 8

• Once access is granted, all file and directoryoperations are available to the user.

Trang 9

• In order for NFS to work with a defaultinstallation of Red Hat Enterprise Linux with afirewall enabled, IPTables with the default TCPport 2049 must be configured

• The NFS initialization script and rpc.nfsd processnow allow binding to any specified port duringsystem start up

Trang 10

Required Services

• nfs: NFS server

• nfslock: a mandatory service that starts theappropriate RPC processes to allow NFS clients tolock files on the server

• portmap: accepts port reservations from localRPC services

Trang 12

NFS CLIENT CONFIGURATION

Trang 13

Mounting on the Client Side

• NFS shares are mounted on the client side usingthe mount command

mount -t <nfs-type> -o <options>

<host>:</remote/export> </local/directory>

– <nfs-type>: nfs for NFSv2 or NFSv3, nfs4 for NFSv4.

– <options>: a comma separated list of options for NFS – <host>: remote host

– </remote/export>: remote directory being mounted – </local/directory>: local directory where the remote file system is to be mounted

Trang 14

Mounting on the Client Side

• Mounting remote file systems automatically atboot time

– Edit the /etc/fstab file

– Use autofs service

Trang 15

Using /etc/fstab

• The general syntax for the line in /etc/fstab is asfollows:

server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr

– The mount point /pub must exist on the client machine before this command can be executed.

– After adding this line to /etc/fstab on the client system, type the command mount /pub at a shell prompt

– The mount point /pub is mounted from the server

Trang 16

Using /etc/fstab

• The /etc/fstab file is referenced by the netfs

service at boot time

• Lines referencing NFS shares have the same effect

as manually typing the mount command duringthe boot process

• A sample /etc/fstab line to mount an NFS export

<server>:</remote/export> </local/directory>

<nfs-type> <options> 0 0

Trang 17

AUTOFS

Trang 18

• Kernel-based automount utility

• Components of an automounter:

– A kernel module that implements a file system

– A user-space daemon performing all other functions

• autofs uses /etc/auto.master (master map) as its default primary configuration file

• This can be changed to use another supported

configuration (in /etc/sysconfig/autofs) in conjunction with Name Service Switch mechanism

Trang 19

autofs Configuration

• Configuration file: /etc/auto.master

• Lists autofs-controlled mount points on the system, and their corresponding configuration files or network sources known as automount maps.

• The format of the master map is as follows:

<mount-point> <map-name> <options>

– mount-point is the autofs mount point e.g /home.

– map-name is the name of a map source which contains a list of mount points, and the file system location from which those mount points should be mounted

Trang 20

autofs Configuration

• Map file structure:

<mount-point> [<options>] <location>

• Samples:

Trang 21

• Run autofs

• View the status of the automount daemon

Trang 22

COMMON NFS MOUNT OPTIONS

Trang 23

Mount Options

• fsid=num – Forces the file handle and fileattributes settings on the wire to be num

• hard or soft — Specifies whether the program

using a file via an NFS connection should stop andwait (hard) for the server to come back online, if

the host serving the exported file system isunavailable, or if it should report an error (soft)

• noacl — Turns off all ACL processing

• nolock — Disables file locking

Trang 25

Mount Options

• Using soft mounts is not recommended as theycan generate I/O errors in very congestednetworks or when using a very busy server

Trang 26

STARTING AND STOPPING NFS

Trang 27

Starting and Stopping NFS

• To run an NFS server, the portmap service must

be running

• To verify that portmap is active, type

Trang 28

Starting and Stopping NFS

Trang 29

NFS SERVER CONFIGURATION

Trang 30

Configuration File

• NFS configuration file: /etc/exports

• Structure of a line for an exported file system:

<export> <host1>(<options>)

<hostN>(<options>)

– <export>: the directory being exported

– <host1>: host or network to which the export is being shared

– <options>: options for that host or network

Trang 31

• Tend to be more exact than expected

– *.example.com as a wildcard allows sales.example.com to access

– *.example.com and *.*.example.com must be specified to allow both

Ngày đăng: 30/01/2020, 00:18

TỪ KHÓA LIÊN QUAN