亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

通過 Cisco IPSec 連接時,應用程序無法解析內部 DNS 條目

通過 Cisco IPSec 連接時,應用程序無法解析內部 DNS 條目

Go
SMILET 2022-01-10 10:31:23
我使用 Cisco IPsec 連接到我的工作場所 VPN。我使用 OS X 的本機 Cisco IPSec 客戶端進行連接。我們有一個內部 DNS 服務器,用于保存內部站點的記錄,例如scotty.infinidat.com. 使用 curl 聯系內部站點按預期工作。使用以下 Python 代碼也可以:import requestsresp = requests.get("http://www.google.com")resp.raise_for_status()resp = requests.get("http://scotty.infinidat.com")resp.raise_for_status()但是,嘗試在 Go 中實現等價物失?。喊鱥mport (    "fmt"    "net/http")func main() {    _, err := http.Get("http://google.com/") // This works    if err != nil {        panic(fmt.Sprintf("Error contacting Google: %s", err))    }    _, err = http.Get("http://scotty.infinidat.com/") // This doesn't    if err != nil {        panic(fmt.Sprintf("Error contacting an internal site: %s", err))    }}在連接到 VPN 時運行上述程序會產生以下輸出:panic: Error contacting internal site: Get http://scotty.infinidat.com/: dial tcp: lookup scotty.infinidat.com on 10.135.1.1:53: no such hostgoroutine 1 [running]:panic(0x290ca0, 0xc82010a490)        /usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6main.main()        /Users/roeyd/src/go/src/webtest/main.go:16 +0x2af其中 10.135.1.1 是我本地網絡的 DNS 服務器。據我了解,純 Go DNS 解析器在 OS X 上不可用。通過設置強制 Go 使用 cgo DNS 解析器GODEBUG=netdns=cgo沒有任何區別。
查看完整描述

2 回答

?
森林海

TA貢獻2011條經驗 獲得超2個贊

可能您已經這樣做了,但是從我這邊執行時dig scotty.infinidat.com我沒有記錄(與您的結果匹配):


$ dig scotty.infinidat.com


; <<>> DiG 9.8.3-P1 <<>> scotty.infinidat.com

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 53313

;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0


;; QUESTION SECTION:

;scotty.infinidat.com.          IN      A


;; AUTHORITY SECTION:

infinidat.com.          155     IN      SOA     ns1.dnsimple.com. admin.dnsimple.com. 1438782431 86400 7200 604800 300


;; Query time: 234 msec

;; SERVER: 10.132.0.1#53(10.132.0.1)

;; WHEN: Sun Jul 30 21:37:14 2017

;; MSG SIZE  rcvd: 93

因此,如果 forwww.google.com工作正常,那么更改可能與您的 DNS/ZONE 更相關。


查看完整回答
反對 回復 2022-01-10
?
大話西游666

TA貢獻1817條經驗 獲得超14個贊

或許你可以先用一個完整的DNS庫來解析IP:


 package main


 import (

    "log"


    "github.com/miekg/dns"

 )


 func main() {

    c := dns.Client{}

    m := dns.Msg{}

    m.SetQuestion("scotty.infinidat.com.", dns.TypeA)

    r, t, err := c.Exchange(&m, "10.135.1.1:53")

    if err != nil {

        log.Fatal(err)

    }

    log.Printf("Took %v", t)

    for _, ans := range r.Answer {

        Arecord := ans.(*dns.A)

        log.Printf("%s", Arecord.A)

    }

 }


查看完整回答
反對 回復 2022-01-10
  • 2 回答
  • 0 關注
  • 361 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號