6

这次我会结合我前面所发的搭建DHCP服务,dns服务和HTTP服务,中核做一个实验有什么不...

 2 years ago
source link: https://blog.51cto.com/u_15070926/5241180
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

这次我会结合我前面所发的搭建DHCP服务,dns服务和HTTP服务,中核做一个实验有什么不懂得,可以评论区交流一下,也可以私信我,葱鸭!

原创

奋斗的涛_加油 2022-04-22 09:06:20 ©著作权

文章标签 服务器搭建 DHCP dns HTTP 文章分类 Linux 系统/运维 阅读数1554

注:挂载镜像和修改网卡,还有关闭防火墙、关闭安全Linux

1.前期准备需要准备两台服务器一台PC机。

两台服务都使用本地yum,而且两台服务器是在同一网段(VM1---十网段)

dns,http服务器(192.168.10.9)

[root@localhost cat /etc/sysconfig/network-scripts/ifcfg-ens33  TYPE=Ethernet  PROXY METHOD=none  BROWSER ONLY=no  BOOTPROTO=static  DEFROUTE=yes  IPV4 FAILURE FATAL=no  IPV61NIT=yes  IPV6 FAILURE FATAL=no  IPV6  NAME=ens33  UUID=b234252f - e0f6-4ec5-956d- IOdf1da2d94b  DEVICE=ens33  ONBOOT=yes  IPADDR=192.168.10.9  NETMASK=255.255.255. O  GETMASY-192.168.10.1

dhcp服务器(192.168.10.8)

[ root@localhost cat /etc/sysconfig/network-scripts/ifcfg-ens33  TYPE=Ethe rnet  PROXY METHOD=none  BROWSER ONLY=no  BOOTPROTO=static  DEFROUTE=yes  IPV4 FAILURE FATAL=no  IPV61NIT=yes  IPV6 AUTOCONF=yes  IPV6 DEFROUTE=yes  IPV6 FAILURE FATAL=no  NAME=ens33  UUID=3f266bbb- ad27 -46d1-8111- e048f784d050  DEVICE=ens33  ONBOOT=yes  IPADDR=192.168.10.8  NETMAST=255.255.255. O  GATEWAY-192. 168 . 10 . 1

dns,http服务器搭建本地yum

[root@localhost cat /etc/yum. repos .d/123. repo  [123]  name=123  baseu rl=file : // /mnt  enable—I  gpgcheck=0  [root@localhost

dhcp服务器搭建本地yum

[root@localhost cat /etc/yum. repos .d/123. repo  [123]  name=123  /mnt  enable—I  gpgcheck=O  [root@localhost —

2.搭建dhcp服务器

yum
install dhcp*-y

[root@localhost yum. repos yum install dhcp*-y  fastestmirror, langpacks  123  (1/2): 123/group_gz  (2/2): 123/primary_db  Determining fastest mirrors  dhcp*-y  [root@localhost yum. repos AC  [root@localhost yum. repos yum install dhcp* -y  fastestmirror, langpacks  Loading mirror speeds from cached host file  12:dhcp-common-4.2.5-58.e17. centos .x86_64

创建dhcp池

subnet
192.168.10.0 netmask 255.255.255.0 {

  range 192.168.10.150 192.168.10.200;

  option domain-name-servers 192.168.10.9;

  option domain-name "​ ​www.bdqn.com​​";

  option routers 192.168.10.8;

  option broadcast-address 192.168.10.255;

  default-lease-time 600;

  max-lease-time 7200;

[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  subnet 192.168.10.0 netmask 255.255.255.0 {  range 192 .168.10.150 192 .168.10.200;  option domain-name-servers 192 .168.10.9;  option domain-name

开启dhcp

systemctl
restart dhcpd

[ root@localhost systemctl restart dhcpd  [root@localhost

3.搭建dns,http服务器

搭建dns服务器

使用yum安装bind

yum   install  
bind*   -y

编辑dns,正向解析、反向解析

vim
/etc/named.conf

[ root@localhost  named. conf  vim /etc/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 html  options {  Listen -on port 53 { any;  listen-on-v6 port 53 {  di rectory

zone

zone  zone  zone  zone

zone

创建正向解析文件

这次我会结合我前面所发的搭建DHCP服务,dns服务和HTTP服务,中核做一个实验有什么不懂得,可以评论区交流一下,也可以私信我,葱鸭!_服务器搭建

编辑正向解释文件

[ root@localhost vim bdqn . com.zone  [ root@tocalhost cat bdqn . com.zone

$TTL ID  @ rname. invalid.  192 . 168  ID  3H  se rial  refresh  ret ry  expi re  nunxmum  ftp  IN SOA  NS  IN A  IN A  192 . 168. 10.9  192 . 168. 10.9  .10.9

创建反向解析文件

这次我会结合我前面所发的搭建DHCP服务,dns服务和HTTP服务,中核做一个实验有什么不懂得,可以评论区交流一下,也可以私信我,葱鸭!_HTTP_02

编辑反向解析文件

这次我会结合我前面所发的搭建DHCP服务,dns服务和HTTP服务,中核做一个实验有什么不懂得,可以评论区交流一下,也可以私信我,葱鸭!_服务器搭建_03

$TTL ID  @ rname. invalid.  192. 168. 10.9  bdqn . com.  ID  IH  serial  ref resh  ret ry  expi re  minimum  9  IN SOA  NS  IN PTR

编写vim /etc/resolv.conf

[ root@localhost  zamese rver  vim /etc/ resolv.conf

[ root@tocalhost named]# systemctl restart named  [ root@localhost named]#

查看named开启状态

 netstat -anpu | grep name //UDP 53端口在监听

L roo @Locaunost  P roto  u dp  udp  udp  udp6  Recv-Q Send-Q  o  o  o  o  o  o  netstat  - an pu  Local Address  192. 168 . 122. 1:53  192. 168.10.9:53  127.0.0.1:53  name  Fo reign  Address  State  PID/Program name  3105/ named  3105/named  3105/named  3105/named  [ root@localhost
[ root@localhost  nslookup 192.168.10.9  Server:  192. 168. 10.9  Address :  192. 168.10.9#53  9. 10. 168. 192 . In  [ root@localhost  Server:  Address :  w

搭建http服务器

yum
install http* -y

[ root@localhost yum install http* -y  fastestmirror, langpacks  Loading mirror speeds from cached hostfile  http-parser-2.7.1-1.e17.x86_64  httpcomponents-cIient.noarch.O.4.2.5-5.e17_O  --> mvn (commons-logging: commons-togging),  -> mvn (commons-codec :commons-codec),  --> httpcomponents-core.noarch.O.4.2.4-6.e17  --> httpd.x86_64.0.2.4.6-67.e17.centos  --> /etc/mime . types, httpd-2.4.6-67.el  --> libaprutiI-1.so.0() (64bit), httpd-  --> libapr-1.so.O()(64bit), httpd-2.4.  ---> httpd-devel.x86_64.O.2.4.6-67.e17.centos  --> apr-util-devel, httpd-deveI-2.4.6-  apr-devel, httpd-deveI-2.4.6-67.el  --> httpd-manual.noarch.0.2.4.6-67.e17.centos  --> httpd-t001s.x86_64.O.2.4.6-67.e17.centos

编辑httpd.conf

vim
/etc/httpd/conf/httpd.conf

# ServerAdmin: Your address, where problems with the server should be  # e -mailed. This address appears on some server-generated pages, such  # as error documents.  e.g. admin@you r-domain.com  Se rve rAdmin root@localhost  gives the name and port that the server uses to identify itself.  # This can often be determined automatically, but we recommend you specify  # it explicitly to prevent problems during startup.  # If your host doesn't have a registered DNS name, enter its IP address here.  bdqn .  Serve rName  # Deny access to the entirety of your server's filesystem. You must  # explicitly permit access to web content directories in other  # <Directorp blocks below.  <Directory  AllowOverride none  Require all  denied  </Di rec to  # Note that from this point forward you must specifically allow  # particular features to be enabled -  so if something's not working as  # you might expect, make sure that you have specifically enabled it

查看http

curl
192.168.10.9

[root@localhost -]# curl 192.168.10.9  html PUBLIC - Bootstrap - Helvetica, 55, 1); sans-serif; " title="[root@localhost -]# curl 192.168.10.9 html PUBLIC "-//W3C//DTD XHTML 1. I//EN" " http : / /www.w3.org/TR/xhtm111/DTD/xhtm111.dtd"> - Bootstrap - Helvetica, 55, 1); sans-serif; " />

使用dhcp服务器是否可以查看http和dns

查看dns需要编写vim /etc/resolv.conf

[ root@localhost  zamese rver  vim /etc/ resolv.conf

[ root@localhost  Se rver:  Add ress :  nslookup www.bdqn.com  192. 168. 10.9  192. 168. 10. 9#53  www. bdqn . com  Name :  Address: 192.168.10.9  [ root@localhost  Address :  9. 10. 168. 192. In  [ root@localhost  nslookup 192.168.10.9  192. 168. 10.9  192. 168. 10. 9#53  • -addr. arpa  name =  v•ww.bdqn.com.

查看http

[root@localhost — curl 192 .168.10.9  html PUBLIC

使用pc(开启一台win10进行验证)注:需要改网卡,如果dhcp获取不是自己写的东西,可能是获取到本机dhcp可以在任务管理器里面关闭vmdhcp

: 'all  indows IP  DNs .  DNS  Etherneto:  DNS .  DHCP .  IPv6 .  DHCPv6 .  DHCPv6E öLfiD'  DNS  TCPIP_E NetBIOS .  $iDks• : .  DHCP  . : DESKTOP-Q5R23Eh  bdqn. com  : (R) Gigabit Network Connection  oo-oc-2g-36-Bo-14  : fe80: :920f  . . 192. 168. 10.  . : 255. 255. 255. o  . 192. 168. 10.8  . : 192. 168. 10.8  . : 100666409  . : 00-01-00-01-28-5B-2g-26-oo-oc-2g-36-Bo-14  . 192. 168. 10. g  : Bluetooth Device (Personal Area Network)  . : B4-OE-DE-1S-87-AD

使用网站先输入IP地址

Testing 123..  This page is used to test the proper operation of the Apache HTTP server  after it has been installed. If you can read this page it means that this site  is working properly. This server is powered by CentOS.  Just visiting?  The website you just visited is either  experiencing problems or is undergoing routine  maintenance.  If you would like to let the administrators of this website know  that you've seen this page instead of the page you expected,  you should send them e-mail, In general, mail sent to the name

输入www.bdqn.com

Testing 123..  This page is used to test the proper operation of the Apache HTTP server  after it has been installed. If you can read this page it means that this site  is working properly. This server is powered by CentOS.  Just visiting?  The website you just visited is either  experiencing problems or is undergoing routine  maintenance.  If you would like to let the administrators of this website know  that you've seen this page instead of the page you expected,  you should send them e-mail, In general, mail sent to the name
  • 打赏
  • 3
  • 2收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK