首頁 新聞動態 什麼是SPF,SPF技術淺析

什麼是SPF,SPF技術淺析

來源: 網企建站網站建設 | 時間:2020/10/30 | 瀏覽:13612
  1. 1、什麼是SPF記錄?

  2. 2、SPF有什麼用?

  3. 3、如何查詢SPF記錄?

  4. 4、如何在dns管理中設置SPF記錄?

什麼是SPF記錄?
   這裏的SPF是指Sender Policy Framework。翻譯過來就是發信者策略架構,比較拗口,通常都直接稱爲SPF。在域名管理系統中對域名做一條以SPF格式爲準的txt記錄即爲SPF記錄。

SPF記錄有什麼用?
   SPF是爲了防範垃圾郵件而提出來的一種DNS記錄類型,它是一種TXT類型的記錄,它用於登記某個域名擁有的用來外發郵件的所有IP地址。例如: dig TXT domain.com
   domain.com. 27970 IN TXT "v=spf1 ip4:218.16.118.186 -all"
  按照SPF的格式在DNS記錄中增加一條TXT類型的記錄,將提高該域名的信譽度,同時可以防止垃圾郵件僞造該域的發件人發送垃圾郵件。
   SPF是跟DNS相關的一項技術,它的內容寫在DNS的txt類型的記錄裏面。mx記錄的作用是給寄信者指明某個域名的郵件服務器有哪些。SPF的作用跟mx相反,它向收信者表明,哪些郵件服務器是經過某個域名認可會發送郵件的。
  由定義可以看出,SPF的作用主要是反垃圾郵件,主要針對那些發信人僞造域名的垃圾郵件。。

如何查詢SPF記錄?
   當前市場上很多郵件系統和供應商都已經開始支持SPF,比如163.com,那麼該如何得到163.com的SPF值呢?在CMD環境中,鍵入:
   nslookup
   set type=txt
   163.com
  就會得到以下的結果:
   163.com text =
   "v=spf1 ip4:220.181.12.0/22 ip4:202.108.9.128/25 ip4:202.108.5.0/24 ~all"
   163.com nameserver = ns3.nease.net
   163.com nameserver = ns.nease.net
   ns.nease.net internet address = 202.106.185.75
   ns3.nease.net internet address = 220.181.28.3
  其中: "v=spf1 ip4:220.181.12.0/22 ip4:202.108.9.128/25 ip4:202.108.5.0/24 ~all"就是163.com的SPF值。
這個數據中說明了163.com有效合法服務器都有哪些!

如何設置SPF記錄?
   進入域名解析創建一條TXT記錄填寫正確的SPF數據就可以生效了。
  格式如下:
   v=spf1 [[pre] type [ext] ] ... [mod]
  每個參數的含義如下表所示: 參數 描述
   v=spf1 SPF 的版本。如果使用 Sender ID 的話,這個字段就應該是 v=spf2
   pre 定義匹配時的返回值。
  可能的返回值包括: 返回值 描述
   + 缺省值。在測試完成的時候表示通過。
   - 表示測試失敗。這個值通常是 -all,表示沒有其他任何匹配發生。
   ~ 表示軟失敗,通常表示測試沒有完成。
   ? 表示不置可否。這個值也通常在測試沒有完成的時候使用。

   type 定義使用的確認測試的類型。
  可能的值包括: 候選值 描述
   include 包含一個給定的域名的測試
  以 include:domain 的形式書寫。
   all 終止測試序列。
  比如,如果選項是 -all,那麼到達這條記錄也就意味着測試失敗了。但是如果無法確定,可以使用 "?all"來表示,這樣,測試將被接受。
   ip4 使用 IPv4 進行驗證。
  這個可以以 ip4:ipv4 或 ip4:ipv4/cidr 的形式使用。建議使用這個參數,以減少域名服務器的負荷。
   ip6 使用 IPv6 進行驗證。
   a 使用一個域名進行驗證。
  這將引起對域名服務器進行一次 A RR 查詢。
  可以按照 a:domain, a:domain/cidr 或 a/cidr 的形式來使用。
   mx 使用 DNS MX RR 進行驗證。
   MX RR 定義了收信的 MTA,這可能和發信的 MTA 是不同的,這種情況基於 mx 的測試將會失敗。
  可以用 mx:domain, mx:domain/cidr 或 mx/cidr 這些形式進行 mx 驗證。
   ptr 使用域名服務器的 PTR RR 進行驗證。
  這時,SPF 使用 PTR RR 和反向圖進行查詢。如果返回的主機名位於同一個域名之內,就驗證通過了。
  這個參數的寫法是 ptr:domain
   exist 驗證域名的存在性。
  可以寫成 exist:domain 的形式。
   ext 定義對 type 的可選擴展。如果沒有這個字段,那麼僅使用單個記錄進行問詢。
   mod 這是最後的類型指示,作爲記錄的一個修正值。
  修正值 描述
   redirect 重定向查詢,使用給出的域名的 SPF 記錄。
  以 redirect=domain 的方式使用。
   exp 這條記錄必須是最後一條,允許給出一條定製的失敗消息。
   IN TXT "v=spf1 mx -all exp=getlost.example.com"
   getlost IN TXT "You are not authorized to send mail for the domain"


TAG:香港企業郵箱開通
相關案例
台灣-巨懋企業有限公司 BENNIC 於1978年由創始人范明達先生在台北所創立. 1979年設立台灣廠. 1997年設立中國惠州廠. 2019年設立泰國廠. 企業專注於無極電容的生產與銷售. 2003 開始生產電感器與電阻器並進行分音器的組裝, 以服務客戶. 40多年來, 產品已運用於世界各大車廠與名牌音響.
Shenzhen Foomee Intelligent Technology Co., Ltd FOOMEE is an international brand specializing in mobile accessories and consumer electronics. We are committed to delivering products that combine quality, design, and competitiveness for global markets. With strong capabilities in product
SHENZHEN KANGHAO INDUSTRIAL CO.,LTD. SHENZHEN KANGHAO INDUSTRIAL CO.,LTD is a professional plastic products manufacturing factory based in Shenzhen, Guangdong, China. Founded in 2008, we specialize in eco-friendly eco friendly and sustainable products, various plastic parts, and plastic mold R&D & manufacturing — delivering full-cycle solutions from mold design to mass production.
Shenzhen Ruixin Zhilian Technology Co., Ltd. Shenzhen Ruixin Zhilian Technology Co., Ltd. is a high-tech enterprise specializing in the research, development, design and manufacturing of high-performance motherboards. Since its establishment, we have been committed to providing global customers with stable, efficient and innovative hardware computing platform solutions, and is a trusted core partner in the fields of communications, data centers and intelligent mobility.