Openwrt 设置dns:全面的配置指南

Author

Reads 1.2K

Sleek white wireless router with four antennas emitting soft blue and pink light.
Credit: pexels.com, Sleek white wireless router with four antennas emitting soft blue and pink light.

首先,我们需要了解Openwrt的dns配置方式有两种:使用内置的dnsmasq服务和使用第三方的dnsmasq服务。Openwrt的dnsmasq服务是基于内核的dnsmasq服务,提供了更好的性能和稳定性。

在Openwrt中,默认的dns服务器是8.8.8.8和8.8.4.4,这是Google的公共dns服务器。Openwrt的dnsmasq服务会自动将这些dns服务器添加到你的网络中。

如果你想自定义dns服务器,你需要在Openwrt的dnsmasq配置文件中修改dns服务器的地址。具体配置方法请参考后面的步骤。

Router Configuration

To configure OpenWRT DNS, you'll need to log in to your OpenWRT router's admin panel and navigate to Network > Interfaces > LAN settings. If your internet connection uses a static IP address, you may need to configure OpenWRT DNS in Network > Interfaces > WAN settings instead.

To use custom DNS servers, proceed to the General Setup tab and enter the DNS server addresses of KeepSolid SmartDNS service: 62.210.136.158 and 172.96.164.226. You may need to add the second field by pressing the plus icon on the right.

After saving the changes, click Save & Apply, and don't forget to reboot your router for the changes to take effect. It's also essential to register your IP address with KeepSolid SmartDNS to ensure uninterrupted service.

To block Google DNS, follow these steps: proceed to OpenWRT settings and go to Network > Firewall > Traffic Rules > New forward rule, then fill out the required fields and click Save & Apply. You'll need to repeat this process for the destination address 8.8.4.4 as well.

In OpenWRT, you can also configure LAN settings to use custom DNS servers. Simply navigate to the LAN settings page, make the necessary changes, and save them by clicking Save & Apply. Your router's DNS resolution requests will then use the custom DNS servers you've set up.

For another approach, see: Comcast Xfinity Dns

基本知识以及路由器配置详解

Credit: youtube.com, 4 2 路由器启动 基本配置命令 寄存器值

在 OpenWRT 路由器上配置 DNS 服务非常重要。要阻止 Google DNS,需要在 OpenWRT 设置中创建新转发规则。

要配置 OpenWRT DNS,首先需要登录到 OpenWRT 路由器的管理面板。然后,需要在 Network > Interfaces > LAN 设置中选择 General Setup tab。

要阻止 Google DNS,需要在 OpenWRT 设置中创建两个转发规则:一个用于 8.8.8.8,另一个用于 8.8.4.4。每个规则都需要填写以下信息:

需要重复步骤 1-3,填写相同的信息,然后点击 Save & Apply 以保存每个规则。

Lan Port

To configure your Lan Port, enter the OpenWRT LUCI page and navigate to Networking > Network > LAN. Select the edit option to make changes.

The Lan Port's DNS resolution is crucial for your router's functionality.

To set the DNS for your Lan Port, choose the DNS settings from the edit menu and save your changes.

Saving and applying these changes will instruct the router to use the specified DNS for its own DNS resolution requests.

Explore further: Dns Protocol Port

DNS Configuration

DNS Configuration is a crucial aspect of OpenWRT settings. You can configure DNS in OpenWRT using the dnsmasq service.

To configure custom DNS servers, you can follow the steps outlined in Example 4. This involves logging into your OpenWRT router admin panel, navigating to Network > Interfaces > LAN settings, and entering the DNS server addresses of your chosen service.

Take a look at this: DNS Hosting Service

Credit: youtube.com, 2023年最新smartdns对接 passwall等科学上网插件教程,实现DNS分流功能 阻止DNS劫持 泄露等问题 优化网页打开速度视频缓冲时间#一瓶奶油

You can also configure custom DNS servers using the domain configuration option in dnsmasq, as demonstrated in Example 3. This allows you to manage custom domains and hostnames, and can be useful for setting up local DNS resolution.

Here's a summary of the benefits of configuring DNS in OpenWRT:

  • Reduce network administrator and user burden: By automating IP address configuration, you can reduce the risk of address conflicts and DNS errors.
  • Improve network performance: By caching DNS queries, you can reduce the load on your network and improve overall performance.
  • Enhance security: By using custom DNS servers, you can block malicious DNS requests and improve overall network security.

To get started with DNS configuration in OpenWRT, you'll need to:

  • Install the dnsmasq package: This will provide the necessary service for DNS configuration.
  • Configure the DNS settings: This will involve setting up the DNS servers and configuring the dnsmasq service.

By following these steps, you can set up a robust and reliable DNS configuration in OpenWRT, which will improve your network's performance and security.

Configure Basic Usage

To configure basic usage, you need to understand the DNS server address. The DNS server address is represented by the "@" symbol, as seen in Example 4: "①@后面表示 DNS 服务器地址:". This address is used to query the DNS server for domain name resolution.

When using the "dig" command, you can specify the DNS server address using the "@" parameter, as shown in Example 8: "4.使用@参数指定DNS服务器地址,例如指定DNS服务器地址为8.8.8.8". This allows you to query the DNS server for domain name resolution.

Here's an interesting read: Dns Domain Namespace

Credit: youtube.com, How to configure DNS Server | Step by step DNS server configuration

The "dig" command provides various options for querying and displaying DNS records. Some options set flags in the query header, while others control timeouts and retries. The "+short" option, for example, can simplify the output, as seen in Example 4: "dig 还有很多选项可以定制查询和输出。例如+short 可以简化输出。".

To configure basic usage, you need to understand the DNS query process. The query process involves sending a request to the DNS server, which then responds with the resolved IP address. The DNS server address is typically represented by the "@" symbol, as seen in Example 4: "①@后面表示 DNS 服务器地址:".

Here is a summary of the basic usage configuration:

Note that the "dig" command provides various options for querying and displaying DNS records, and the "@" symbol is used to represent the DNS server address.

Implement Nat64

To implement NAT64 on OpenWRT, you need to connect to the core router.

Connect to the core router by using ssh to access the device at IP address 10.0.0.1.

Credit: youtube.com, NAT64 DNS64 experiments

The bind-server is a recommended DNS software, so you'll use it to configure DNS64 functionality.

Install the bind-server package by running the command opkg install bind-server.

Install the bind-rndc package as well by running opkg install bind-rndc.

Bind is the official recommended DNS software for Tayga, so you'll use it to configure DNS64 functionality.

Stop the default dnsmasq service by running service dnsmasq stop.

Start the named service by running service named start.

You can test NAT64 and DNS64 using images and websites.

Advanced Configuration

To configure OpenWRT DNS, you need to access the router's admin panel and navigate to Network > Interfaces > LAN settings. If your internet connection uses a static IP address, you may need to configure OpenWRT DNS in Network > Interfaces > WAN settings instead.

To proceed, choose the General Setup tab and locate the Use custom DNS servers fields. You'll need to enter the DNS server addresses of KeepSolid SmartDNS service, which are 62.210.136.158 and 172.96.164.226. If you only see one field, click the plus icon to add the second field.

For another approach, see: Dns Settings Hostinger

Credit: youtube.com, 网页秒开第一步,SmartDNS教程:OpenWrt软路由设置SmartDNS缓存

Save the changes by clicking Save & Apply, and don't forget to reboot your router for the changes to take effect. Access to KeepSolid SmartDNS service is granted based on the IP address you register in their system, so make sure to register your new IP address if it changes.

A fresh viewpoint: Azure Dns Server Ip

File Configuration

File Configuration is a crucial step in customizing your OpenWRT setup for DNS purposes. You'll need to access the file system to make changes, which can be done through the LuCI web interface or by connecting to the router via SSH.

To access the file system through LuCI, navigate to the "System" tab and click on "File Manager". From there, you can browse and edit files as needed. This is a convenient way to make changes without needing to use the command line.

The most important file for DNS configuration is `/etc/config/dhcp`. This file contains the settings for the DHCP server, which is responsible for assigning IP addresses to devices on your network. You can edit this file to customize DNS settings, such as setting a specific DNS server or enabling DNS caching.

You might enjoy: Openwrt Ap

Credit: youtube.com, DoH,DoT在OpenWRT的配置,使用SmartDNS

In the `/etc/config/dhcp` file, you'll find a section for `option dns`. This is where you can specify the DNS server(s) you want to use. You can add or modify lines in this section to suit your needs. For example, you can add `option dns '8.8.8.8 8.8.4.4'` to use Google's public DNS servers.

Remember to save your changes after editing the file. If you're using the LuCI web interface, click "Save" to apply your changes. If you're using SSH, type `service dnsmasq restart` to reload the DNS configuration.

Global Configuration

To configure OpenWRT DNS, you'll need to access your router's admin panel. Login to your OpenWRT router admin panel to start the process.

You'll find the settings in Network > Interfaces > LAN settings. If your internet connection uses a static IP address, you may need to configure OpenWRT DNS in Network > Interfaces > WAN settings instead.

Choose the General Setup tab to proceed with the configuration. Make sure to enter the DNS server addresses of KeepSolid SmartDNS service in the Use custom DNS servers fields.

The DNS server addresses you'll need to enter are 62.210.136.158 and 172.96.164.226. To add the second field, press the plus (+) icon on the right.

Save the changes by clicking Save & Apply, then reboot your router to apply the changes.

If this caught your attention, see: Network Solutions Dns Records

Jeannie Larson

Senior Assigning Editor

Jeannie Larson is a seasoned Assigning Editor with a keen eye for compelling content. With a passion for storytelling, she has curated articles on a wide range of topics, from technology to lifestyle. Jeannie's expertise lies in assigning and editing articles that resonate with diverse audiences.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.