DHCP + DNS + WEB → Small architecture

Preparing Case: PC requires VMware virtual machine, with a link to download here for experiments:
link: https://pan.baidu.com/s/1V06orbCIXc7IY6oNNscJiQ extraction code: ejii
before the start of the case we must first know what DNS is :
the DNS translated into Chinese domain Name system (English full write: domain Name system, abbreviated as: DNS) is an Internet service. It acts as a distributed database of domain names and IP addresses will be mapped each other, it can make it easier to access the Internet. DNS uses TCP and UDP 53 port [1]. Currently, for every level domain name length limit is 63 characters, the total length of the domain name can not be more than 253 characters.
Initially, the character domain names are limited to a subset of ASCII characters. In 2008, ICANN adopted a resolution allowing the use of other languages as the character of the Internet top-level domain. The Punycode use based IDNA system can be set valid DNS Unicode character strings mapped. Therefore, such as "XXX. China", "XXX. United States," the domain name can be entered in the address bar and direct access, without the need to install plug-ins. However, due to the widespread use of English, other languages character as a domain name will have a variety of problems, such as difficulty in input, it is difficult in international promotion.
It is simply a system that translates domain names into IP addresses.
The deployment of DNS services:
the early days to resolve domain names using the HOSTS file: This file path on your computer as shown
DHCP + DNS + WEB → Small architecture
in the last etc folder you can see the hosts file
but the latter two reasons resolve the domain name later changed to DNS :

  1. Host Name Repeat
  2. Host difficult to maintain
    and DNS domain name system is distributed and hierarchical is a lot easier compared to the HOSTS

Let's look at the structure of the domain name space:

  1. Domain root (top layer)
  2. Top-level domain (category, were: organizational domain, country / region domain)
  3. secondary domain
  4. FQDN (Fully Qualified Domain Name Fully Qualified Domain Name: simultaneously with the host name and domain name) is
    a configuration diagram as shown in FIG.
    DHCP + DNS + WEB → Small architecture
    Let us illustrate exploded Examples:
    . Www.baidu.com most common in our example:
  5. Behind com "." When we actually landing pages have been withheld, and this. "" Is the root domain
  6. com is the top-level domain
  7. baidu is the second-level domain
  8. www is the host name
    this time run cmd, enter the command Ping www.baidu.com will get an IP address as shown in:
    DHCP + DNS + WEB → Small architecture
    this time we put this IP address into the knockout round in the browser's address bar, you can enter to Baidu's home page, the figure below shows the results of the operation:
    DHCP + DNS + WEB → Small architecture
    the above experiment is accessed through the IP address of the corresponding web server

Below us what DNS servers classification:

  1. The main name server: storage area in the settings of the DNS server
    that is stored in the data area of the original file
  2. Secondary Name Server: copy data from other servers in the
    data copies can not be modified
  3. A primary name server: DNS server tends to provide data replication
  4. Cache-Only Name Server: to query data stored in the cache

Next we look at the DNS query process: As shown below in order to www.benet.com
DHCP + DNS + WEB → Small architecture
this time we can use a command to resolve the domain name look Baidu's DNS address is how much:
we enter the command in cmd nslookup www.baidu .com. , You can get the domain name 192.168.0.1
DHCP + DNS + WEB → Small architecture

下面我们进进行DNS的搭建前的准备步骤::
我们以Server2016为DNS服务器,Win10为客户端PC机
进入虚拟机中的Ssever2016系统,设置网卡模式为仅主机:
DHCP + DNS + WEB → Small architecture
同时一定要注意的是在虚拟机的虚拟网络编辑器里,VMnet1这个名称下的DHCP选项不能勾选
DHCP + DNS + WEB → Small architecture
此时我们进入虚拟机中的Win10系统,也设置网卡模式为仅主机:(同时将两个接在VMnet1物理机上面进行运行,这样就可以进行相互通信)
这个时候我们回到Server2016上进行网络IP地址的设置
DHCP + DNS + WEB → Small architecture
再次进入Win10系统进行网络IP地址的设置,这里设置需要注意几点:
1.需要和Server2016的IP地址在同一网段,即192.168.100.
2.首选DNS服务器的地址是Server2016的地址,即:192.168.100.100,操作如下图所示
DHCP + DNS + WEB → Small architecture
这个时候我们检测一下网络是否互联互通,在Win10系统下使用cmd,输入指令:Ping 192.168.100.100,这个时候是不能互通的,原因是因为防火墙未关闭,在关闭防火墙之后即可互联互通,才可以进行后边的搭建工作,具体操作如下图所示:
DHCP + DNS + WEB → Small architecture
DHCP + DNS + WEB → Small architecture

接下来我们进行DNS的搭建工作:
进入server2016系统,开始菜单中选择服务管理器,在仪表板界面全部加载完成后:

  1. 点击添加角色和功能
  2. 点击下一步选择基于角色或基于功能的安装
  3. 点击下一步选择从服务器池中选择服务器(本台)
  4. 点击下一步服务器角色选择DNS服务器,添加功能
  5. 点击下一步不需要勾选其它功能
  6. 点击下一步点击安装
  7. 等待安装结束后点击完成
  8. 这个时候我们在开始菜单里的Windows管理工具里就可以找到新添加的DNS进入
    以下为操作步骤中需要注意步骤的图示
    DHCP + DNS + WEB → Small architecture
    DHCP + DNS + WEB → Small architecture
    DHCP + DNS + WEB → Small architecture
    点击创建好的DNS服务器,下面我们来在此服务器中创建查询机制
    在服务器界面中选择正向查询区域,右键点击新建区域进入新建区域向导:
  9. 点击下一步选择区域类型为主要区域
  10. 点击下一步设置区域名称,例:yun.com
  11. 点击下一步区域文件,创建新文件为默认即可
  12. 点击下一步动态更新,保持默认不允许动态更新即可
  13. 点击下一步点击完成则区域创建完毕,界面如下图所示:
    DHCP + DNS + WEB → Small architecture
    此时我们的域名只有yun.com,还缺少www这个主机名称,接着我们进行如下操作
    DHCP + DNS + WEB → Small architecture
    进入之后域名是默认填好的,在名称输入www,此时下面的锁定域名会自动加上www,再输入对应的IP地址:192.168.100.100,此时解析自己之后只需要后面在此服务器上建立网站就可以直接使用 192.168.100.100进入 www.yun.com,操作结果如下:
    DHCP + DNS + WEB → Small architecture
    DHCP + DNS + WEB → Small architecture
    此时有此条记录之后我们进入Win10系统中看看能否进行解析:
    在cmd中输入nslookup www.yun.com,如果可以解析得到的结果应该是192.168.100.100
    实验结果如下图所示:
    DHCP + DNS + WEB → Small architecture
    以上DNS主机的搭建实验就成功了。

下面我们进入建立Web虚拟主机
①. 不同IP:一台服务器上有两个网卡
进入server2016系统,因为是多个网卡,现在只有一个网卡,故此时需要添加一个网卡操作如下图所示:
DHCP + DNS + WEB → Small architecture
接下来对新生成的第二个网卡进行配置设置,操作如下:
DHCP + DNS + WEB → Small architecture
此时点击确定会跳出提示框直接点击确定,在进入网卡属性,看IPv4中的IP地址是否成功配置,确定没问题后建议重启虚拟机中的Server2016系统,让新设置的内容生效。重启之后利用管理员身份进入系统,调出cmd,输入指令ipconfig获取IP地址,结果如下:
DHCP + DNS + WEB → Small architecture
两个都出现即为生效,接下来我们就可以操作下一步,搭建网站

  1. 点击开始菜单,选择服务管理器
  2. 点击进入服务管理器仪表板完全加载界面
  3. 点击添加角色和功能
  4. 点击下一步进入服务器角色选择Web服务器,添加IIS管理工具点击添加功能
  5. 点击下一步暂无其它功能需要添加
  6. 点击下一步,点击安装此时安装成功后可以在开始菜单中的Windows管理工具中找到以下选项:
    DHCP + DNS + WEB → Small architecture
    进入此控制台得到如下界面:(默认提供站点)
    DHCP + DNS + WEB → Small architecture
    下面我们进行网站的绑定,操作如下图:
    DHCP + DNS + WEB → Small architecture
    在进行网站的基本设置之前我们可以新建网站路径,下面我们进行操作:
    在Server2016系统中以管理员身份唤出cmd,输入指令:e:此时进入E盘,接着输入mkdir yun bigdata(这是一个快捷的新建文件夹的方式),此时电脑中E盘会出现yun和bigdata两个新的文件夹,创建步骤 和得到结果如下图所示:
    DHCP + DNS + WEB → Small architecture
    DHCP + DNS + WEB → Small architecture
    DHCP + DNS + WEB → Small architecture
    DHCP + DNS + WEB → Small architecture
    使用记事本打开后可以看到里面显示的内容为“this is yun web”
    此时再次调出cmd,输入指令:cd bigdata进入此文件夹,再输入:echo “thisi is bigdata web” >index.html,此时得到结果和上面相同,进入路径将文件选择记事本打开,得到显示内容为“this is bigdata web”,此时两个网站的标记就创建成功了。

此时我们进入IIS管理器,进行网站的基本设置,点击编辑,选择站点路径为E:\yun,这个时候继承成功,操作过程及结果如下:
DHCP + DNS + WEB → Small architecture
DHCP + DNS + WEB → Small architecture
在设置好之后我们进入Win10客户端进入浏览器尝试访问看是否成功,在搜索栏输入地址:192.168.100.100成功的话结果会显示“this is yun web”,结果如下图所示:
DHCP + DNS + WEB → Small architecture
此时我们还有一个bigdata的网站需要新建,下面我们来操作如何新建网站
第一步:进入Server2016系统的IIS管理器,右键点击网站,选中添加网站,
DHCP + DNS + WEB → Small architecture
DHCP + DNS + WEB → Small architecture
设置完成之后进入Win10系统浏览器,搜索栏输入地址192.168.100.110敲回车,可以访问到的界面显示为“this is bigdata web”,此时不同IP的两个网站均实验成功。

②.相同IP,不同端口
此时我们进入server2016系统,进入到IIS管理器,在yun这个网站绑定编辑中我们可以看到在IP地址为192.168.100.100的情况下,端口为80 ,如下图所示:
DHCP + DNS + WEB → Small architecture
在bigdata这个网站绑定编辑中我们需要进行一点修改,相同IP的话将IP地址改为192.168.100.100,不同端口为改为8080 ,如下图所示:
DHCP + DNS + WEB → Small architecture
经过调整之后,我们进入Win10系统,使用浏览器打开192.168.100.100,界面显示为“this is yun web”,而我们在搜索栏输入:192.168.100.100:8080后敲回车,界面显示出的就是“this is bigdata web”
以上操作就是相同IP,不同端口的方式

③相同IP,相同端口,不同主机名
此时我们进入server2016系统,进入到IIS管理器,在yun这个网站绑定编辑中设置主机名为:www.yun.com,操作如下:
DHCP + DNS + WEB → Small architecture
再进入到bigdata这个网站绑定编辑中,相同IP默认不变,相同端口此处改为80,设置主机名为:www.bigdata.com,操作如下:
DHCP + DNS + WEB → Small architecture
但是此时需要注意的是,之前我们在DNS服务器中只设置了www.yun.com 的解析主机,并没有设置bigdata的解析主机,所以此处我们需要在DNS服务器中按照yun.com的新建区域方式同样创建一个www.bigdata.com的解析主机(此处可参照上面yun.com的操作方式),这时区分两个网站的就是主机名不同
这个时候我们进入Win10系统,用浏览器进行验证,在搜索栏输入www.yun.com或者www.bigdata.com此时得到的就会是相对应的“this is yun web”和“this is bigdata web”如下图所示:
DHCP + DNS + WEB → Small architectureDHCP + DNS + WEB → Small architecture
这个时候如果我们在浏览器的地址搜索栏输入IP地址的话就会出现NOT FOUND 404错误
,如下图所示:
DHCP + DNS + WEB → Small architecture

下面我们结合之前的DHCP:
在Win10客户端系统中设置的手动分配的IP地址,现在改为自动分配,操作如下图所示:
DHCP + DNS + WEB → Small architecture
然后按照上一次创建的文章中的过程在服务管理器中点击添加角色和功能后下一步,选中DHCP,后面默认设置点击安装,这个时候服务器上就同时存在DHCP、DNS和WEB。
这时候在开始菜单中的windows管理工具中找到DHCP控制台点击打开,右键点击IPv4选择新建作用域
进入向导,1.点击下一步,作用域名称:yun
2.点击下一步地址范围:起始IP地址192.168.100.50 结束IP地址192。168.100.80点击下一步排除地址:暂不设置
3.点击下一步租约期限默认8天
4.点击下一步DHCP选项,现在开始配置
5.点击下一步网关IP:例192.168.100.1,点击添加
6.点击下一步域名和DNS服务器,IP地址输入192.168.100.100(这个地址是要分配给下面的客户端的,客户端要去应用这个地址),点击添加后自动搜索DNS,因为之前已经搭建过DNS所以会自动添加上,不会跳任何提示
7.点击下一步WINS服务器不用设置
8.点击下一步现在激活,下一步,完成
这个时候yun的作用域就已经创建完成了,我们在进入WIN10系统,运行cmd,输入指令:ipconfig /renew获取IP地址为192.168.100.50,结果如下图:
DHCP + DNS + WEB → Small architecture
再次输入命令:ipconfig /all,看一下DNS地址和DHCP地址都为192.168.100.100,结果如下图所示:
DHCP + DNS + WEB → Small architecture
This time we go back to using WIN10 system browser for authentication, enter the www.yun.com and hit Enter to get www.bigdata.com are correct web interface "this is yun web" and "this is bigdata web "this experiment is successful, reflects the DHCP + DNS + WEB composed of a small architecture.

Guess you like

Origin blog.51cto.com/14464303/2423492