簡體   English   中英

在查詢在我的計算機上本地運行的DNS服務器時,如何使dig使用非localhost的源IP?

[英]How do I make dig use a source IP other than localhost while querying a DNS server running locally on my machine?

我正在嘗試運行coredns插件https://github.com/coredns/demo ,對於其他所有內容,該插件針對172.0.0.0/8或127.0.0.0/8和8.8.8.8返回1.1.1.1。

我運行二進制文件並嘗試使用dig example.org @localhost -p1053 +short從dig發出請求,該請求返回1.1.1.1,因為該請求是從localhost發送的

無論如何,我是否可以從dig向coredns發送一個請求,該請求看起來像是從另一個IP發送來的DNS服務器,它將返回8.8.8.8?

從挖掘手冊:

   -b address[#port]
       Set the source IP address of the query. The address must be a valid address on one of the host's network interfaces, or "0.0.0.0" or "::". An optional port may be
       specified by appending "#<port>"

否則,如果服務器支持ECS(EDNS客戶端子網),則可以使用dig選項+subnet=addr將其提供給服務器,並查看其答復如何變化。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM