模擬互聯網上 CDN 的工做原理,根據用戶從哪來的返回離用戶最近的地址。數據庫
在配置文件中定義 acl ,view,全部的 zone包含在了view裏面bash
acl beijing { 192.168.209.0/24; }; acl shanghai { 192.168.1.0/24; }; acl other { any; }; view view_beijing { match-clients { beijing; }; include "/etc/named.rfc1912.zones.beijing"; }; view view_shanghai { match-clients { shanghai; }; include "/etc/named.rfc1912.zones.shanghai"; }; view view_other { match-clients { other; }; include "/etc/named.rfc1912.zones.other"; };
定義 zone 文件服務器
zone "." IN { type hint; file "named.ca"; }; zone "xuepeng.com" IN { type master; file "xuepeng.com.zone.beijing"; };
定義數據庫文件測試
$TTL 1D $ORIGIN xuepeng.com. @ IN SOA ns1 admin ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS ns1 ns1 A 192.168.209.7 www A 192.168.209.100
$TTL 1D $ORIGIN xuepeng.com. @ IN SOA ns1 admin ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS ns1 ns1 A 192.168.209.7 www A 192.168.1.200
$TTL 1D $ORIGIN xuepeng.com. @ IN SOA ns1 admin ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS ns1 ns1 A 192.168.209.7 www A 100.100.100.100
host www.xuepeng.com 192.168.209.7spa
host www.xuepeng.com 192.168.1.4code
host www.xuepeng.com 127.0.0.1blog