@
目录环境准备
第一步,将下载的虚拟机文件上传到VMware中
点击VMware左上角的文件-然后下拉菜单中点击打开,然后找到你下载的虚拟机文件位置后一直点进去,最后双击
第二步,配置网络
本虚拟机使用的net网络,网段是192.168.200.0,所以要编辑你本地虚拟机的net网段
1,点击文件旁边的编辑,下拉菜单中点击虚拟网络编辑器,2,然后点击更改设置
2,编辑net网段
3,完成后重启服务端和客户端的网络
服务端ubuntu----重启命令
netplan apply
root@ubuntu-server:~# netplan apply
root@ubuntu-server:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:1a:93:c9 brd ff:ff:ff:ff:ff:ff
altname enp2s1
inet 192.168.200.160/24 brd 192.168.200.255 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe1a:93c9/64 scope link
valid_lft forever preferred_lft forever
3: ens38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:1a:93:d3 brd ff:ff:ff:ff:ff:ff
altname enp2s6
inet 192.168.200.161/24 brd 192.168.200.255 scope global ens38
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe1a:93d3/64 scope link
valid_lft forever preferred_lft forever
root@ubuntu-server:~#
客户端centos----网络重启命令
systemctl restart network
[root@centos-client ~]# systemctl restart network
[root@centos-client ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:88:26:3d brd ff:ff:ff:ff:ff:ff
inet 192.168.200.150/24 brd 192.168.200.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::39d2:e013:cba8:24af/64 scope link tentative noprefixroute
valid_lft forever preferred_lft forever
3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:88:26:47 brd ff:ff:ff:ff:ff:ff
[root@centos-client ~]#
环境准备到此结束,开始使用服务
ftp服务测试
域名已配置:ftp.hoyeong.com
ftp服务端用户(密码默认000000):huhy
第一步,先在服务端的 /opt 目录下创建一个下载的测试文件
touch /opt/get-test.txt
第二步,在客户端当前的 /root/ 目录创建一个上传测试文件
touch /opt/put-test.txt
开始在客户端使用ftp服务
1,ftp后面+域名
ftp ftp.hoyeong.com
2,输入huhy用户名
huhy
3,输入密码(默认000000)
4,put上传文件(切记切记上传的文件在/home/huhy/目录下)
put put-test.txt
5,get下载文件(下载的文件就在当前的/root/目录下),需要先进入到/opt/下在使用下载
cd /opt/
get get-test.txt
完整演示
[root@centos-client ~]# ftp ftp.hoyeong.com
Connected to ftp.hoyeong.com (192.168.200.160).
220 (vsFTPd 3.0.5)
Name (ftp.hoyeong.com:root): huhy
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
ftp> put put-test.txt
local: put-test.txt remote: put-test.txt
227 Entering Passive Mode (192,168,200,160,44,193).
150 Ok to send data.
226 Transfer complete.
ftp> cd /opt/
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,200,160,110,251).
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 0 Dec 05 12:31 get-test.txt
226 Directory send OK.
ftp> get get-test.txt
local: get-test.txt remote: get-test.txt
227 Entering Passive Mode (192,168,200,160,137,36).
150 Opening BINARY mode data connection for get-test.txt (0 bytes).
226 Transfer complete.
ftp> exit
221 Goodbye.
验证
客户端下载的文件
[root@centos-client ~]# ls
anaconda-ks.cfg get-test.txt put-test.txt
上传到服务端的文件
root@ubuntu-server:~# ls /home/huhy/
put-test.txt
root@ubuntu-server:~#
nfs服务测试
域名已配置:nfs.hoyeong.com
服务端挂载点:/mnt/nfs-server
客户端挂载点:/mnt/nfs-client
开始实验,客户端直接挂载
mount -t nfs nfs.hoyeong.com:/mnt/nfs-server /mnt/nfs-client
[root@centos-client ~]# mount -t nfs nfs.hoyeong.com:/mnt/nfs-server /mnt/nfs-client
[root@centos-client ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 20M 1.9G 2% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 50G 1.6G 49G 4% /
/dev/mapper/centos-home xfs 46G 33M 46G 1% /home
/dev/sda1 xfs 1014M 151M 864M 15% /boot
tmpfs tmpfs 378M 0 378M 0% /run/user/0
nfs.hoyeong.com:/mnt/nfs-server nfs4 20G 6.9G 12G 38% /mnt/nfs-client
[root@centos-client ~]#
验证
客户端随便创建一个文件测试
touch /mnt/nfs-client/aaaaaaaaaaaa
客户端查看
[root@centos-client ~]# ls /mnt/nfs-client/
aaaaaaaaaaaa
[root@centos-client ~]#
服务端验证
root@ubuntu-server:~# ls /mnt/nfs-server/
aaaaaaaaaaaa
root@ubuntu-server:~#
smb服务测试
域名已配置:smb.hoyeong.com
smb用户名(密码默认000000):smb-user
服务端挂载点:/mnt/smb-server
客户端挂载点:/mnt/smb-client
客户端开始测试
1,验证是否可以访问服务端(密码默认000000)
smbclient -L //192.168.200.160
[root@centos-client ~]# smbclient -L //192.168.200.160
Enter SAMBA\root's password:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
my-samba Disk hello
IPC$ IPC IPC Service (ubuntu-server server (Samba, Ubuntu))
Reconnecting with SMB1 for workgroup listing.
smbXcli_negprot_smb1_done: No compatible protocol selected by server.
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE
Unable to connect with SMB1 -- no workgroup available
[root@centos-client ~]#
2,开始域名挂载(密码默认000000)
mount -t cifs //smb.hoyeong.com/my-samba /mnt/smb-client -o username=smb-user
[root@centos-client ~]# mount -t cifs //smb.hoyeong.com/my-samba /mnt/smb-client -o username=smb-user
Password for smb-user@//smb.hoyeong.com/my-samba: ******
[root@centos-client ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 20M 1.9G 2% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 50G 1.6G 49G 4% /
/dev/mapper/centos-home xfs 46G 33M 46G 1% /home
/dev/sda1 xfs 1014M 151M 864M 15% /boot
tmpfs tmpfs 378M 0 378M 0% /run/user/0
nfs.hoyeong.com:/mnt/nfs-server nfs4 20G 6.9G 12G 38% /mnt/nfs-client
//smb.hoyeong.com/my-samba cifs 20G 7.9G 12G 41% /mnt/smb-client
[root@centos-client ~]#
验证
1,客户端随便创建一个测试文件
touch /mnt/smb-client/qqqqqqqqqqqqqq
2,客户端查看
[root@centos-client ~]# ls /mnt/smb-client/
qqqqqqqqqqqqqq
[root@centos-client ~]#
3,服务端验证
root@ubuntu-server:~# ls /mnt/smb-server/
qqqqqqqqqqqqqq
root@ubuntu-server:~#
www服务测试
域名已配置:www.hoyeong.com
注:本实验测试需要在桌面版服务器下
打开桌面版服务器(centos、Ubuntu都可)后,修改文件即可
sed -i 's/127.0.0.53/192.168.200.160/'g /etc/resolv.conf
验证
mail服务测试
域名已配置:mail.hoyeong.com
mail用户(密码默认000000):mailuser1、mailuser2
客户端实验测试
1,访问mail服务器并使用mailuser1发送邮件给mailuser2
telnet mail.hoyeong.com 25
helo mail.hoyeong.com
mail from:"Hello mail"<[email protected]>
rcpt to:[email protected]
data
hello huhy,welcome!!!!
.
quit
验证
服务端切换到mailuser2验证即可
root@ubuntu-server:~# su mailuser2
$ mail
"/var/mail/mail1": 1 message 1 new
>N 1 [email protected]. Tue Nov 22 14:11 10/352
? 1
Return-Path: <[email protected]>
Received: from www.hoyeong.com ([192.168.200.101])
by huhy (8.15.2/8.15.2/Debian-22ubuntu3) with SMTP id 2AME8a4K004428
for [email protected]; Tue, 22 Nov 2022 14:10:30 GMT
Date: Tue, 22 Nov 2022 14:08:36 GMT
From: [email protected]
Message-Id: <202211221410.2AME8a4K004428@huhy>
hello huhy,welcome!!!!
?
#使用exit退出
dhcp服务测试
注:此服务配置的DHCP动态IP地址为20-100,所以第一个使用的起始网址为为20
将客户端centos的网卡配置为动态后重启即可
先备份网卡文件
cp /etc/sysconfig/network-scripts/ifcfg-ens33{,.bak}
cat > /etc/sysconfig/network-scripts/ifcfg-ens33 <<eof
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=52c22627-a236-404e-99a6-ed79ff9fd392
DEVICE=ens33
ONBOOT=yes
eof
然后关机重启客户端服务器!!!!!
验证
大功告成!!!!!!
完结撒花!!!!!!