基于Linux操作系统的DNS服务器实验

实验6 DNS服务器

一、实验目的

熟练掌握DNS服务器的原理、配置过程与应用。

二、实验环境

硬件:PC电脑一台,网络正常。

配置:win10系统,内存大于8G ,硬盘500G及以上。

软件:VMware、Ubuntu16.04。

三、实验内容

配置一台DNS服务器,域名为text.com,IP为192.168.1.100,主机名为

dns.text.com

实验步骤

1、 本实验将在网络条件下进行
2、进入新建的用户,备份apt-get的源文件

程序运行截图:

3、更新apt-get源文件为阿里云源。(编辑/etc/source.list,)

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| deb https://mirrors.aliyun.com/ubuntu/ xenial main deb-src https://mirrors.aliyun.com/ubuntu/ xenial main deb https://mirrors.aliyun.com/ubuntu/ xenial-updates main deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main deb https://mirrors.aliyun.com/ubuntu/ xenial universe deb-src https://mirrors.aliyun.com/ubuntu/ xenial universe deb https://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb https://mirrors.aliyun.com/ubuntu/ xenial-security main deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main deb https://mirrors.aliyun.com/ubuntu/ xenial-security universe deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security universe deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse |

程序运行截图:

4、更新apt-get。

程序运行截图:

5、在线安装BIND9。

程序运行截图:

6、配置dns服务器,进入/etc/bind中

程序运行截图:

7、修改配置文件/etc/bind/named.conf.local

程序运行截图:

8、复制db.local,并重命名为db.text.name

程序运行截图:

9、修改db.text.name

程序运行截图:

服务器IP为192.168.19.128:

10、重启服务

程序运行截图:

12、分别测试abc.text.name www.text.name ns.text.name

程序运行截图:

13、安装apache2

程序运行截图:

14、在默认配置下,在Linux下的浏览器输入http://localhost,查看页面。

程序运行截图:

建立个人网站站点
15、在自己创建的用户主目录里面创建目录public_html,在该目录里新建index.html,并输入以下内容。

程序运行截图:

16、修改/etc/apache2/mods-available/userdir.conf的配置内容,把UserDir public_html前的#删掉,给UserDir disabled root加上#。

程序运行截图:

创建软连接。

程序运行截图:

bash 复制代码
sudo ln -s /etc/apache2/mods-available/userdir.load /etc/apache2/mods-enabled/userdir.load

sudo ln -s /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-enabled/userdir.conf
关闭防火墙和SELinux服务。

如果提示setenforce未安装,则执行以下命令:

程序运行截图:

重新启动apache服务。

sudo systemctl restart apache2

bash 复制代码
sudo systemctl restart apache2

程序运行截图:

查看apache服务器的状态。
bash 复制代码
systemctl status apache2

程序运行截图:

在Linux的浏览器下输入http://localhost/\~zx,zx为自己新建的用户。

程序运行截图:

查看Linux下apache服务器的IP地址。

程序运行截图:

常见问题提示

  1. 代码输入错误;
  2. 运行结果出现问题。

五、实验作业

1、根据要求,完成实验指导里的操作流程。

2、实验结果分析和实验总结:

setenforce是Linux系统中用于设置SELinux(Security-Enhanced Linux,安全增强型Linux)工作模式的命令。SELinux是一种安全机制,通过强制访问控制(Mandatory Access Control,MAC)来限制进程的权限,以保护系统免受恶意程序和攻击的威胁。执行setenforce 0表示将SELinux设置为Permissive模式,此时SELinux不会阻止任何操作,但会记录安全策略违反的情况。

六、问题

如果按照以上流程不能正确运行代码,请找出原因。

实验过程中遇到问题不能下载bind9:

根据报错信息"bind9-libs (= 1:9.16.1-0ubuntu2) but 1:9.18.28-0ubuntu0.20.04.1 is to be installed",发现是之前下载的bind9-libs版本过高,于是先删除libs,再下载提示的版本bind9-libs=1:9.16.1-0ubuntu2,具体命令如下:sudo apt remove bind9-libs sudo apt install bind9-libs=1:9.16.1-0ubuntu2

相关推荐
两点王爷6 分钟前
docker 运行自定义化的服务-后端
运维·docker·容器
邪恶的贝利亚1 小时前
FFMEPG常见命令查询
linux·运维·网络·ffmpeg
搜搜秀1 小时前
find指令中使用正则表达式
linux·运维·服务器·正则表达式·bash
弧襪2 小时前
Ubuntu vs CentOS:Shell 环境加载机制差异分析
linux·ubuntu·centos
七七powerful2 小时前
使用opentelemetry 可观测监控springboot应用的指标、链路实践,使用zipkin展示链路追踪数据,使用grafana展示指标
运维
Archie_IT3 小时前
修图自由!自建IOPaint服务器,手机平板随时随地远程调用在线P图
运维·服务器·前端·git·深度学习·npm·conda
行思理3 小时前
centos crontab 设置定时任务访问链接
linux·运维·centos
阳光明媚大男孩3 小时前
24.0.2 双系统ubuntu 安装显卡驱动黑屏,系统启动界面键盘失灵
linux·ubuntu·计算机外设
无名之逆3 小时前
[特殊字符] Hyperlane:为现代Web服务打造的高性能Rust文件上传解决方案
服务器·开发语言·前端·网络·后端·http·rust
再玩一会儿看代码4 小时前
[特殊字符] 深入理解 WSL2:在 Windows 上运行 Linux 的极致方案
linux·运维·windows·经验分享·笔记·学习方法