综合类实验项目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

相关文章

这15个Vue指令,让你的项目开发爽到爆

1. V-Hotkey 仓库地址: github.com/Dafrok/v-ho… Demo: 戳这里 https://dafrok.github.io/v-hotkey 安装: npm install --save v-hotkey 这个指令可以给组件绑定一个或多个快捷键。你想要通过按下 Escape 键后隐藏某个组件,按住 Control 和回车键再显示它吗?小菜一碟: <template

如何用Docker运行Django项目

本章教程,介绍如何用Docker创建一个Django,并运行能够访问。 一、拉取镜像 这里我们使用python3.11版本的docker镜像 docker pull python:3.11 二、运行容器 这里我们将容器内部的8080端口,映射到宿主机的80端口上。 docker run -itd --name python311 -p

在cscode中通过maven创建java项目

在cscode中创建java项目 可以通过博客完成maven的导入 建立maven项目 使用快捷键 Ctrl + Shift + P 建立一个 Maven 项目 1 Ctrl + Shift + P 打开输入框2 输入 "> java create"3 选择 maven4 选择 No Archetype5 输入 域名6 输入项目名称7 建立一个文件目录存放项目,文件名一般为项目名8 确定

Java Web指的是什么

Java Web指的是使用Java技术进行Web开发的一种方式。Java在Web开发领域有着广泛的应用,主要通过Java EE(Enterprise Edition)平台来实现。  主要特点和技术包括: 1. Servlets和JSP:     Servlets 是Java编写的服务器端程序,用于处理客户端请求和生成动态网页内容。     JSP(JavaServer Pages)

BUUCTF靶场[web][极客大挑战 2019]Http、[HCTF 2018]admin

目录   [web][极客大挑战 2019]Http 考点:Referer协议、UA协议、X-Forwarded-For协议 [web][HCTF 2018]admin 考点:弱密码字典爆破 四种方法:   [web][极客大挑战 2019]Http 考点:Referer协议、UA协议、X-Forwarded-For协议 访问环境 老规矩,我们先查看源代码

Vue3项目开发——新闻发布管理系统(六)

文章目录 八、首页设计开发1、页面设计2、登录访问拦截实现3、用户基本信息显示①封装用户基本信息获取接口②用户基本信息存储③用户基本信息调用④用户基本信息动态渲染 4、退出功能实现①注册点击事件②添加退出功能③数据清理 5、代码下载 八、首页设计开发 登录成功后,系统就进入了首页。接下来,也就进行首页的开发了。 1、页面设计 系统页面主要分为三部分,左侧为系统的菜单栏,右侧

SpringBoot项目是如何启动

启动步骤 概念 运行main方法,初始化SpringApplication 从spring.factories读取listener ApplicationContentInitializer运行run方法读取环境变量,配置信息创建SpringApplication上下文预初始化上下文,将启动类作为配置类进行读取调用 refresh 加载 IOC容器,加载所有的自动配置类,创建容器在这个过程

EasyPlayer.js网页H5 Web js播放器能力合集

最近遇到一个需求,要求做一款播放器,发现能力上跟EasyPlayer.js基本一致,满足要求: 需求 功性能 分类 需求描述 功能 预览 分屏模式 单分屏(单屏/全屏) 多分屏(2*2) 多分屏(3*3) 多分屏(4*4) 播放控制 播放(单个或全部) 暂停(暂停时展示最后一帧画面) 停止(单个或全部) 声音控制(开关/音量调节) 主辅码流切换 辅助功能 屏

Maven创建项目中的groupId, artifactId, 和 version的意思

文章目录 groupIdartifactIdversionname groupId 定义:groupId 是 Maven 项目坐标的第一个部分,它通常表示项目的组织或公司的域名反转写法。例如,如果你为公司 example.com 开发软件,groupId 可能是 com.example。作用:groupId 被用来组织和分组相关的 Maven artifacts,这样可以避免

2. 下载rknn-toolkit2项目

官网链接: https://github.com/airockchip/rknn-toolkit2 安装好git:[[1. Git的安装]] 下载项目: git clone https://github.com/airockchip/rknn-toolkit2.git 或者直接去github下载压缩文件,解压即可。