综合类实验项目DHCP+DNS+WEB(通俗易懂型)

2023-10-22 15:40

本文主要是介绍综合类实验项目DHCP+DNS+WEB(通俗易懂型),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

实验项目

拓扑图

 

如图所示,根据需求完成任务:

1.sw2为二层交换机,分别有vlan10,vlan20,vlan100 三个vlan,f1/1-3是接入链路,f1/0为中继链路。

2.sw1为三层交换机,分别为三个vlan提供网关,vlan10:192.168.10.1/24、vlan20:192.168.20.1/24、vlan100:192.168.100.1/24,外网接口为f1/1:12.0.0.1/24

3.局域网内部Linux服务器搭建dhcp服务功能为vlan10,vlan20及vlan100提供地址,地址范围:

    Vlan10:192.168.10.100~192.168.10.200 子网掩码:255.255.255.0 网关192.168.10.1/24

    Vlan20:192.168.20.100~192.168.20.200 子网掩码:255.255.255.0 网关192.168.20.1/24

    Vlan100:192.168.100.100~192.168.100.200 子网掩码:255.255.255.0 网关192.168.100.1/24

    dns服务器地址为:192.168.100.100/24,其中PC1主机固定获得192.168.10.18/24地址

4.局域网内部Linux服务器搭建DNS服务功能解析www.kgc.com和www.yun.com,解析地址为14.0.0.14/24 外网WEB服务器,同时提供泛域名解析功能,解析地址为8.8.8.8

5.在外网有一台server2016搭建的WEB服务器,建立了虚拟机主机提供两个网站,分别是www.kgc.com和www.yun.com,自定义首页内容区分显示

6.实现最终的全网互通,功能访问健全

具体操作:

一、实验前环境部署

1.先打开四台虚拟机,Windows10两台、centos7一台、server2016一台(依自己情况而定,这里只做示范)

2.在centos7上,先处于联网的状态下,先安装两个软件包:DHCP软件包和bind软件包,安装好后把网卡设置为仅主机模式

[root@localhost ~]# yum install dhcp -y            //安装DHCP软件包[root@localhost ~]# yum install bind -y            //安装BIND软件包

3.虚拟机网卡模式设置

win10-1:nio_gen_eth:VMware Network Adapter VMnet1(仅主机)

win10-2:nio_gen_eth:VMware Network Adapter VMnet3(仅主机)

centos7:nio_gen_eth:VMware Network Adapter VMnet3(仅主机)

server2016:nio_gen_eth:VMware Network Adapter VMnet8(仅主机)

4.拓扑图规划,接口以及其他的设置规划都在图中标明

 

二、实验操作部分


1.sw2配置——二层交换

(1)创建VLAN

SW2#conf t                                                       //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
SW2(config)#vlan 10,20,100                                       //创建VLAN
SW2(config-vlan)#ex                                              //退出
SW2(config)#do show vlan-sw b                                    //查看VLANVLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/1, Fa1/2, Fa1/3Fa1/4, Fa1/5, Fa1/6, Fa1/7Fa1/8, Fa1/9, Fa1/10, Fa1/11Fa1/12, Fa1/13, Fa1/14, Fa1/15
10   VLAN0010                         active    
20   VLAN0020                         active    
100  VLAN0100                         active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

2)把对应端口分配到VLAN中

SW2(config)#int f1/1                       //进入端口模式
SW2(config-if)#sw mo acc                   //添加二层定义端口
SW2(config-if)#sw acc vlan 10              //分配到VLAN中
SW2(config-if)#ex                          //退出
SW2(config)#int f1/2      
SW2(config-if)#sw acc vlan 20
SW2(config-if)#ex
SW2(config)#int f1/3
SW2(config-if)#sw mo acc
SW2(config-if)#sw acc vlan 100
SW2(config-if)#ex
SW2(config)#do show vlan-sw b              //查看VLANVLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/4, Fa1/5, Fa1/6Fa1/7, Fa1/8, Fa1/9, Fa1/10Fa1/11, Fa1/12, Fa1/13, Fa1/14Fa1/15
10   VLAN0010                         active    Fa1/1
20   VLAN0020                         active    Fa1/2
100  VLAN0100                         active    Fa1/3
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

 (3)创建中继链路trunk

SW2(config)#int f1/0                          //进入端口
SW2(config-if)#sw mo trunk                    //将接口配置为trunk
SW2(config-if)#sw         
*Mar  1 00:15:21.427: %DTP-5-TRUNKPORTON: Port Fa1/0 has become dot1q trunk
SW2(config-if)#sw trunk en dot1q              //封装类型为dot1q
SW2(config-if)#ex                             //返回到上一层模式
SW2(config)#do show int f1/0 switchport       //查看端口
Name: Fa1/0
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1,10,20,100
Protected: false
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none 
Appliance trust: none
SW2(config)#no ip routing

2.sw1配置——三层交换

(1)创建VLAN

SW1#conf t                                                      //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#vlan 10,20,100                                      //创建VLAN
SW1(config-vlan)#                                               
*Mar  1 00:13:07.259: %SYS-3-CPUHOG: Task is running for (2044)msecs, more than (2000)msecs (2/2),process = Exec.
-Traceback= 0x60024CDC 0x60024EF4 0x6001B72C 0x6001C90C 0x627F73B4 0x60A7FEA4 0x60A80150 0x60B9DC48 0x60B9E984 
SW1(config-vlan)#ex                                              //退回上一层模式
SW1(config)#do show vlan-sw b                                    //查看VLANVLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/1, Fa1/2, Fa1/3Fa1/4, Fa1/5, Fa1/6, Fa1/7Fa1/8, Fa1/9, Fa1/10, Fa1/11Fa1/12, Fa1/13, Fa1/14, Fa1/15
10   VLAN0010                         active    
20   VLAN0020                         active    
100  VLAN0100                         active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

(2)创建中继链路trunk

SW1(config)#int f1/0                                 //进入端口
SW1(config-if)#sw mo trunk                           //将端口设置为trunk
SW1(config-if)#sw                  
*Mar  1 00:15:42.675: %DTP-5-TRUNKPORTON: Port Fa1/0 has become dot1q trunk
SW1(config-if)#sw trunk en dot1q                     //封装类型为dot1q
SW1(config-if)#ex                                    //返回上一层模式 
SW1(config)#do show int f1/0 switchport              //查看端口
Name: Fa1/0
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1,10,20,100
Protected: false
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none 
Appliance trust: none

(3)给相应VLAN配IP地址,以及指向服务器IP地址

SW1(config)# int vlan 10                          //进入VLAN
SW1(config-if)#ip ad
*Mar  1 00:54:48.295: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
SW1(config-if)#ip add 192.168.10.1 255.255.255.0                //给VLAN配IP地址
SW1(config-if)#ip helper-address 192.168.100.100                //指向服务器IP
SW1(config-if)#no shut                                          //开启
SW1(config-if)#ex                                               //返回上一层模式
SW1(config)#int vlan 20
SW1(config-if)#int vlan 20
*Mar  1 00:59:41.599: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
SW1(config-if)#ip add 192.168.20.1 255.255.255.0
SW1(config-if)#ip helper-address 192.168.100.100
SW1(config-if)#no shut
SW1(config-if)#ex
SW1(config)#int vlan 100                     
SW1(config-if)#ex          
*Mar  1 01:00:30.627: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan100, changed state to up
SW1(config-if)#ip add 192.168.100.1 255.255.255.0
SW1(config-if)#ip helper-address 192.168.100.100 
SW1(config-if)#no shut
SW1(config-if)#do show ip int b                   //查看IP地址表
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down    
FastEthernet0/1            unassigned      YES unset  administratively down down    
FastEthernet1/0            unassigned      YES unset  up                    up      
FastEthernet1/1            unassigned      YES unset  up                    up      
FastEthernet1/2            unassigned      YES unset  up                    down    
FastEthernet1/3            unassigned      YES unset  up                    down    
FastEthernet1/4            unassigned      YES unset  up                    down    
FastEthernet1/5            unassigned      YES unset  up                    down    
FastEthernet1/6            unassigned      YES unset  up                    down    
FastEthernet1/7            unassigned      YES unset  up                    down    
FastEthernet1/8            unassigned      YES unset  up                    down    
FastEthernet1/9            unassigned      YES unset  up                    down    
FastEthernet1/10           unassigned      YES unset  up                    down    
FastEthernet1/11           unassigned      YES unset  up                    down    
FastEthernet1/12           unassigned      YES unset  up                    down    
FastEthernet1/13           unassigned      YES unset  up                    down    
FastEthernet1/14           unassigned      YES unset  up                    down    
FastEthernet1/15           unassigned      YES unset  up                    down    
Vlan1                      unassigned      YES unset  up                    up      
Vlan10                     192.168.10.1    YES manual up                    up      
Vlan20                     192.168.20.1    YES manual up                    up      
Vlan100                    192.168.100.1   YES manual up                    up      

(4).配置外网接口:IP地址、双工、速率

SW1(config)#int f1/1                          //进入端口模式
SW1(config-if)#no switchport                  //把二层接口改为三层接口
SW1(config-if)#ip add 
*Mar  1 01:27:56.191: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
SW1(config-if)#ip add 12.0.0.1 255.255.255.0          //配置IP地址
SW1(config-if)#no shut                                //开启
SW1(config-if)#speed 100                              //配置速率
SW1(config-if)#duplex full                            //配置双工
SW1(config-if)#
*Mar  1 01:30:29.699: %LINK-3-UPDOWN: Interface FastEthernet1/1, changed state to up
SW1(config-if)#ex  
SW1(config)#do show ip route                          //查看路由表
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static routeGateway of last resort is not setC    192.168.10.0/24 is directly connected, Vlan10
C    192.168.20.0/24 is directly connected, Vlan2012.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet1/1
C    192.168.100.0/24 is directly connected, Vlan100

3.R2配置——路由器

(1)给对应端口配IP地址

R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#ip add 12.0.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#ex
R2(config)#i
*Mar  1 00:58:26.763: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:58:27.763: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config)#int f0/1
R2(config-if)#ip add 14.0.0.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#ex
R2(config)#
*Mar  1 00:59:03.003: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:59:04.003: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

(2)配静态路由

R2(config)#ip route 192.168.0.0 255.255.0.0 12.0.0.1         //配静态路由

4.在sw1上配默认路由

SW1(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2            //配默认路由

5.给centos7配置静态IP地址并重启网卡

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33       //进入网卡配置文件改为静态IPTYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static                  //改为static静态
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=3a6a3a2d-9930-4cd7-87af-6948d424ee0a
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.100.100          //添加IP
NETMASK=255.255.255.0           //添加子网掩码
GATEWAY=192.168.100.1           //添加网关:wq                             //保存退出
[root@localhost ~]# service network restart          //重启网卡
Restarting network (via systemctl):                        [  确定  ]

6.在centos7中配置DHCP服务

(1)复制模板到配置文件

[root@localhost ~]# cat /etc/dhcp/dhcpd.conf     //查看配置文件
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example          //模板
#   see dhcpd.conf(5) man page
# 
[root@localhost ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf 
cp:是否覆盖"/etc/dhcp/dhcpd.conf"? yes
//把模板复制到配置文件中,直接覆盖

(2)修改DHCP配置文件

[root@localhost ~]# vim /etc/dhcp/dhcpd.conf        //进入配置文件修改配置文件1 # dhcpd.conf2 #3 # Sample configuration file for ISC dhcpd4 #5 6 # option definitions common to all supported networks...7 option domain-name "example.org";8 option domain-name-servers 192.168.100.100;        //指向DNS地址9 10 default-lease-time 600;11 max-lease-time 7200;12 13 # Use this to enble / disable dynamic dns updates globally.14 #ddns-update-style none;15 16 # If this DHCP server is the official DHCP server for the local17 # network, the authoritative directive should be uncommented.18 #authoritative;19 20 # Use this to send dhcp log messages to a different log file (you also21 # have to hack syslog.conf to complete the redirection).22 log-facility local7;23 24 # No service will be given on this subnet, but declaring it helps the 25 # DHCP server to understand the network topology.26 27 subnet 192.168.10.0 netmask 255.255.255.0 {               //子网掩码28         range 192.168.10.100 192.168.10.200;              //网段29         option routers 192.168.10.1;                      //网关30 }                                              //vlan1031 32 subnet 192.168.20.0 netmask 255.255.255.0 {33         range 192.168.20.100 192.168.20.200;34         option routers 192.168.20.1;35 }                                              //vlan2036 37 subnet 192.168.100.0 netmask 255.255.255.0 {38         range 192.168.100.100 192.168.100.200;39         option routers 192.168.100.1;40 }                                              //vlan10041 42 # This is a very basic subnet declaration.43 44 subnet 10.254.239.0 netmask 255.255.255.224 {45   range 10.254.239.10 10.254.239.20;46   option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;47 }48 49 # This declaration allows BOOTP clients to get dynamic addresses,50 # which we don't really recommend.51 52 subnet 10.254.239.32 netmask 255.255.255.224 {53   range dynamic-bootp 10.254.239.40 10.254.239.60;54   option broadcast-address 10.254.239.31;55   option routers rtr-239-32-1.example.org;56 }57 58 # A slightly different configuration for an internal subnet.59 subnet 10.5.5.0 netmask 255.255.255.224 {60   range 10.5.5.26 10.5.5.30;61   option domain-name-servers ns1.internal.example.org;62   option domain-name "internal.example.org";63   option routers 10.5.5.1;64   option broadcast-address 10.5.5.31;65   default-lease-time 600;66   max-lease-time 7200;67 }68 69 # Hosts which require special configuration options can be listed in70 # host statements.   If no address is specified, the address will be71 # allocated dynamically (if possible), but the host-specific information72 # will still come from the host declaration.73 74 host passacaglia {75   hardware ethernet 0:0:c0:5d:bd:95;76   filename "vmunix.passacaglia";77   server-name "toccata.fugue.com";78 }79 80 # Fixed IP addresses can also be specified for hosts.   These addresses81 # should not also be listed as being available for dynamic assignment.82 # Hosts for which fixed IP addresses have been specified can boot using83 # BOOTP or DHCP.   Hosts for which no fixed address is specified can only84 # be booted with DHCP, unless there is an address range on the subnet85 # to which a BOOTP client is connected which has the dynamic-bootp flag85 # to which a BOOTP client is connected which has the dynamic-bootp flag86 # set.87 host fantasia {88   hardware ethernet 00:0C:29:C1:94:47;         //指定分配的客户端MAC地址89   fixed-address 192.168.10.18;                 //要指定分配的IP号90 }91 92 # You can declare a class of clients and then do address allocation93 # based on that.   The example below shows a case where all clients94 # in a certain class get addresses on the 10.17.224/24 subnet, and all95 # other clients get addresses on the 10.0.29/24 subnet.96 97 class "foo" {98   match if substring (option vendor-class-identifier, 0, 4) = "SUNW";99 }
100 
101 shared-network 224-29 {
102   subnet 10.17.224.0 netmask 255.255.255.0 {
103     option routers rtr-224.example.org;
104   }
105   subnet 10.0.29.0 netmask 255.255.255.0 {
106     option routers rtr-29.example.org;
107   }
108   pool {
109     allow members of "foo";
110     range 10.17.224.10 10.17.224.250;
111   }
112   pool {
113     deny members of "foo";
114     range 10.0.29.10 10.0.29.230;
115   }
116 }
:wq                                           //保存退出                                                                                                            

(3)启动DHCP服务

[root@localhost ~]# systemctl start dhcpd

7.去客户机验证有没有获取到IP地址

(1)win10-1获取的是10段的IP


C:\Users\Administrator>ipconfig             //查看IP地址Windows IP 配置以太网适配器 Ethernet0:连接特定的 DNS 后缀 . . . . . . . : example.org本地链接 IPv6 地址. . . . . . . . : fe80::e458:db82:a79a:c37a%2IPv4 地址 . . . . . . . . . . . . : 192.168.10.18             //分配到10网段地址子网掩码  . . . . . . . . . . . . : 255.255.255.0默认网关. . . . . . . . . . . . . : 192.168.10.1以太网适配器 蓝牙网络连接:媒体状态  . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . :隧道适配器 isatap.example.org:媒体状态  . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . : example.org隧道适配器 Teredo Tunneling Pseudo-Interface:媒体状态  . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . :

(2)win10-2获取的是20段的IP


C:\Users\shan>ipconfigWindows IP 配置以太网适配器 Ethernet0:连接特定的 DNS 后缀 . . . . . . . : example.org本地链接 IPv6 地址. . . . . . . . : fe80::a13b:5d21:9045:4272%6IPv4 地址 . . . . . . . . . . . . : 192.168.20.100             //分配到20网段地址子网掩码  . . . . . . . . . . . . : 255.255.255.0默认网关. . . . . . . . . . . . . : 192.168.20.1以太网适配器 蓝牙网络连接:媒体状态  . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . :隧道适配器 isatap.example.org:媒体状态  . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . : example.org隧道适配器 Teredo Tunneling Pseudo-Interface:媒体状态  . . . . . . . . . . . . : 媒体已断开连接连接特定的 DNS 后缀 . . . . . . . :

8.在centos7中配置DNS服务

(1)修改主配置文件

[root@localhost ~]# vim /etc/named.conf          //进入主配置文件修改配置文件//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// See the BIND Administrator's Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.htmloptions {listen-on port 53 { any; };                 //监听地址为任意地址listen-on-v6 port 53 { ::1; };directory       "/var/named";dump-file       "/var/named/data/cache_dump.db";statistics-file "/var/named/data/named_stats.txt";memstatistics-file "/var/named/data/named_mem_stats.txt";recursing-file  "/var/named/data/named.recursing";secroots-file   "/var/named/data/named.secroots";allow-query     { any; };                  //允许使用本DNS服务器的网段为任意网段/* - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.- If you are building a RECURSIVE (caching) DNS server, you need to enable recursion. - If your recursive DNS server has a public IP address, you MUST enable access control to limit queries to your legitimate users. Failing to do so willcause your server to become part of large scale DNS amplification attacks. Implementing BCP38 within your network would greatlyreduce such attack surface */recursion yes;:wq                                  //保存退出

(2)修改区域配置文件


[root@localhost ~]# vim /etc/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
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//zone "localhost.localdomain" IN {type master;file "named.localhost";allow-update { none; };
};zone "localhost" IN {type master;file "named.localhost";allow-update { none; };
};zone "kgc.com" IN {                         //正向“kgc.com”区域type master;                        //类型为主区域file "kgc.com.zone";                //区域数据文件为kgc.com.zoneallow-update { none; };             //允许下载的从服务器地址
};zone "yun.com" IN {type master;file "yun.com.zone";allow-update { none; };
:wq

(3)修改区域数据配置文件

[root@localhost ~]# cd /var/named                 
[root@localhost named]# ls
data  dynamic  named.ca  named.empty  named.localhost  named.loopback  slaves
[root@localhost named]# cp -p named.localhost kgc.com.zone     //复制区域数据文件到kgc.com.zone目录中

[root@localhost named]# vim kgc.com.zone            //进入区域数据配置文件修改配置文件$TTL 1D
@       IN SOA  @ rname.invalid. (0       ; serial1D      ; refresh1H      ; retry1W      ; expire3H )    ; minimumNS      @A       127.0.0.1
www IN  A       14.0.0.14            //表示域名www.kgc.com对应的IP地址是14.0.0.14
*   IN  A       8.8.8.8              //泛域名解析
:wq                                  //保存退出
[root@localhost named]# cp -p kgc.com.zone yun.com.zone          //复制一份到yun.com.znoe目录中,记得加-p

(4)启动DNS服务

[root@localhost named]# systemctl stop firewalld.service             //关闭防火墙
[root@localhost named]# setenforce 0                                 //关闭增强型安全功能
[root@localhost named]# systemctl start named                        //启动DNS服务

9.验证DNS服务

(1)客户机win10-1验证


C:\Users\Administrator>nslookup www.kgc.com
服务器:  UnKnown
Address:  192.168.100.100DNS request timed out.timeout was 2 seconds.
DNS request timed out.timeout was 2 seconds.
名称:    www.kgc.com
Address:  14.0.0.14C:\Users\Administrator>nslookup www.yun.com
服务器:  UnKnown
Address:  192.168.100.100DNS request timed out.timeout was 2 seconds.
DNS request timed out.timeout was 2 seconds.
名称:    www.yun.com
Address:  14.0.0.14C:\Users\Administrator>nslookup abc.yun.com
服务器:  UnKnown
Address:  192.168.100.100DNS request timed out.timeout was 2 seconds.
DNS request timed out.timeout was 2 seconds.
名称:    abc.yun.com
Address:  8.8.8.8

(2)客户机win10-2验证

C:\Users\shan>nslookup www.kgc.com
服务器:  UnKnown
Address:  192.168.100.100DNS request timed out.timeout was 2 seconds.
DNS request timed out.timeout was 2 seconds.
名称:    www.kgc.com
Address:  14.0.0.14C:\Users\shan>nslookup www.yun.com
服务器:  UnKnown
Address:  192.168.100.100DNS request timed out.timeout was 2 seconds.
DNS request timed out.timeout was 2 seconds.
名称:    www.yun.com
Address:  14.0.0.14C:\Users\shan>nslookup abc.yun.com
服务器:  UnKnown
Address:  192.168.100.100DNS request timed out.timeout was 2 seconds.
DNS request timed out.timeout was 2 seconds.
名称:    abc.yun.com
Address:  8.8.8.8

10.在server2016搭建WEB网站

(1)打开网卡设置一个固定IP地址

(2)安装WEB服务,添加网站

网站www.kgc.com创建

网站www.yun.com创建

(3)编辑网站内容

(4)关掉防火墙

11.在客户机上进行验证

(1)验证是否互通

在win10-1验证

在win10-2验证

(2)网站验证

结果:实现了全网互通

 

 

 

 

这篇关于综合类实验项目DHCP+DNS+WEB(通俗易懂型)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/262337

相关文章

Node.js 数据库 CRUD 项目示例详解(完美解决方案)

《Node.js数据库CRUD项目示例详解(完美解决方案)》:本文主要介绍Node.js数据库CRUD项目示例详解(完美解决方案),本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考... 目录项目结构1. 初始化项目2. 配置数据库连接 (config/db.js)3. 创建模型 (models/

springboot项目中常用的工具类和api详解

《springboot项目中常用的工具类和api详解》在SpringBoot项目中,开发者通常会依赖一些工具类和API来简化开发、提高效率,以下是一些常用的工具类及其典型应用场景,涵盖Spring原生... 目录1. Spring Framework 自带工具类(1) StringUtils(2) Coll

Spring Boot项目部署命令java -jar的各种参数及作用详解

《SpringBoot项目部署命令java-jar的各种参数及作用详解》:本文主要介绍SpringBoot项目部署命令java-jar的各种参数及作用的相关资料,包括设置内存大小、垃圾回收... 目录前言一、基础命令结构二、常见的 Java 命令参数1. 设置内存大小2. 配置垃圾回收器3. 配置线程栈大小

Spring Boot项目中结合MyBatis实现MySQL的自动主从切换功能

《SpringBoot项目中结合MyBatis实现MySQL的自动主从切换功能》:本文主要介绍SpringBoot项目中结合MyBatis实现MySQL的自动主从切换功能,本文分步骤给大家介绍的... 目录原理解析1. mysql主从复制(Master-Slave Replication)2. 读写分离3.

JSON Web Token在登陆中的使用过程

《JSONWebToken在登陆中的使用过程》:本文主要介绍JSONWebToken在登陆中的使用过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录JWT 介绍微服务架构中的 JWT 使用结合微服务网关的 JWT 验证1. 用户登录,生成 JWT2. 自定义过滤

一文教你如何将maven项目转成web项目

《一文教你如何将maven项目转成web项目》在软件开发过程中,有时我们需要将一个普通的Maven项目转换为Web项目,以便能够部署到Web容器中运行,本文将详细介绍如何通过简单的步骤完成这一转换过程... 目录准备工作步骤一:修改​​pom.XML​​1.1 添加​​packaging​​标签1.2 添加

tomcat多实例部署的项目实践

《tomcat多实例部署的项目实践》Tomcat多实例是指在一台设备上运行多个Tomcat服务,这些Tomcat相互独立,本文主要介绍了tomcat多实例部署的项目实践,具有一定的参考价值,感兴趣的可... 目录1.创建项目目录,测试文China编程件2js.创建实例的安装目录3.准备实例的配置文件4.编辑实例的

springboot集成Deepseek4j的项目实践

《springboot集成Deepseek4j的项目实践》本文主要介绍了springboot集成Deepseek4j的项目实践,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价... 目录Deepseek4j快速开始Maven 依js赖基础配置基础使用示例1. 流式返回示例2. 进阶

CentOS 7部署主域名服务器 DNS的方法

《CentOS7部署主域名服务器DNS的方法》文章详细介绍了在CentOS7上部署主域名服务器DNS的步骤,包括安装BIND服务、配置DNS服务、添加域名区域、创建区域文件、配置反向解析、检查配置... 目录1. 安装 BIND 服务和工具2.  配置 BIND 服务3 . 添加你的域名区域配置4.创建区域

Linux系统之dns域名解析全过程

《Linux系统之dns域名解析全过程》:本文主要介绍Linux系统之dns域名解析全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、dns域名解析介绍1、DNS核心概念1.1 区域 zone1.2 记录 record二、DNS服务的配置1、正向解析的配置