本地dns解析

Sakura 发布于 2023-09-11 145 次阅读


yum install -y bind
vim /etc/named.conf
    options {
            directory       "/var/named";
    };
    # 可以写多个zone
    zone "qq.com" IN {
            type master;
            file "qq.com.zone";
    };

cp -p /var/named/named.localhost /var/named/qq.com.zone

vim /var/named/qq.com.zone
    $TTL 3H
    @       IN SOA  @ rname.invalid. (
                                            0       ; serial
                                            1D      ; refresh
                                            1H      ; retry
                                            1W      ; expire
                                            3H )    ; minimum
    qq.com. NS www
    www A 192.168.4.13
systemctl restart named
echo 本地ip > /etc/resolv.conf
nslookup www.qq.com
# 临时使用httpd
yum install -y httpd
vim /etc/httpd/conf.d/qq.conf
    
            ServerName www.qq.com
            DocumentRoot /var/www/qq
    
mkdir /var/www/qq
echo Camellia >  /var/www/qq/index.html

systemctl restart httpd
curl www.qq.com