Page 1 of 1

5.1.12.2 Next, edit the file: sudo vim /etc/dhcp/dhcpd.conf 5.1.12.3 Find the line with option domain-name and set i

Posted: Fri Jul 01, 2022 5:51 am
by answerhappygod
5.1.12.2 Next, edit the file: sudovim /etc/dhcp/dhcpd.conf
5.1.12.3 Find the line with option domain-name andset it to optiondomain-name “localdomain";
(check /etc/hosts or the ‘dnsdomainname’ command to get the domainname)
5.1.12.4 Set the nameserver's hostname or IP address by finding andchanging this line to:
option domain-name-servers 142.55.100.25,142.55.44.25;
(We find these IP addresses by checking the‘nameservers: ‘ field in
/etc/netplan/99-netcfg-vmware.yaml)
5.1.12.5 Find and change the lease times to 8 minutes (480s) –(this is just for testing – more common times are 2 hrs, 1 day or 1 week)
default-lease-time 480;
max-lease-time 480;
5.1.12.6 Find the #authoritative; line anduncomment it by removing the #
5.1.12.7 Specify the network address and subnet-mask: Go to the endof the file and add these lines:
(use these addresses and masks)
subnet 192.168.10.0 netmask 255.255.255.0 {
# Specify the default gateway address
option routers 192.168.10.1;
# Specify the subnet-mask
option subnet-mask 255.255.255.0;
# Specify the range of leased IP addresses
range 192.168.10.105192.168.10.115;
}
5.1.12.8 Save and quit the editor.
5.1.13 Restart the DHCPserver: sudosystemctl restart isc-dhcp-server.service
5.1.14 The Desktop VM still has a statically set IP address. Wemust switch it to use DHCP. Start the VM from a browser at‘vcenter…’ (if you use SSH Client or ‘nomachine’client now to connect, you will lose the connection once DHCPswitches the IP address away from the 192.168.10.13 address).
5.1.15 Edit the 99-netcfg-vmware.yaml file sothat you have: dhcp4:yes (you can leave the
dhcp6: no line). Delete all the followinglines.
5.1.16 Get the VM to accept thechange: sudo netplanapply
5.1.17 Verify its IP address is now in the range chosen: 192.168.10.105 – 115 - Put ascreenshot showing this new address:
5.1.18 Run: netplan ip leasesens160 (substituteyour interface name). Put a screenshot of its output:
5.1.19 Verify you can ping Server01.
5.1.20 From Server01, ping the Desktop. Put a screenshot of theping:
5.1.21 Also from Server01, run: dhcp-lease-list - put a screenshot of its output:
5.1.22 View the dhcpd.leases file in/var/lib/dhcp -after 20 minutes, how many leases are in this file? Put ascreenshot of one of the leases here:
We are done reviewing DHCP. Now we must statically set Desktop’sIP address back to the original and disable the DHCP Server.
5.1.23 On Server01, run: sudosystemctl disableisc-dhcp-server.service - to disable it at bootup
5.1.24 Stop it now: sudo systemctlstop isc-dhcp-server.service
5.1.25 On Desktop, back up the YAML file for futurereference:
sudo mv 99-netcfg-vmware.yaml99-netcfg-vmware.yaml.dhcp-bak
5.1.26 You previously created the backup file99-netcfg-vmware.yaml.bak, now rename it back tothe original name sonetplan will use it: sudo mv99-netcfg-vmware.yaml.bak 99-netcfg-vmware.yaml
5.1.27 Apply the change: sudonetplan apply
5.1.28 Verify the IP address is changed back to 192.168.10.13.This is an IMPORTANT step to ensure continued access toDesktop.
Part 5.2 Installing and configuring NFS(complete documentation:https://help.ubuntu.com/community/SettingUpNFSHowTo &https://ubuntu.com/server/docs/service-nfs)
This part is like the Samba tool in that it involves an NFSServer (server01) making NFS shares available to NFS Clients (ourtest will use only ‘Desktop’).
STEPS
5.2.1 On your SERVER01 (the NFS server): Login with yourdefault user (for ex: vmadmin), create the‘nfs-test’ and
‘nfs-test/data’ directories below your homedirectory and add a file myfile.txt (with text) tothe data directory.
5.2.2 Installnfs-server: sudo apt-get install nfs-kernel-server
5.2.3 Edit the NFS configurationsfile: sudo vim /etc/exports
Add entries:
/home/USERNAME/nfs-test ClientIP(rw,fsid=0,insecure,no_subtree_check,async)
/home/USERNAME/nfs-test/data ClientIP(rw,nohide,insecure,no_subtree_check,async)
(replace USERNAME and ClientIPwith your values – for ClientIP, use the IPaddress of your client [DESKTOP] – note the SPACE(s) beforeClientIP).
Note the ‘rw’. We are giving clients read/write access to thesefolders. Put a screenshot of the lines of this file:
Save and close it.
5.2.4 Start rpc.idmapdservice: sudo rpc.idmapd
5.2.5 On your NFS Client machine (DESKTOP), installnfs-client: sudo apt-get install nfs-common
5.2.6 Modify /etc/default/nfs-common file (atthe client) and set:
NEED_IDMAPD=yes
NEED_GSSD=no
5.2.7 Load the nfs module (at theclient): sudo modprobe nfs
5.2.8 At the NFS Server, restart nfs server: sudo systemctl restartnfs-kernel-server …or
sudo /etc/init.d/nfs-kernel-server restart
5.2.9 At the client, create the directory /media/nfs-share for mountingthe nfs share (you may choose any name or location – ‘/media’ isoften used), then issue the following command to mount SERVER01’snfs share – run this from DESKTOP: sudo mount -t nfs ServerIP:/data /media/nfs-share (replace ServerIP with your SERVER01’s IP address– ‘data’ is the directory you entered in‘exports’ file)
5.2.10 Run df -h and mountcommands to verify DESKTOP has accessed the share. Put a screenshotof these commands:
5.2.11 Go to /media/nfs-share directory at theclient and verify that you can see the file that you created in/home/USERNAME/nfs-test/data folder. Verify you can create a filein SERVER01 and it is readable in DESKTOP, then, you can create afile in DESKTOP and it is readable in SERVER01. Put screenshotsshowing:
- the files in both VMs (‘nfs-share’ and‘data’)
- you created a file in nfs-share and it isreadable in data
- you created a file in data and it is readable innfs-share
5.2.12 When done, from DESKTOP, leave the directory and unmountthis filesystem:
sudo umount /media/nfs-share
5.2.13 Stop the NFS service on the server: sudo systemctl stopnfs-kernel-server …or
sudo /etc/init.d/nfs-kernel-server stop
Insert here the history of your Linux session on both VMs forthis Part 5.2 (NFS Share) ONLY (not your entirehistory file!).