没有合适的资源?快使用搜索试试~ 我知道了~
linux服务器配置重点实例的源文件.pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 123 浏览量
2021-11-05
09:28:36
上传
评论
收藏 961KB PDF 举报
温馨提示
试读
36页
linux服务器配置重点实例的源文件.pdf
资源推荐
资源详情
资源评论
1
导航目录(本教材来自大赛人)
第 13 章 DHCP 服务器的配置 ........................................................................... 1
第 14 章 DNS 服务器配置 ................................................................................ 2
第 15 章 FTP 服务器 ........................................................................................ 4
第 17 章 Proxy 服务器配置 ............................................................................... 8
第 18 章 WWW 服务器配置 .............................................................................. 9
第 20 章 Samba 服务器配置 ............................................................................ 30
第 21 章 Telnet 和 SSH服务的配置与应用 ....................................................... 34
第 13 章 DHCP 服务器的配置
【实例 1】在某个局域网内有 120 台计算机,但只有 100 个可用的 IP 地址,地址段为
192.168.16.1 ~ 192.168.16.100,子网掩码是 255.255.255.0。其中, IP 地址 192.168.16.1 分配
给路由 器, IP 地址 192.168.16.1.2 分配给 本地 DNS 服 务器 ,地 址段 192.168.16.3 ~
192.168.16.10 则保留暂时不用,此外, 192.168.16.1.20、192.168.16.1.30 分配给固定的主机。
如果要使局域网内所有的主机都有机会上网,那么最好的方法就是配置一个 DHCP 服务器
来动态分配 IP 地址。
实例中, DHCP 服务的配置文件 dhcpd.conf 的内容如下:
ddns-update-style interim;
ignore client-updates;
subnet 192.168.16.0 netmask 255.255.255.0{
range 192.168.16.11 192.168.16.100;
option routers 192.168.16.1;
option subnet-mask 255.255.255.0;
option nis-domain “gdvcp.net ”;
option domain-name-servers 192.168.16.2,61.144.56.100;
option broadcast-address 192.168.16.255;
default-lease-time 86400;
max-lease-time 172800;
host pc1{
hardware ethernet 00:a0:cc:cf:9c:14;
fixed-address 192.168.16.20;
}
host pc2{
hardware ethernet 04:20:c1:f8:37:11;
fixed-address 192.168.16.30;
}
2
}
【实例 2】要将一台 IP 地址为 192.168.16.7 的计算机改为由 DHCP 服务器静态分配 IP
(IP 地址固定为 192.168.16.20),可按以下步骤在 DHCP 服务器上设置。
使用 ping 命令测试一下该计算机是否在线。
用 arp 命令查出该计算机的网卡 MAC 地址,假如计算机网卡 MAC 地址为 a0:cc:cf:9c:14
在/etc/dhcpd.conf 文件中加入如下 host 语句:
host pc1{
hardware ethernet 00:a0:cc:cf:9c:14;
fixed-address 192.168.16.20;
}
第 14 章 DNS 服务器配置
【实例 1】要添加一个域名为“ center.example.com”,IP 地址为 192.168.16.177;域名为
“ news.example.com”, IP 地址为 192.168.16.178 ;域名“ mail.example.com ” ,IP 地址为
192.168.16.179 则可在 hosts文件中添加如下记录。
192.168.16.177 center.example.com
192.168.16.178 news.example.com
192.168.16.179 mail.example.com
【实例 2】设置主区域,主区域是 DNS 服务器保存着某个区域(如 example.com)的数
据信息,下面是一个在 /etc/named.conf 文件定义名为 example 主区域的例子。
zone “example.com" IN{ // 主区域名称为 example.com
type master; //DNS 区域的类型为 master
file “example.com.zone ”; // 设置主区域文件的名称为 example.com.zone
allow-transfer{ // 设置辅域名服务器的地址
192.168.1.177;
192.168.7.17;
};
};
【实例 3】设置反向解析区域,下面是一个在 /etc/named.conf 文件定义反向解析区域的
具体例子。
zone “16.168.192.in-addr.arpa ” IN { // 设置反向解析区域的名称
type master; // 设置区域类型为“ master ”
file “192.168.16.arpa ”; // 设置反向解析区域文件的名称
allow-update{ // 设置辅域名服务器的地址
192.168.1.177;
192.168.7.17;
};
};
【实例 4】DNS 服务器的区域数据文件一般存放在 /var/named/目录下,下面是一个在
/var/named/chroot/named/example.com.zone 文件的完整例子。
3
$ttl 38400 // 设计允许客户端缓存来自查询的数据的默认时间
example.com. IN SOA dns.example.com. admin.example.com. ( // 设置所管辖的域名
2005090503 // 设置序列号
10800 // 设置间隔时间
3600 // 设置重试时间
604800
38400 )
example.com. IN NS example.com.. // 设置名称服务器 NS 资源记录
dns IN A 192.168.16.177 // 设置主机地址 A 资源记录
www. example.com. IN A 192.168.16.9
mail1. example.com. IN A 192.168.16.178
mail2. example.com. IN A 192.168.16.179
mail3. example.com. IN A 192.168.16.180
localhost IN CNAME dns // 设置别名 CVAME资源记录
bbs IN CNAME www
samba IN CNAME www
// 设置邮件交换器 MX资源记录
example.com. IN MX 10 mail1. example.com.
example.com. IN MX 11 mail2. example.com.
example.com. IN MX 12 mail3. example.com.
【 实 例 5 】 设 置 反 向 解 析 区 域 文 件 , 下 面 是 一 个 在 /var/named/chroot/var/named/
192.168.16.arpa 文件定义反向解析区域的例子。
$ttl 38400
16.168.192.in-addr.arpa. IN SOA dns.example.com. admin. example.com. (
2005090503
10800
3600
604800
38400 )
16.168.192.in-addr.arpa. IN NS dns.example.com.
177.16.168.192.in-addr.arpa. IN PTR dns.example.com.
9 IN PTR www. example.com.
178 IN PTR mail1. example.com.
179 IN PTR mail2. example.com.
180 IN PTR mail3. example.com.
【实例 6】配置辅助名称服务器, 下面通过一个辅助名称服务器 /etc/name.conf 的完整例
子来说明各项设置。
directort “/var/named ”;
dump-file ”/var/named/data/cache-dumo.db ”;
statistics ”/var/named/data/named_stats.txt ”
version ”4.9.11 ”;
4
zone ”. ” {
type hint;
file “named.ca ”
};
zone “example.com ”{ // 设置从区域
type slave; // 设置类型为从区域
file ”slaves/example.com.zone ” // 设置主区域文件的名称
masters{192.168.16.177;};
};
zone “16.168.192.in-addr.arpa ”{
type slave;
file ”slaves/192.168.16.arpa ”
masters{192.168.16.177;};
};
【实例 7 】配置缓 存 Cache-only 服务器 。下面 通过一 个配置 Cache-only 服 务器
/etc/named.conf 文件完整例子来说明各项配置。
option {
directort “/var/named ”;
dump-file ”/var/named/data/cache-dumo.db ”;
statistics ”/var/named/data/named_stats.txt ”
version ”4.9.11 ”;
forward only;
forwarders {
61.144.56.101;
202.92.128.68;
};
};
include ”/etc/rndc.key ”
第 15 章 FTP 服务器
【实例 1】使用 Xinetd 启动 VSFTPD ,首先要将 vsftpd.conf 配置文件中的 listen 参数值
改为 NO。其次,生成一个 /etc/xinetd.d/vsftpd 文件,内容如下:
service vsftpd
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/vsftpd
port = 21
log_on_success += PID HOST DURATION
5
log_on_failure += HOST
}
通过修改 disable 值为 no 或 yes,并重新启动 xinetd ,从而启动或停止 VSFTPD ,命令
如下。
# etc/rc.d/init.d/ vsftpd start/stop/restart
【实例 2】配置 vsftpd , vsftpd 的配置文件 /etc/vsftpd/vsftpd.conf 是个文本文件。 以“ #”
字符开始的行是注释行。每个选项设置为一行,格式为“ option=value ”,注意“ =”号两边
不能留空白符。除了这个主配置文件外,还可以给特定用户设定个人配置文件,打开
/etc/vsftpd/vsftpd.conf ,vsftpd 默认的主配置文件如下。
# Example config file /etc/vsftpd.conf
# The default compiled in settings are very paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
,,,
#
# Allow anonymous FTP?
// 是否允许匿名用户登录
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
// 是否允许本地用户登录
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
// 是否给予用户在 FTP 中执行写的权利
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
// 设置本地用户的文件生成掩码为 022 ,默认值为 077
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
// 当远程用户更改目录时,是否出现提示信息
dirmessage_enable=YES
剩余35页未读,继续阅读
资源评论
BlueWatergg
- 粉丝: 3
- 资源: 11万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Typescript和PHP的编程知识储备库设计源码 - study-php
- Screenshot_2024-05-28-11-40-58-177_com.tencent.mm.jpg
- 基于Dart的Flutter小提琴调音器APP设计源码 - violinhelper
- 基于JavaScript和CSS的随寻订购网页设计源码 - web-order
- 基于MATLAB的声纹识别系统设计源码 - VoiceprintRecognition
- 基于Java的微服务插件集合设计源码 - wsy-plugins
- 基于Vue和微信小程序的监理日志系统设计源码 - supervisionLog
- 基于Java和LCN分布式事务框架的设计源码 - tx-lcn
- 基于Java和JavaScript的茶叶评级管理系统设计源码 - tea
- IMG_5680.JPG
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功