NFS服务器
NFS(Network File System,网络文件系统),NFS服务器可以让PC将网络中的NFS服务器共享的目录挂载到本地端的文件系统中,而在本地端的系统 中看来,那个远程主机的目录就好像是自己的一个磁盘分区一样。
注:在启动NFS之前,要先启动RPC,否则NFS会无法向RPC注册。另外,RPC若重新启动,原来注册的 数据会消失不见,因此RPC重启后,它管理的所有服务都需要重新启动以重新向RPC注册。
在配置之前服务端和客户端都需要下载bind和nfs-utils:
yum install rpcbind
yum install nfs-utils
服务端:(192.168.150.138)
[root@localhost ~]# mkdir /data
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# cat /etc/exports
/public 192.168.150.139(ro)
[root@localhost ~]# chmod o+w /data/
[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl restart nfs-server
[root@localhost ~]# showmount -e 192.168.150.138
Export list for 192.168.150.138:
/data 192.168.150.139
客户端:(192.168.150.139)
[root@client ~]# showmount -e 192.168.150.138
Export list for 192.168.168.128:
/data 192.168.168.140
[root@client ~]# mkdir -p /nfsclient/client-data/
[root@client ~]# mount 192.168.150.138:/data /nfsclient/client-data/
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 871M 0 871M 0% /dev/shm
tmpfs 349M 7.2M 342M 3% /run
/dev/mapper/rhel-root 37G 5.1G 32G 14% /
/dev/nvme0n1p1 1014M 394M 621M 39% /boot
tmpfs 175M 96K 175M 1% /run/user/0
/dev/sr0 8.5G 8.5G 0 100% /run/media/root/RHEL-9-1-0-BaseOS-x86_64
192.168.150.138:/data 37G 5.2G 32G 14% /nfsclient/client-data
autofs自动挂载
[root@client ~]# yum install autofs -y
[root@client ~]# grep suibian /etc/auto.master
/client /etc/auto.suibian
[root@client ~]# vim /etc/auto.suibian
[root@client ~]# cat /etc/auto.suibian
upload 192.168.150.138:/nfs/upload
[root@client ~]# systemctl restart autofs
[root@client ~]# cd /client
[root@client ~]# cd upload
DNS服务器
DNS(Domain Name System)是互联网上的一项服务,它作为将域名和IP地址相互映射的一个分布式 数据库,能够使人更方便的访问互联网。
域名分为: | |
国家顶级域名 | cn、us、uk |
通用顶级域名 | com、net、org、int、gov、mil |
基础结构域名 | arpa(反向域名解析) |
根域名服务器:所有的根域名服务器都知道所有的顶级域名服务器的域名和IP地址
顶级域名服务器:负责管理在该顶级域名服务器注册的二级域名
权限域名服务器:负责一个“区”的域名服务器
本地域名服务器:本地域名服务器不属于域名服务器的层次结构,但是它对域名系统非常重要。当 一个主机发出DNS查询请求时,这个查询请求报文就发送给本地域名服务器。
主从DNS服务器:为了提高域名服务器的可靠性,DNS域名服务器都把数据复制到几个域名服务器来保存,其中的一个就是主DNS服务器(Master name server),负责解析至少一个域。其他的 是辅助(从)DNS服务器(Slave name server),负责解析至少一个域,是主DNS服务器的辅 助。保证数据的一致性。
缓存DNS服务器:不负责解析域,只是缓存域名解析的结果。
DNS解析方式
正向解析:将FQDN(完全合格域名)--->IP
反向解析:将IP--->FQDN
基础配置
[root@localhost ~]# yum install bind -y
[root@localhost ~]# rpm -ql bind
/etc/named.conf #bind主配置文件
/var/named/slaves #从dns服务器文件夹
[root@localhost ~]# vim /etc/named.conf
options {
#定义监听端口,如果所有地址都监听,则只写端口
listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; };
#定义数据文件目录
directory "/var/named";
#只允许本地主机进行查询
allow-query { localhost; };
};
#定义区域
zone "." IN {
type hint;
file "named.ca"; #/var/named/named.ca
};
DNS正向解析配置
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# cat /etc/named.conf
options{
listen-on port 53 {any;};
directory "/var/named";
allow-transfer{192.168.168.155;};
};
zone "baidu.com" IN{
type master;
file "named.baidu.com";
};
[root@localhost ~]# vim /var/named/named.baidu.com
[root@localhost ~]# cat /var/named/named.baidu.com
$TTL 1D
baidu.com. IN SOA jio.baidu.com. admin.baidu.com. (10 1D 1H 1W 3H)
IN NS jio.baidu.com.
jio.baidu.com. IN A 192.168.168.155
haha IN A 192.168.168.155
xixi IN A 192.168.168.155
wahaha IN CNAME xixi
[root@localhost ~]# systemctl restart named
[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# setenforce 0
[root@localhost ~]# host jio.baidu.com 192.168.168.155
Using domain server:
Name: 192.168.168.155
Address: 192.168.168.155#53
Aliases:
jio.baidu.com has address 192.168.168.155
[root@localhost ~]# nslookup jio.baidu.com 192.168.168.155
[root@localhost ~]# dig -t A jio.baidu.com @192.168.168.155
DNS反向解析配置
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# cat /etc/named.conf
options{
listen-on port 53 {any;};
directory "/var/named";
allow-transfer{192.168.168.155;};
};
zone "168.168.192.in-addr.arpa" IN{
type master;
file "named.192.168.168";
};
[root@localhost ~]# vim /var/named/named.192.168.168
[root@localhost ~]# cat /var/named/named.192.168.168
$TTL 1D
@ IN SOA jio.baidu.com. admin.baidu.com. (10 1D 1H 1W 3H)
IN NS jio.baidu.com.
155 IN PTR jio.baidu.com.
155 IN PTR hah.baidu.com.
155 IN PTR wahaha.baidu.com.
155 IN PTR xixi.baidu.com.
[root@localhost ~]# systemctl restart named
[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# setenforce 0
[root@localhost ~]# host 192.168.168.155 192.168.168.155
Using domain server:
Name: 192.168.168.155
Address: 192.168.168.155#53
Aliases:
155.168.168.192.in-addr.arpa domain name pointer xixi.baidu.com.
155.168.168.192.in-addr.arpa domain name pointer jio.baidu.com.
155.168.168.192.in-addr.arpa domain name pointer hah.baidu.com.
155.168.168.192.in-addr.arpa domain name pointer wahaha.baidu.com.
主从DNS解析配置
完全区域传送
#主
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# cat /etc/named.conf
options{
listen-on port 53 { any; };
directory "/var/named";
allow-transfer{ any; };
};
zone "baidu.com" IN{
type master;
file "named.baidu.com";
};
[root@localhost ~]# vim /var/named/named.baidu.com
[root@localhost ~]# cat /var/named/named.baidu.com
$TTL 1D
@ IN SOA @ admin.baidu.com. (10 1D 1H 1W 3H)
IN NS jio.baidu.com.
IN NS slave.baidu.com.
slave IN A 192.168.150.139
jio IN A 192.168.150.138
xixi IN A 192.168.150.138
wahaha IN CNAME xixi
[root@localhost ~]# systemctl restart named
[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# 0
#从
[root@client ~]# vim /etc/named.conf
[root@client ~]# cat /etc/named.conf
options{
listen-on port 53 { any; };
directory "/var/named";
allow-transfer{ any; };
};
zone "baidu.com" IN{
type slave;
file "slaves/named.baidu.com";
masters {192.168.150.138;};
};
[root@client ~]# systemctl restart named
[root@client ~]# host jio.baidu.com 192.168.150.139
Using domain server:
Name: 192.168.150.139
Address: 192.168.150.139#53
Aliases:
jio.baidu.com has address 192.168.150.138
增量区域传送
[root@localhost ~]# cat /var/named/named.baidu.com
$TTL 1D
@ IN SOA @ admin.baidu.com. (100 1D 1H 1W 3H)
IN NS jio.baidu.com.
IN NS slave.baidu.com.
slave IN A 192.168.150.139
jio IN A 192.168.150.138
xixi IN A 192.168.150.138
wahaha IN CNAME xixi
[root@localhost ~]# systemctl restart named