Linux--DHCP和DNS混合配置实验!
Posted handsomeboy-东
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux--DHCP和DNS混合配置实验!相关的知识,希望对你有一定的参考价值。
DHCP和DNS混合配置实验
实验准备
一台linux系统做服务器,设置其网卡适配器为Net模式VMnet8,一台win10系统为仅主机模式VMnet1,并将防火墙都关闭
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
win10配置:
VMnet1和VMnet8配置
实验要求:server服务器开启以下服务: dhcp、 dns、httpd要求win客户机以访问www. test. com的网站首页,首页内容hello, worldpc2可以获得dhcp分配的地址
虚拟机设置HTTPD、DHCP
[root@localhost ~]# yum install -y 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
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 //由于linux要作为dhcp服务器,就需要给它指定一个IP地址,它自己不能dhcp动态获取IP地址
[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
[root@localhost ~]# netstat -anup | grep dhcpd
udp 0 0 0.0.0.0:67 0.0.0.0:* 77041/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
ensp中的设置
SW1:
[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:
[SW]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 Vlanif1
#
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
在PC1上获取IP地址
PC>ipconfig /release //释放ip
IP Configuration
Link local IPv6 address...........: fe80::5689:98ff:fe57:5c56
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 0.0.0.0
Subnet mask.......................: 0.0.0.0
Gateway...........................: 0.0.0.0
Physical address..................: 54-89-98-57-5C-56
DNS server........................:
PC>ipconfig /renew //获取ip
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........................:
在win10上获取IP地址
以上是关于Linux--DHCP和DNS混合配置实验!的主要内容,如果未能解决你的问题,请参考以下文章