close

其實很多人對DNS原理與設定都很熟,這篇文章會將重點放在自動取得DNS。

懂DNS的人若進行手動設定,不外乎Google的8.8.8.8、Hinet的168.95.1.1,或者學校、企業自行架設DNS server。

那麼懂基礎DNS的你,有沒有想過自動取得DNS為什麼可以上網?這是什麼意思?請見下圖:

dns.png

dns2.png

如果你是將電腦透過有線或無線連接到一般市售分享器,那麼你取得的DNS server 地址通常就是預設閘道(分享器),可是...你的分享器是DNS server嗎?甚至分享器根本沒有臉書  & 臉書IP的對應條目,那麼為何你自動取得DNS拿到預設閘道的IP、或刻意手動設定為預設閘道並輸入www.facebook.com也能上網?

事實是預設閘道不是真的DNS server,它同時也是DNS client,分享器收到主機傳送的DNS query封包,這個封包即使是向閘道查詢網域,閘道還是會問你初次設定的DNS server(就必須是你習慣的8.8.8.8或168.95.1.1等)。

另一個問題是:網域查詢的運算速度,DNS server是閘道比較好?還是Google、Hinet比較好?實際上各廠機器有不同的重視方向,或許自己開發某些獨有技術以優化DNS服務。理論上當然是設定真實DNS server效能最好(包括在分享器上設定DHCP的pool中給真實DNS server),從OSI模型的角度,

DNS server設為8.8.8.8,我向8.8.8.8查詢網域,閘道收到我的封包(IP header[192.168.1.1 , 8.8.8.8]+DNS query header[record entry])只會到L3網路層就轉發出去;

然而DNS server設為192.168.1.254(閘道),我向8.8.8.8查詢網域,閘道收到我的封包(IP header[192.168.1.1 , 192.168.1.254]+DNS query header[record entry]),則會到L7應用層才轉發出去。


Actually, people are understand DNS principles and configuration. This writings is focus in auto DNS.
If you use manually DNS, nothing more than Google's 8.8.8.8 , Hinet's 168.95.1.1. Or campus, enterprise are set up DNS server themselves.
Do you have think auto DNS why can surfing the Internet? What the mean? Next image:

(auto DNS)

(manually DNS)

If you connect to general router over wired or wireless. You had DNS server address should be default gateway(router), however...is your router be DNS server?
Even the router has not facebook & facebook IP address that mapping entries. When your DNS configuration are auto get gateway IP address or manually set gateway IP address why are you input www.facebook.com can surfing the Internet?

In fact, default gateway isn't true DNS server, also it is DNS client. Router are received DNS query packets from host, even if those packets are lookup domain to gateway.
The gateway is still forwards DNS query packets to your initialize setting DNS server (Must be your habitual configuration such as 8.8.8.8 or 168.95.1.1 and so on).

Another question: computing performance for domain lookup. If DNS server setting is gateway, this is better than Google, Hinet? or vice versa?
In fact, each factory machine has different emphasis. Maybe they have unique skill to optimaze DSN service.
In theory, it is of course sure setting true DNS server is the best selection (include DHCP pool configuration has true DNS server in router).

From OSI model point of view,
If DNS server was 8.8.8.8 , I have toward 8.8.8.8 lookup domain. Gateway are received my packets(IP header[192.168.1.1 , 8.8.8.8]+DNS query header[record entry]), that working in L3 netowrk layer then forward;
However, if DNS server was 192.168.1.254 , I have toward 8.8.8.8 lookup domain. Gateway are received my packets(IP header[192.168.1.1 , 192.168.1.254]+DNS query header[record entry]), that working in L7 application layer then transport.

arrow
arrow
    全站熱搜

    Chin 發表在 痞客邦 留言(0) 人氣()