linux学习第十七天(NFS、AUTOFS文件共享配置,DNS配置)
一、nfs(网络文件系统,实现linux系统上文件共享)
服务器配置
yum install nfs-utils (安装nfs软件包)
iptables -f (清空防火墙)
service iptables save (保存防火墙配置)
mkdir /nfsfile (创建共享文件夹)
chmod -rf 777 /nfsfile/ (添加共享文件777权限)
echo "hello nfs-server "> /nfsfile/1.txt (添加文件)
vim /etc/exports (编辑nfs配置文件)
systemctl restart rpcbind (nfs服务进行共享之前,需要使用rpc服务将nfs服务器的ip地址和端口号等信息发送给客户端)
systemctl enable rpcbind
systemctl restart nfs-server
systemctl enable nfs-server
iptalbes -f (清空防火墙)
service iptables save
客户端配置
showmount -e 192.168.100.10 (查看nfs服务器共享信息)
mkdir /nfsfile (创建共享文件夹)
chmod -rf 777 /nfsfile/ (添加共享文件777权限)
vim /etc/fstab
mount -a
二、autofs (自动挂在服务)
yum install autufs
systemctl restart autufs
systemctl enable autufs
vim /etc/auto.master
vim /etc/iso.misc
systemctl restart autofs (重启服务)
三、dns主服务器配置 (配置dns主服务器、从服务器、缓存服务器)
yum install bind-chroot
systemctl restart named
systemctl enable named
vim /etc/named.conf (配置著配置文件第11行,any指所有网卡提供dns 第17行any指所有用户请求查询)
配置dns区域文件
vim /etc/named.rfc1912.zones
配置dns数据文件
配置网卡信息
systemctl restart network
cd /var/named (切换到数据配置文件)
cp -a named.localhost dream.com.zone
cp -a named.loopback 192.168.100.arpa
vim dream.com.zone (配置正解析文件)
vim 192.168.100.arpa (配置反向解析)
systenctl restart named
systemctl enable named
nslookup (查看dns配置)
dns从服务器配置
yum install bind-chroot
systemctl restart named
systemctl enable named
修改主服务器
vim /etc/named.rfc1912.zones (允许从服务器同步)
iptables -f
service iptables save
修改从服务器
配置网卡信息
vim /etc/named.conf (配置同上)
vim /etc/named.rfc1912.zones
cd /var/named/slaves/
ls
systemctl restart named (重启服务,同步)
验证
将从服务器dns指向本机并重启网卡服务
nmtui
systenctl restart network
nslookup
dns 加密(tsig,加密一串字符串)
主服务器dns加密
cd /var/named/chroot/etc
dnssec-keygen -a hmac-md5 -b 128 -n host master-slave
[root@localhost chroot]# cat kmaster-slave.+157+50591.key
master-slave. in key 512 3 157 rlxn2+bmyrhpuga8miozwg==
vim transfer.key
chown root:named transfer.key
chmod 640 transfer.key
ln transfer.key /etc
vim /etc/named.conf (添加红色标记内容)
systemctl restart named
从服务器dns加密
cd /var/named/chroot/etc
vim transfer.key
chown root:named transfer.key
chmod 640 transfer.key
ln transfer.key /etc
vim /etc/named.conf (添加红色标记内容)
cd /var/named/slaves/
rm -f *
systemctl restart named