DHCP和DNS的配置实验

实验需求

所有的防火墙全部关闭
分配对应的ip地址
dhcp的服务端因为不要给别人分配ip所以需要自己手动配置
在这里插入图片描述

实验

[root@localhost ~]# yum install -y httpd          #下载httpd服务
[root@localhost ~]# systemctl start httpd.service        
[root@localhost ~]# netstat -antp | grep httpd
tcp6       0      0 :::80                   :::*        LISTEN     20809/httpd 
[root@localhost html]# systemctl start httpd
[root@localhost html]# netstat -antp | grep httpd
tcp6       0      0 :::80                   :::*                    LISTEN      78410/httpd  
[root@localhost html]# vim /var/www/html/index.html    #网页内容

在这里插入图片描述

[root@localhost ~]# yum install -y dhcp       #下载dhcp服务
[root@localhost ~]# cp -p /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp:是否覆盖"/etc/dhcp/dhcpd.conf" y
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf

在这里插入图片描述
开启服务

[root@localhost ~]# systemctl restart network
[root@localhost ~]# systemctl start dhcpd

配置DNS

[root@localhost ~]# yum install -y bind
[root@localhost ~]# vim /etc/named.conf     #设置dns主配置文件

在这里插入图片描述

[root@localhost ~]# vim /etc/named.rfc1912.zones     #添加域名

在这里插入图片描述

[root@localhost ~]# cd /var/named
[root@localhost named]# cp -p named.localhost test.come.zone          #复制模板到配置文件  
[root@localhost named]# vim test.com.zone

在这里插入图片描述
在这里插入图片描述

[SW1]dis cu
sysname SW1
undo info-center enable
vlan batch 10 20 100
interface Ethernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 20
#
interface Ethernet0/0/3
 port link-type access
 port default vlan 10
#
interface Ethernet0/0/4
 port link-type access
 port default vlan 100
SW:

[SW2]dis cu
#
sysname SW
#
undo info-center enable
#
vlan batch 10 20 100
#
cluster enable
ntdp enable
ndp enable
#
dhcp enable
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
interface Vlanif10
 ip address 192.168.40.1 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 192.168.43.100
#
interface Vlanif20
 ip address 192.168.20.1 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 192.168.43.100
#
interface Vlanif100
 ip address 192.168.43.2 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 192.168.43.100
PC>ipconfig /renew           
IP Configuration
Link local IPv6 address...........: fe80::5689:98ff:fe57:5c56
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.20.10
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.20.1
Physical address..................: 54-89-98-57-5C-56
DNS server........................:

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值