在配置文件最后添加如下内容:
[staffdir]
comment = staff’s service path = /var/samba/staff public = no
writable=yes
write list=@staff 读写权限的用户或组
然后重启服务,挂载NFS导出的目录,测试 user1和user2是否可读写,参考任务一和二。
5. 关于Samba服务器的其它命令
(1)可以使用其它命令如:smbclient –L //IP地址/共享名–U 用户名来访问windows或linux提供的共享,如:使用命令查看并访问共享,smbclient –L //192.168.1.200/fredsdir –U fred
(2)可以使用smbstatus命令查看Samba服务器的资源使用情况 (3)可以输入testparm来检查smb.conf配置文件的正确性
【实验重点】
1.Samba服务器的基本配置; 2.Samba客户端的使用方法。
21
DNS服务配置(一)
【实验目的】
掌握Linux系统BIND DNS服务的配置,掌握nslookup程序的使用方法。
【实验内容】
1. 使用setup菜单完成TCP/IP网络配置;
(1)在命令行运行setup,选择“Network Configuration” (2)选择“eth0(eth0)??” (3)取消“Use DHCP”
(4)配置IP地址和子网掩码为192.168.202.5/255.255.255.0,网关为192.168.202.1 (5)一层层退出
(6)运行ifdown eth0禁用以太网卡
(7)运行ifup eth0启用以太网卡并重新读取配置。 (8)使用ifconfig检查eth0网卡的IP地址配置。 (9)关闭防火墙:#iptables –F
#vi /etc/selinux/config 中更改为SELINUX=disabled
2.安装软件包
主要检查以下六个包是否有安装: bind-9.3.4-6.P1.el5.i386.rpm
caching-nameserver-9.3.4-6.P1.el5.i386.rpm 3. 配置DNS主配置文件
在/etc/named下进行配置。命令如下: # cd /etc
# cp -p named.caching-nameserver.conf named.conf # -p要用 # vi named.conf # 配置主配置文件 (见附件named.conf)
4.配置named.rfc1912.zones文件,添加区域。 # cd /etc/
# vi named.rfc1912.zones
(见附件named.rfc1912.zones)
5. 检查配置文件
# named-checkconf named.conf
# named-checkconf named.rfc1912.zones # # 没有任何提示才是正确的配置
22
6.复制区域解析文件 # cd /var/named/
# cp -p localdomain.zone jun.com.zone # -p要加 # cp -p named.local 1.168.192.rev # -p要加
7. 配置正向解析区域“jun.com”数据文件 (1)cd /var/named (2)vi jun.com.zone (3)添加以下配置: (见附件jun.com.zone)
8. 配置反向解析区域“1.168.192.rev”数据文件 (1)cd /var/named (2)vi 1.168.192.rev (3)添加以下配置: (见附件1.168.192.rev) 9. 启动DNS服务器 service named start chkconfig named on 10. 验证DNS服务器
在客户端XP运行cmd --> nslookup 验证DNS配置: > server 192.168.1.103
> set type=a > dns.jun.com > www.jun.com > mail.jun.com
> set type=cname > ftp.jun.com
> set type=ptr > 192.168.202.5
> set type=mx >jun.com
> exit
附件1:named.conf options {
listen-on port 53 { any; }; # 修改的地方
23
listen-on-v6 port 53 { ::1; }; directory \
dump-file \statistics-file \
memstatistics-file \
// Those options should be used carefully because they disable port // randomization
// query-source port 53; // query-source-v6 port 53;
allow-query { any; }; # 修改的地方
};
logging {
channel default_debug { file \severity dynamic; }; };
view localhost_resolver {
match-clients { any; }; # 修改的地方
match-destinations { any; }; # 修改的地方 recursion yes;
include \};
附件2 named.rfc1912.zones // named.rfc1912.zones: //
// Provided by Red Hat caching-nameserver package //
// ISC BIND named zone configuration for zones recommended by // RFC 1912 section 4.1 : localhost TLDs and address zones //
// See /usr/share/doc/bind*/sample/ for example named configuration files. //
zone \
type hint;
file \};
zone \
type master;
file \allow-update { none; }; };
zone \
24
type master;
file \allow-update { none; };
};
zone \
type master;
file \allow-update { none; }; };
zone \
type master;
file \allow-update { none; }; };
zone \
type master;
file \allow-update { none; }; };
zone \
type master;
file \
allow-update { none; }; }; # 以上为默认配置
zone \添加的正向解析区
type master;
file \allow-update {none;}; };
zone \添加的方向解析区
type master;
file \allow-update {none;}; };
附件3:jun.com.zone $TTL 86400
@ IN SOA dns.jun.com. root.jun.com. ( 2009052200 ;serial 28800 ;refresh 14400 ;retry 720000 ;expire 86400 ;ttl
25