实验需求
所有的防火墙全部关闭
分配对应的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........................: