
in network configuration, DNS port number is the key identifier of domain name resolution service. Although the default port 53 can meet most of the basic requirements, it is necessary to modify the DNS port number when facing cyber security risks, multi-server level port conflicts or special business scenarios. Many users are not familiar with the operation process and precautions of DNS port number modification, and are worried that operation errors will lead to network failures. This article will explain the whole process of DNS port number modification in detail from the perspectives of preparation work, multi-scenario operation steps, verification and risk avoidance, and help you complete the configuration adjustment smoothly.
formally modify the DNS port number, adequate preparation can effectively reduce operational risks and avoid problems such as domain name resolution failure and network interruption.
1 Confirm destination port availability
first select an unoccupied port as the new DNS port number. It is recommended to choose a non-well-known port above 1024 to avoid conflicts with the system default server level port. You can query the port occupancy on the server or local device through commands such as netstat and lsof to ensure that the target port is currently idle.
2, backup the original DNS configuration file
whether operating on a local device or a server, backup the original DNS configuration file in advance, such as the regedit related items under the Windows system, the named.conf file under the Linux system, etc. Once there is a problem after modification, the original configuration can be quickly restored through the backup file to reduce the network interruption time.
3, understand network firewall rules
DNS the port number is modified, it is necessary to ensure that the new port can pass through the network firewall, including the local system firewall and the hardware firewall at the network level. Confirm the inbound and outbound rules of the firewall in advance to avoid DNS services not being provided or used normally due to port interception.
local computers, mobile phones and other devices as the client side of the DNS service, the operation of modifying the DNS port number is relatively simple, and the operation paths of different operating systems are slightly different.
1, Windows system modification steps
press the Win + R key combination to open the running window, enter regedit into the regedit editor, locate HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ Tcpip\ Parameters in turn, create a new DWORD value named NameServerPort on the right, and set its numerical data to the selected DNS port number.
2, Linux system modification steps
For Linux distributions that use the systemd-resolved service, edit the/etc/systemd/resolved.conf file, add a configuration item DNSStubListenerPort= the new port number, save it and execute the systemctl restart systemd-resolved command to restart the service to complete the DNS port number modification.
3, mobile end device modification steps
most mobile end devices can not directly modify the DNS port number, you need to use the third-party network configuration APP, manually set the custom DNS server address and the corresponding DNS port number in the APP, some devices that support advanced network configuration can find the port configuration option in the advanced settings of the WLAN or cellular network.
if it is a server running a DNS service, it is more prudent to modify the DNS port number, as this will affect all client side resolution services that rely on that server.
1, BIND server modification steps
BIND is currently widely used DNS server software, edit its main configuration file named.conf, add or modify the configuration statement of list-on port new port number {server Internet Protocol Address;}; in the options configuration block, after saving the file, execute the rndc reload command to reload the configuration, without restarting the entire service to complete the DNS port number update.
2, Windows DNS server modification steps
open DNS Manager on the Windows server, right-click on the server name and select Properties, find the server port settings in the Advanced tab, enter the selected new DNS port number, click OK and restart the DNS service to make the new configuration take effect.
complete the DNS port number modification, the default configuration cannot be successful directly, and the normal operation of the service must be ensured through multi-dimensional verification.
1, local analysis function verification
use nslookup, dig and other commands on the local device or server to specify the new DNS port number for domain name resolution testing, such as performing nslookup domain.com server IP -port new port number to see if it can return the Internet Protocol Address corresponding to the domain name normally.
2, port connectivity verification
use telnet, nc and other tools to test the connectivity of the new DNS port number, such as the implementation of telnet server IP new port number, if the connection can be successfully established, indicating that the port is not intercepted by the firewall, the service is in a normal listening state.
3, multi-client side compatibility verification
if the server side modifies the DNS port number, it is also necessary to perform resolution tests on client side devices of different operating systems to ensure that all clients relying on the server can normally complete domain name resolution through the new port, so as to avoid some cases where the client side cannot be used.
To sum up, modifying the DNS port number is a network configuration work that requires rigorous operation. From the early port confirmation, configuration backup, to the specific operation steps in different scenarios, and then to the later function verification, each link cannot be ignored. As long as you follow the process in this article, you can safely complete the DNS port number adjustment, which not only meets special business needs, but also improves the security and flexibility of network configuration.