2.6 KiB
LFCS 3.4: Remote filesystems and network block devices
An NFS server and client, root_squash, a Samba share mounted with a
credentials file, and an iSCSI target and initiator.
Before you start
The lab adds a second machine, peer (10.99.0.2), linked to this VM's
lab address 10.99.0.1; together they make the lab network 10.99.0.0/24.
This VM plays both roles in each task: it's the server, and it's also the
client, mounting its own shares through 10.99.0.1 the way another machine
on the lab network would. The traffic never leaves the VM, so no firewall
rules are needed.
The lab also creates:
- user
alice(passwordLab-Pass-1) and a directory/srv/sambashe owns, with a filereadme.txtin it; - a 1 GiB disk image,
/var/lib/le-lab/iscsi/disk0.img, the spare disk for the iSCSI target. Serve it as a file (a fileio backstore). It isn't attached as a loop device on purpose: the VM would then see the same filesystem twice, once there and once on the iSCSI disk.
Because the servers and the clients are the same machine, the lab orders the NFS, Samba and iSCSI target services before network mounts: the mounts are made after the servers start, and at shutdown they're unmounted (and the iSCSI session logged out) before the servers stop.
Tasks
- Export
/srv/shareread-write to the lab network only (10.99.0.0/24), and mount it from10.99.0.1at/mnt/shareat every boot. Make/srv/sharewritable for the test, for examplesudo chmod 1777 /srv/share. - Show what
root_squashdoes: as root on the client, create/mnt/share/rootfile, then look at who owns/srv/share/rootfileon the server. - Share
/srv/sambawith Samba asprojects, for useralice, and mount//10.99.0.1/projectsat/mnt/projectsat every boot, with a credentials file/root/.smbcredthat only root can read. - Make the disk image an iSCSI target, connect to it from
10.99.0.1as the initiator, logging in at every boot, and mount an XFS filesystem from the iSCSI disk at/mnt/iscsiat every boot.
Hints
/etc/exports(no space before the parentheses),exportfs -ra,exportfs -v,showmount -e;_netdevin/etc/fstab.ls -lon the server;nobodyis UID 65534.smb.conf,smbpasswd -a,testparm,smbclient -L; on RHEL, SELinux wants the share labeledsamba_share_t(semanage fcontext,restorecon).chmod 600;credentials=in/etc/fstab.targetcli(backstores/fileio,iscsi/,luns,acls,saveconfig); the ACL must name the initiator in/etc/iscsi/initiatorname.iscsi.iscsiadm -m discovery,--login,node.startup;lsblk,blkid.