Using DNS technology to map different domain names to different ports of the same IP

WindowsDNS basic configuration

In the Windows server environment of the intranet, you can realize the required domain name resolution and port forwarding by configuring the DNS service and the Web server. Here are some basic steps to implement the configuration:

1. Configure Windows DNS service

Configure the DNS service on your Windows server, add two host records to resolve domain names to corresponding IP addresses.

  • Open the "DNS Server" administrative tool (usually in "Administrative Tools" > "DNS").
  • In the appropriate zone, create a new host (A) record.
    • Record name: oa.hj.com
    • IP address: IP address of the server
  • Create a new host (A) record again.
    • Record name: doc.hj.com
    • IP address: IP address of the server

2. Configure the web server

Configure the web server on your Windows server to listen on a different port.

  • Install and configure IIS (Internet Information Services) as a web server.
  • Create two sites, one for oa.hj.com and one for doc.hj.com.
  • For the oa.hj.com site:
    • Bind the site to the server's IP address.
    • Set the port binding to 80.
  • For the doc.hj.com site:
    • Bind the site to the server's IP address.
    • Set the port binding to 81.

3. Firewall settings

Make sure the server's firewall allows traffic through the specified ports (80 and 81).

  • Create an inbound rule in Windows Firewall to allow traffic on ports 80 and 81.

4. Verification test

After completing the above configuration, you can test whether the domain name resolution and port access are normal on other computers in the intranet.

  • Open the browser on other computers, visit http://oa.hj.com, you should be able to connect to port 80 of the server.
  • Open a browser on the same computer, visit http://doc.hj.com:81, you should be able to connect to port 81 of the server.

Please note that the above steps are based on you using Windows Server and IIS as your web server. The steps may vary if you use different web server software. In addition, in a production environment, security and performance configurations also need to be considered.

Domain name mapping solution based on IP port

But we want to map different ports of the same IP address to different domain names, which usually requires a reverse proxy server or load balancer to achieve. Here are possible solutions:

1. Use a reverse proxy server

A reverse proxy server can forward traffic to different ports according to the requested domain name and path. You can use software such as Nginx or Apache HTTP Server to achieve this.

  • Install and configure a reverse proxy server (such as Nginx).
  • Configure reverse proxy rules to map different domain names to different ports of the server. For example:
    • For oa.hj.com, proxy to the server's IP address and port 80.
    • For doc.hj.com, proxy to the server's IP address and port 81.

2. Use load balancing

A load balancer can distribute traffic to different backend servers and ports, and route requests to corresponding locations according to rules.

  • Install and configure a load balancer such as HAProxy.
  • Configure load balancing rules to map different domain names to different ports of the server.

Note that the above scenarios involve some complex configuration and techniques. When making these configurations, you need to be familiar with relevant network and server knowledge to ensure security and reliability. If you're not sure how to do this, it's best to seek professional help to make sure your server and network settings are correct and secure.

The difference between smart DNS and traditional DNS

Smart DNS (Smart DNS)

Smart DNS (Smart DNS) is a domain name resolution service designed to provide faster and more efficient network connections, especially when accessing transnational or transregional Internet resources. It differs from traditional DNS resolution because it focuses on improving access speed and performance rather than just resolving domain names to IP addresses.

Smart DNS uses multiple globally distributed DNS servers to dynamically select the closest server for users according to their geographical location and Internet topology, thereby reducing network delay and improving access speed. Smart DNS can also be used to bypass geo-restrictions, such as accessing region-restricted streaming content.

Traditional DNS

Traditional DNS resolution is to map domain names to corresponding IP addresses, so that browsers and applications can connect to servers through IP addresses. However, in some cases, traditional DNS can result in slower connections, especially when users are trying to access servers or content that are located across borders. This is because traditional DNS resolution does not take into account network topology, geographic location, and optimization of Internet traffic.

More articles related to DNS

Ubuntu uses bind9 to build a DNS server.
Install Windows Server 2016 on a Windows 11 virtual machine and test the DNS function
. The PublicDNS service provider adds bytes to support protocols such as DoH/DoT/DoQ.
Starting from Windows Server 2022, the DNS client supports DNS over-HTTPS (DoH)

Guess you like

Origin blog.csdn.net/weixin_37813152/article/details/132336750