OpenWrt之DNS設置


OpenWrt之DNS設置

0.前言

本文不涉及smartdns、adguardhome、dns防污染等內容,只介紹DNS的設置


1.WAN口

wan.png
wan2.png

保存&應用后 客戶機發出dns解析請求后路由器用上面的dns回應


2.Lan口

進入openwrt的luci頁面。在 網絡>網卡>LAN 選擇編輯

LANLAN

NUEXINI.LAN2

保存&應用后,路由器自身的dns解析請求 會使用 上面設置的DNS 來回應


3.LAN口DHCP選項

進入openwrt的luci頁面。在 網絡>網卡>LAN 選擇編輯

NueXini

在 DHCP選項下 填入

6,223.5.5.5,119.29.29.29

效果如下:

DNS

該設置會修改連接到路由器LAN的DNS(類似於自定義電腦的DNS)

DNS


4.DHCP/DNS

dhcpdns.png


5.總結

電腦DNS(LAN) > DHCP的DNS > WAN口DNS

1.最常用的DNS設置方式。可以由DHCP請求獲得,或自行設置。在靜態IP的情況下,必須設置,否則無法查詢外面的主機

2.如果路由器用於橋接方式,並且使用靜態IP時,無法用DHCP請求的方式得到DNS,這是該選項的主要用途。其他場合下,則會忽略由DHCP服務器的DNS設置,改用這個設置。

3.如果該機器是子網的DHCP服務器,用於設置DHCP客戶端的DNS。如果留空,默認則用自身的IP。通常客戶端看到的DNS是這個(手機,電腦等)

4.如果自己是子網的DNS服務器,用於設置轉發服務器。如果不設置,則用上游DNS(由1或2)服務器

當第2、3、4項不設置時,默認使用1的DNS解析


參考(Thanks)

https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml#options

https://blog.csdn.net/weixin_41632560/article/details/89448612

https://www.right.com.cn/forum/thread-4059633-1-1.html


附錄.DHCP OPTION

以下是部分DHCP OPTION參照表

DHCP OPTION Meaing
0 None
1 設置子網掩碼
2 "Time Offset in Seconds from UTC
3 設置網關
4 N/4 Timeserver addresses
5 N/4 IEN-116 Server addresses
6 設置DNS服務器
7 N/4 Logging Server addresses
8 N/4 Quotes Server addresses
9 N/4 Printer Server addresses
10 N/4 Impress Server addresses
11 N/4 RLP Server addresses
12 設置域名選項。
13 Size of boot file in 512 byte chunks
14 Client to dump and name the file to dump it to
15 設置域名后綴選項。
16 Swap Server address
17 Path name for root disk
18 Path name for more BOOTP info
19 Enable/Disable IP Forwarding
20 Enable/Disable Source Routing
21 Routing Policy Filters
22 Max Datagram Reassembly Size
23 Default IP Time to Live
24 Path MTU Aging Timeout
25 Path MTU Plateau Table
26 Interface MTU Size
27 All Subnets are Local
28 Broadcast Address
29 Perform Mask Discovery
30 Provide Mask to Others
31 Perform Router Discovery
32 Router Solicitation Address
33 設置靜態路由選項。該選項中包含一組有分類靜態路由(即目的地址的掩碼固定為自然掩碼,不能划分子網),客戶端收到該選項后,將在路由表中添加這些靜態路由。如果存在Option121,則忽略該選項。
34 Trailer Encapsulation
35 ARP Cache Timeout
36 Ethernet Encapsulation
37 Default TCP Time to Live
38 TCP Keepalive Interval
39 TCP Keepalive Garbage
40 NIS Domain Name
41 NIS Server Addresses
42 NTP Server Addresses
43 Vendor Specific Information
44 設置NetBios服務器選項。
45 NETBIOS Datagram Distribution
46 設置NetBios節點類型選項。
47 NETBIOS Scope
48 X Window Font Server
49 X Window Display Manager
50 設置請求IP選項。
51 設置IP地址租約時間選項。
52 設置Option附加選項。
53 設置DHCP消息類型。
54 設置服務器標識。
55 設置請求參數列表選項。客戶端利用該選項指明需要從服務器獲取哪些網絡配置參數。該選項內容為客戶端請求的參數對應的選項值。
56 DHCP Error Message
57 DHCP Maximum Message Size
58 設置續約T1時間,一般是租期時間的50%。
59 設置續約T2時間。一般是租期時間的87.5%。
60 設置廠商分類信息選項,用於標識DHCP客戶端的類型和配置。
61 設置客戶端標識選項。
62 NetWare/IP Domain Name
63 NetWare/IP sub Options
64 NIS+ v3 Client Domain Name
65 NIS+ v3 Server Addresses
66 設置TFTP服務器名選項,用來指定為客戶端分配的TFTP服務器的域名。
67 設置啟動文件名選項,用來指定為客戶端分配的啟動文件名。
68 Home Agent Addresses
69 Simple Mail Server Addresses
70 Post Office Server Addresses
71 Network News Server Addresses
72 WWW Server Addresses
73 Finger Server Addresses
74 Chat Server Addresses
75 StreetTalk Server Addresses
76 ST Directory Assist. Addresses
77 設置用戶類型標識。
78 directory agent information
79 service location agent scope
80 Rapid Commit
81 Fully Qualified Domain Name
82 Relay Agent Information
83 Internet Storage Name Service
85 Novell Directory Services
86 Novell Directory Services
87 Novell Directory Services
90 Authentication
93 Client System Architecture
94 Client Network Device Interface
95 Lightweight Directory Access Protocol
97 UUID/GUID-based Client Identifier
98 Open Group's User Authentication
100 IEEE 1003.1 TZ String
101 Reference to the TZ Database
108 Number of seconds that DHCPv4 should be disabled
109 DHCPv4 over DHCPv6 Softwire Source Address Option
112 NetInfo Parent Server Address
113 NetInfo Parent Server Tag
114 DHCP Captive-Portal
116 DHCP Auto-Configuration
117 Name Service Search
118 Subnet Selection Option
119 DNS domain search list
120 SIP Servers DHCP Option
121 設置無分類路由選項。該選項中包含一組無分類靜態路由(即目的地址的掩碼為任意值,可以通過掩碼來划分子網),客戶端收到該選項后,將在路由表中添加這些靜態路由。
122 CableLabs Client Configuration
123 GeoConf Option
124 Vendor-Identifying Vendor Class
125 Vendor-Identifying Vendor-Specific Information
138 CAPWAP Access Controller addresses
139 a series of suboptions
140 a series of suboptions
141 List of domain names to search for SIP User Agent Configuration
142 ANDSF IPv4 Address Option for DHCPv4
143 This option provides a list of URIs for SZTP bootstrap servers
144 Geospatial Location with Uncertainty
145 Forcerenew Nonce Capable
146 Information for selecting RDNSS
147 The name of the peer DOTS agent.
148 N/4 IPv4 addresses of peer DOTS agent(s).
150 設置TFTP服務器地址選項,指定為客戶端分配的TFTP服務器的地址。
151 Status code and optional N byte text message describing status.
152 "Absolute time (seconds since Jan 1, 1970) message was sent."
153 Number of seconds in the past when client entered current state.
154 "Absolute time (seconds since Jan 1, 1970) for beginning of query."
155 "Absolute time (seconds since Jan 1, 1970) for end of query."
156 State of IP address.
157 Indicates information came from local or remote server.
158 Includes one or multiple lists of PCP server IP addresses; each list is treated as a separate PCP server.
159 This option is used to configure a set of ports bound to a shared IPv4 address.
160 Previously assigned by [RFC7710]; known to also be used by Polycom.
161 Manufacturer Usage Descriptions


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM