Web Server
[root@localhost ~]# yum -y install httpd
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# vim index.html
DNS Server
1. Software Installation
[root@localhost ~]# yum -y install bind
2. Configure the main configuration file
[root@localhost ~]# vim /etc/named.conf
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
allow-query { any; };
};
Production environment generally only listen listening network or outside the network
3. Configure the zone file (first zone file backup, delete the extra template, leaving only when a forward and a reverse (reverse modify, write network-bit format, such as 192.168.100.2-> 100.168.192 .))
[root@localhost ~]# vim /etc/named.rfc1912.zones
The main production environment using analytical positive
zone "zhangjie.com" IN {
type master;
file "zhangjie.localhost";
allow-update { none; };
};
zone "43.168.192.in-addr.arpa" IN {
type master;
file "zhangjie.loopback";
allow-update { none; };
};
4. The configuration data file
A. First copy the file to generate analytical positive and reverse lookup files
[root@localhost ~]# cd /var/named/
[root@localhost named]# cp -a named.localhost zhangjie.localhost
[root@localhost named]# cp -a named.loopback zhangjie.loopback
B. Editing forward resolution file (note the end of the domain name ''. ")
[root@localhost named]# vim zhangjie.localhost
$TTL 1D
@ IN SOA zhangjie.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.zhangjie.com.
dns A 192.168.43.99
www A 192.168.43.98
C. Editing reverse lookup file (note that domain names ending in ".")
[root@localhost named]# vim zhangjie.loopback
$TTL 1D
@ IN SOA zhangjie.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.zhangjie.com.
99 dns.zhangjie.com PTR.
98 PTR www.zhangjie.com .
5. restart the DNS service
[root@localhost named]# service named start
[root@localhost named]# netstat -tlun
6. Client test: add the address of the DNS server in the network card configuration file, and then use the nslookup test
Client
[root@localhost ~]# curl 192.168.43.98
[root@localhost ~]# curl www.zhangjie.com
[root@localhost ~]# nslookup www.zhangjie.com
Server: 192.168.43.99
Address: 192.168.43.99#53
Name: www.zhangjie.com
Address: 192.168.43.98
[root@localhost ~]# nslookup 192.168.43.99
Server: 192.168.43.99
Address: 192.168.43.99#53
99.43.168.192.in-addr.arpa name = dns.zhangjie.com.