问题1:基本网络设定#配置静态地址信息: #通过hostname查看本机编号,例如 #StationaX.example.com 其中X为本机编号 #IP地址为:192.168.0.X #子网掩码:255.255.255.0 #网关:192.168.0.254 #网页测试:http://server1.example.com/rhct.html
答案: #hostname
#vim /etc/sysconfig/network
HOSTNAME=station6.example.com #hostname station6.example.com
#vim /etc/sysconfig/network-scripts/ifcfg-eth0 BOOTPROTO=none IPADDR=192.168.0.6
NETWORK=255.255.255.0 GATEWAY=192.168.0.254 :wq
#Service network restart #ping 192.168.0.254 Ping通
网页测试:http://server1.example.com/rhct.html 问题2:账户管理 #建立 staff 群组 #建立 naima 用户,使其附属于 staff 群组 #建立 taliesin 用户,使其附属于staff 群组 #建立 simira 用户,使其无法交互式登录本地系统,且不是 staff 群组成员 #以上使用者naima、talisin及simira 的密码均为 passwd
答案:
#groupadd staff
#useradd –G staff naima #useradd -G staff taliesin
#useradd –s /sbin/nologin simira #passwd naima Passwd
#passwd taliesin Passwd
#passwd simira Passwd
问题3:共享目录设置 建立一个工作目录于 /commom/staff ,并拥有下列属性: #/shared/staff 的所属群组为 staff; #该目录应对 staff 群组成员有可读、可写、可执行的权限; #对taliesin没有任何权限 #对其他使用者有可读的权限
答案:
#mkdir –p /commom/staff
#chown .staff /commom/staff #ll –d /commom/staff
#chmod 775 /commom/staff
#getfacl /commom/staff
#setfacl -m u:taliesin:0 /commom/staff #getfacl /commom/staff
问题4:权限设将 /etc/fstab 文件复制到 /tmp,设定 /tmp/fstab 的权限#/tmp/fstab 文件的属主是 root 使#/tmp/fstab 文件的所属群组是 root #/tmp/fstab 文件不得为任何人#使用者 naima 可以读写 #所有其他使用者(目前的及未来的)可以读取 /tmp/fstab
答案:
#cp /etc/fstab /tmp/ #ll /tmp/
#getfacl /etc/fstab
#setfacl -m u:naima:rw /tmp/fstab #getfacl /etc/fstab
置
,使: 用者 群组 执行 /tmp/fstab
问题5:内核升级和路由启用 #在您的系统上启用 IP Forwarding 功能,并使之永久生效 #vim /etc/sysctl.conf Net.ipv4.ip_forward = 1 :wq
从ftp://server1.example.com/pub/updates 安装适用的 kernel 更新套件,必须符合下列准则: #更新版的 kernel 套件在重新开机后为预设的 kernel,原来的 kernel 套件依旧存在,并且可以手动启用
#lftp server1.example.com >cd pub >cd updates >get kernel* >exit
#rpm –ivh kernel*
#vim /boot/grub/grub.conf Default=1 问题6:打印机设置 #使用 IPP(CUPS)设定您系统上的预设本地打印机列至 server1.example.com 上的 stationX,设定该印表机时请使用 “Generic-text-only”印表机。
#system-config-printer
#echo “station6.example.com” | lpr #firefox
登陆地址检查打印情况 问题7:定时任务列表与NTP设置 #为用户 naima 设立一个任务计划,在本地时间每天 20:45 执行/bin/echo hello 设定您的系统为 server1.example.com 的NTP 客户端 #crontab –u naima –e
45 20 * * * /bin/echo hello :wq
#service crond restart #crondtab -u naima -l
45 20 * * * /bin/echo hello
设定您的系统为 server1.example.com 的NTP 客户端
问题8:NIS服务 #NIS服务器为 192.168.0.254 作为使用者验证,NIS域名为:notexample;请注意下列事项:nisuserX 须能登入您的系统,X 指的是您的工作站编号,但是登入时并无家目录,须等到您完成下面的 autofs考题才会有家目录在您的系统上,所有的 NIS 使用者密码均为 passwd 问题9:自动挂载服务 为 NIS 使用者设定 autofs以自动挂载其家目录: #server1.example.com(192.168.0.254) 通过 NFS 分享 /rhome/stationX 给您的工作站,X为您的工作站编号,nisuserX 使用者的家目录是 server1.example.com:/rhome/stationX/nisuserX,nisuserX 使用者的家目录应该自动挂载在本地端的 /rhome 下面的 /rhome/nisuserX家目录应设定为具可被其使用者写入的权限,当您使用 nisuser1 ~ nisuser20 登入时,能存取家目录的仅有 nisuserX 使用者 范例:station100 须设定在 nisuser100 登入时自动将server1.example.com:/rhome/station100/nisuser100 的 NFS 分享挂载到其家目录/rhome/nisuser100
答案:
#authconfig-tui 选nis
域:notexmple
服务器:192.168.0.254
#showmount –e 192.168.0.254 #vim /etc/auto.master /home /etc/nis.misc
#cp /etc/auto.misc /etc/nis.misc #vim /etc/nis.misc
guest2006 -fstype=nfs :wq
#service autofs restart #su - guest2006 显示正常
问题10:文件系建立一个分区,大小为300M,挂载到/common,永久生效
答案: #fdisk -l
#fdisk /dev/sda n e 4 默认 +300M
统
设
置
192.168.0.254:/home/guests/guests2006
#partprobe /dev/sdb #mkfs.ext3 /dev/sdb1 #mkdir /common #vim /etc/fstab /dev/sdb1 /common ext3 #mount -a #ll /common
有 lost+found标示文件,挂载成功
defaults 0 0
问题11:yum设置yum源路径为:http://server1.example.com/pub/Server #vim /etc/yum.repos.d/rhel-debuginfo.repo [base]
Baseurl=http://server1.example.com/pub/Server Enable=1 Gpgcheck=0 :wq
#yum list
设置
可以生成yum库,则配置成功 RHCE
部
分
:
您须记得某些题目指定了某些服务不得为 my133t.org 网域所存取,所有这个网域的系统均位于192.168.1.0/255.255.255.0 网段内,意即所有这个网段内的系统都属于 my133t.org,网段 192.168.0.0/255.255.255.0的系统位于example.com域中! 问题2:逻辑卷管理 将home分区扩大为700M,偏差范围在670M~730M之间 #df -h #vgdisply
#vgextend vg0 /dev/sdc3 #vgdisplay vg0
#e2fsck -f /dev/vg0/data #resize2fs -f /dev/vg0/data
#lvextend –L +300M /dev/vg0/data
下图所示test-home文件夹已经是678M满足要求 补充:
将test-home缩小到200M #umount /test-home
#e2fsck -f /dev/vg0/data
#resize2fs -f /dev/vg0/data 200M
#lvresize -L 200M /dev/vg0/data
#lvdisplay /dev/vg0/data
#vgdisplay vg0 #mount –a #ll /test-home #df –h
测试正确 问题1:磁盘配额 用户disklog在/home/disklog最低限制为40K,当添加80K数据时会提示超出磁盘配额信息
#useradd disklog
#mount –o remount,usrquota /dev/vol0/home /home #vim /etc/fstab /dev/vol0/home /home ext3 defaults,usrquota 0 0 #quotacheck -cvu /home #quotaon /home #edquota -u disklog Saft hard 40 80
测试:
#su - disklog #cd
#dd if=/dev/zero of=file1 bs=1k count=50 是否有警告信息,有则正常
#dd if=/dev/zero of=file1 bs=1k count=90 是否提示超出磁盘配额,有则配置成功
#quota
问题3:ssh服务设置 依下列指示设定 SSH,用户taliesin 可以从 example.com网域内存取您的机器,但从 my133t.org 来的所有客户端均不能使用您系统上的 ssh 服务 #iptables -N CLASS-RULE
# iptables -A INPUT -j CLASS-RULE
# iptables -A CLASS-RULE -i lo -j ACCEPT # iptables -A CLASS-RULE -p icmp -j ACCEPT
# iptables -A CLASS-RULE -m state --state ESTABLISHED,RELATED -j ACCEPT # iptables -A CLASS-RULE -s 192.168.74.0/24 -p tcp --dport 22 -j ACCEPT # iptables -A CLASS-RULE -m state --state NEW -p udp --dport 514 -j ACCEPT # iptables -A CLASS-RULE -j REJECT
#service iptables save #service iptables restart #vim /etc/sysconfig/iptables
问题4:FTP服务设置 设定您系统上的 FTP 存取: 在 example.com 网域中的客户端都可以用匿名(anonymous)登入您的机器 在 example.com 网域外的客户端都不能存取您的 FTP 服务
答案:
#yum install vsftpd #chkconfig vsftpd on #service vsftpd restart
#vim /etc/sysconfig/iptables-config
IPTABLES_MODULES=”ip_conntrack_netbios_ns ip_conntrack_ftp” :wq
#iptables –I CLASS-RULE 5 –s 192.168.74.0/24 –m state –state NEW –p tcp –pdort 21 -j ACCEPT
#service iptables save #service iptables restart
登陆测试机测试
问题5:Samba服务 通过 SMB 共享 /common 目录: 您的 SMB 服务器须设定为 STAFF 工作组的成员 共享名称为 “common” 只共享给 example.com 网域内的客户端 共享必须是可浏览的(browseable) taliesin 可以读取这个共享目录,如果必要的话,使用的密码为 password
答案:
#yum install samba* #chkconfig smb on #service smb restart
#vim /etc/samba/smb.conf Workgroup=STAFF [common]
comment = Public Stuff path = /common public = yes browseable=yes ; writable = yes ; printable = no ; write list = +staff :wq
#iptables –I CLASS-RULE –s 192.168.74.0/24 –p tcp –dport 137:139 –j ACCEPT #iptables –I CLASS-RULE –s 192.168.74.0/24 –p udp –dport 137:139 –j ACCEPT #iptables –I CLASS-RULE –s 192.168.74.0/24 –p tcp –dport 445 –j ACCEPT #iptables –I CLASS-RULE –s 192.168.74.0/24 –p udp –dport 445 –j ACCEPT #service iptables save
#service iptables restart
#chcon –t samba_share_t /common #smbpasswd –a taliesin Password
#service smb restart
测试:
#smbclient –L 192.168.74.82
#smbclient –L 192.168.74.82 –U taliesin Passwd:password
#smbclient //192.168.74.82/common –U taliesin Passwd:password 显示正常则正确
问题6:Web服务 设定您的网站伺服器,网址是 http://stationX.example.com,然后执行下列步骤:下载 ftp://server1.example.com/pub/rhce/station.html 将下载的档案重新命名为 index.html 将档案复制到您的网站的 DocumentRoot 切勿更动 index.html 档案的内容 选作题
问题3:建立虚拟网站,网址为 http://wwwX.example.com,X 是您的工作站编号,并设定: DocumentRoot 为 /var/www/virtual 下载 ftp://server1.example.com/pub/rhce/www.html 将档案重新命名为 index.html 将档案复制到您的虚拟服务器的 DocumentRoot,切勿更动 index.html 档案的内容 注意:原来的网站 http://stationX.example.com 必须依然可以存取 server1.example.com 的DNS 伺服器已提供了 wwwX.example.com 的名称解析
答案:
#yum install httpd* #chkconfig httpd on #service httpd start
#mkdir /var/www/virtual #lftp server1.example.com
拷贝index.html到/var/www/index目录下 拷贝www.html到/var/www/virtual目录下 #cp www.html /var/www/virtual/index.html #vim /etc/httpd/conf/httpd.conf NameVirtualHost 192.168.74.82:80 ServerAdmin webmaster@dummy-host.example.com DocumentRoot /var/www/html ServerName station6.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common
ServerAdmin webmaster@dummy-host.example.com DocumentRoot /var/www/virtual ServerName www6.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common
# iptables -I CLASS-RULE -p tcp --dport 80 -j ACCEPT # iptables -I CLASS-RULE -p udp --dport 80 -j ACCEPT #service iptables save #service iptables restart 测试:
#elinks www6.example.com #elinks station6.example.com
显示正常则配置正确 问题7:NFS服
设定您的系统上的 NFS 服务器,将 /shared 目录分享给 example.com域中的用户#chkconfig –list nfs #chkconfig nfs on #service nfs restart #mkdir /shared #vim /etc/exports /share 192.168.0.0/255.255.255.0(rw) :wq
#vim /etc/sysconfig/nfs RQUOTAD_PORT=4001 LOCKD_TCPPORT=4002 LOCKD_UDPPORT=4002 MOUNTD_PORT=4003 STATD_PORT=4004 :wq
#service nfs restart #rpcinfo –p
务
端口更改正确
# iptables -I CLASS-RULE -s 192.168.74.0/24 -p tcp --dport 4001:4004 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p udp --dport 4001:4004 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p udp --dport 111 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p tcp --dport 111 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p tcp --dport 2049 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p udp --dport 2049 -j ACCEPT # iptables –L
# service iptables save # service iptables restart #service nfs restart
测试:
#showmount –e 192.168.0.6 可以看到文件
#mount –t nfs 192.168.0.6:/shared /mnt 可以挂载
问题8:邮件服务 依照下原则设定您系统上的 POP3 服务 simira 可以从 example.com 网域内取回在您系统上的信件 从 my133t.org 来的所有客户端均不能使用您系统上的 POP3 服务 设定一个邮件别名,将寄给 admin的档案转至本地的 naima 使用者 依下列项目设定您的 SMTP 邮件服务: 您的邮件服务器必须可以接受来自本地端及来自远端的邮件taliesin 必须可以接收来自远端的邮件寄给 taliesin 的邮件,必须存放在/var/spool/mail/tailiesin 的邮件队列中
答案:
#yum install sendmail* #chkconfig sendmail on #service sendmail restart #vim /etc/mail/sendmail.mc
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl :wq
#vim /etc/mail/local-host-names Example.com
Station6.example.com #yum install dovecot #chkconfig dovecot on #service dovecot restart #vim /etc/dovecot.conf
protocols = imap imaps pop3 pop3s (去除此句注释,机开通imap imaps pop3 pop3s服务) :wq
# iptables -I CLASS-RULE -s 192.168.74.0/24 -p tcp --dport 110 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p udp --dport 110 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p udp --dport 25 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p tcp --dport 25 -j ACCEPT # service iptables save # service iptables restart #vim /etc/aliases Admin: naima
#service sendmail restart
测试: 登陆测试机
#mail admin@station6.example.com 本地查看naima是否收到邮件
#mail taliesin@station6.example.com
本地查看#ls /var/spool/mail 是否有taliesin
选作题 问题1:设定提供 IMAPS 服务 simira 必须可以从 example.com 网预存取 IMAPS 服务 IMAPS 必须禁止从其他的网域或网段存取 IMAPS 所使用的 SSL 凭证需依指定内容建立: 使用 Country, State, Locality, Organization Name 的预设值 Organization Unit 设定为 GLS Common Name 设定为 station.example.com Email Address 设定为 root@stationX.example.com
答案:
# cd /etc/pki/tls/certs/ #make dovecot.pem
#vim /etc/dovecot.conf
ssl_cert_file = /etc/pki/tls/certs/dovecot.pem ssl_key_file = /etc/pki/tls/certs/dovecot.pem :wq
# iptables -I CLASS-RULE -s 192.168.74.0/24 -p tcp --dport 993 -j ACCEPT # iptables -I CLASS-RULE -s 192.168.74.0/24 -p udp --dport 993 -j ACCEPT # service iptables save # service iptables restart # service dovecot restart
测试:
登陆测试机:
#mutt –f imaps://naima@station6.example.com 可以发信
#mutt –f imaps://naima@station6.example.com 可以收信
问题2:设立代理服务器(squid) 监听的端口为 8080 在 example.com 网域内的客户端都可以存取您的代理服务器 在 example.com 网域外的客户端都不可以存取您的代理服务器
答案:
#yum install squid #chkconfig squid on #service squid restart
#vim /etc/squid/squid.conf http_port 8080
acl list1 src 192.168.74.0/255.255.255.0 http_access allow list1 :wq
#iptables –I CLASS-RULE –s 192.168.0.0/24 –p tcp –dport 8080 –j ACCEPT #iptables –I CLASS-RULE –s 192.168.0.0/24 –p udp –dport 8080 –j ACCEPT # service iptables save # service iptables restart # service squid restart
测试:
本机用代理测试自己的网站
因篇幅问题不能全部显示,请点此查看更多更全内容