Forward local domain queries to upstream dns

В этой статье будет описано как правильно настроить работу DNS.

Служба DNS расшифровывается как "система доменных имен", которая сопоставляет URL’у IP-адреса серверов указанного ресурса во внешней сети. После этого трафик направляется на указанные адреса.

Прежде чем выбрать путь настройки, убедитесь, что на машине с UserGate на интерфейсе, который смотрит во внешнюю сеть (WAN), имеются DNS провайдера или внешние крупные DNS, на интерфейсе, который смотрит в локальную сеть (LAN), отсутствует шлюз и DNS (прописаны только адрес и маска). Внимание! Убедитесь, что на внешнем интерфейсе прописано не более трех DNS-адресов, иначе могут быть вызваны ошибки с обработкой запроса и страницы в браузере могут открываться долго . Если все так, тогда можно идти дальше.

Существуют четыре основных пути настройки DNS:

1. В локальной сети отсутствует DNS-сервер на машине с контроллером домена.

В этом случае настройка производится следующим образом:

  1. Включить DNS-форвардинг на использование системных настроек в консоли администратора во вкладке Настройка DNS.
  2. *На клиентских компьютерах требуется прописать в качестве шлюза и DNS LAN-интерфейс машины с UserGate.

2. В локальной сети присутствует DNS-сервер на машине с контроллером домена – отдельная машина в локальной сети.

В данном случае нужно настраивать DNS следующим образом:

  1. Включить DNS-форвардинг на использование системных настроек в консоли администратора во вкладке Настройка DNS.
  2. На DNS-сервере сделать Направление (Forward) на LAN-интерфейс UserGate, спустя некоторое время в данной настройке должно будет распознано приблизительное как имя "entensys.dns-forwarding". Делается это следующим образом: заходите на контроллер домена, выбираете роль DNS-сервера, заходите в DNS, выбираете текущую машину, правой кнопкой мыши по нему, Свойства (Properties), вкладка Направление (Forwarders), нажмите Редактировать (Edit), добавьте локальный адрес машины с UserGate.
  3. *На клиентских компьютерах требуется прописать в качестве шлюза LAN-интерфейс машины с UserGate, а в качестве DNS – интерфейс машины с DNS-сервером.

3. В локальной сети присутствует DNS-сервер на машине с контроллером домена и это та же машина, на которой стоит UserGate.

Такая конфигурация считается не самой лучшей в плане нагрузки на сервер, однако для нее тоже есть конфигурация, и делается она следующим образом:

  1. Отключить DNS-форвардинг в консоли администратора во вкладке Настройка DNS.
  2. *На клиентских компьютерах требуется прописать в качестве шлюза и DNS LAN-интерфейс машины с UserGate.

4. Машины из локальной сети имеют шлюзом отличную от машины с UserGate машину (например RRAS сервер, поднятый в Windows Server ****).

В этом случае в браузере клиента требуется прописать локальный адрес машины с UserGate, а в таком случае прокси сам распознает DNS-адреса через DNS-форвардинг. Поэтому последовательность действия следующая:

  1. Включить DNS-форвардинг на использование DNS-адресов из списка в консоли администратора во вкладке Настройка DNS, где в списке надо прописать DNS провайдера или любой крупный внешний интерфейс.

* – приоритетным вариантом считается использование нашего DHCP-сервера, или DHCP-сервера от Windows Server.

В самом DNS-форвардинге имеется возможность поменять порт (по умолчанию стоит 5458, однако лучше без крайней необходимости этого не делать), изменить тайм-аут DNS-запроса (по умолчанию 7000, который тоже не рекомендуется менять, если нет представления о том, как это работает), включить/отключить кэш DNS-записей и изменить их число при включенном кэш. Кэш снижает нагрузку на сервер, благодаря тому, что ответ на запрос берется из кэша, если данный адрес уже вызывался.

Если после корректной настройки согласно данной статье у вас появляется в браузере ошибка 10065, то обратитесь к данной статье.

Относится к: Windows Server (Semi-Annual Channel), Windows Server 2016 Applies to: Windows Server (Semi-Annual Channel), Windows Server 2016

Режим AD является устаревшим, начиная с Windows Server 2019. AD mode is deprecated beginning with Windows Server 2019. Для сред, в которых невозможно подтвердить аттестацию доверенного платформенного модуля, настройте аттестацию ключа узла. For environments where TPM attestation is not possible, configure host key attestation. Аттестация ключа узла обеспечивает аналогичные гарантии в режиме AD и проще в настройке. Host key attestation provides similar assurance to AD mode and is simpler to set up.

Выполните следующие действия, чтобы настроить пересылку DNS и установить одностороннее отношение доверия с доменом структуры. Use the following steps to set up DNS forwarding and establish a one-way trust with the fabric domain. Эти действия позволяют службе HGS размещать контроллеры домена структуры и проверять членство в группе узлов Hyper-V. These steps allow the HGS to locate the fabric domain controllers and validate group membership of the Hyper-V hosts.

Выполните следующую команду в сеансе PowerShell с повышенными привилегиями, чтобы настроить пересылку DNS. Run the following command in an elevated PowerShell session to configure DNS forwarding. Замените fabrikam.com именем домена структуры и введите IP-адреса DNS-серверов в домене Fabric. Replace fabrikam.com with the name of the fabric domain and type the IP addresses of DNS servers in the fabric domain. Для повышения доступности наведите указатель на более одного DNS-сервера. For higher availability, point to more than one DNS server.

Чтобы создать одностороннее доверие лесов, выполните следующую команду в командной строке с повышенными привилегиями: To create a one-way forest trust, run the following command in an elevated Command Prompt:

Finishing bits of technology, vintage and new.

Using ASUSWRT for Local DNS and DHCP

A little background on ASUSWRT. ASUSWRT is the firmware ASUS ships on current routers. It started as a fork of the Tomato firmware project. Tomato is similar to DD-WRT. ASUSWRT-Merlin is an enhanced, and fixed (some), version of the ASUS supplied ASUSWRT.

Post Switch Concerns

After switching to ASUSWRT from DD-WRT I thought I would be losing the ability to serve local DNS. I was wrong. I loaded ASUSWRT-Merlin on my ASUS RT-N66U. After some trial and error configuration I discovered local DNS is alive and well in ASUSWRT-Merlin.

There is one minor caveat in that local DNS only works for DHCP served addresses, unless you further modify the dnsmasq configuration from the command line. I spent a lot of time managing non-DHCP addresses in that fashion with DD-WRT, and want to make management as simple as possible. The dnsmasq service used by ASUSWRT operates as a masquerading forwarding DNS server.

With DD-WRT I had non-DHCP addresses allocated in a certain range (0-99), and DHCP addresses from 100 to 255. Within the DHCP addresses I reserved the first 20 (via DHCP reservations) for our devices. Which let any guests pickup other addresses. Why?

With DD-WRT I broke the DHCP range into two and had QOS rules in place for each group. Guest addresses received tighter restrictions and lower bandwidth. Managing these in DD-WRT was a pain. The ASUSWRT makes it a lot simpler to accomplish the same things.

Local DNS Setup

I couldn’t find any definitive guides on setting this up, only that it could be done. So heres how. Before proceeding, to make things easier, make sure all devices in the ASUS Client list have a name showing up. If the name doesn’t show up, click it’s MAC address (top one) and define it in the pop-up window that appears.

Open the LAN menu, and “DHCP Server” tab. A few things to note:

a) “Enable the DHCP Server” should be Yes.

b) The routers Domain Name can be blank or you can set it to what you want, just don’t use one of the top level domains like com, net, org, etc. I chose “home”. This makes all hosts on my network resolvable as “hostname.home”.

c) Set the DHCP starting and ending range, for example 192.168.1.10 to 192.168.1.150. The subnet and final address are blocked out in the image. For the subnet, it should be the same as the routers defined subnet. If you defined the routers address as 192.168.1.1 then the IP range should be on subnet 1. I don’t use 1.

d) The “Default Gateway” is the gateway that clients will route through.

e) Now the DNS settings need special attention:

If you select Yes for “Advertise routers IP in addition to user specified DNS”, then the routers address will be appended to the DNS address list given to the clients when they lease an IP address. I said “appended” meaning it will be LAST!

So if you want to be able to resolve names on your network without specifying the routers address as the name server to do the resolution (i.e.: nslookup – 192.168.1.1), then you should make sure the Advertise setting is set to No, and put the routers address in “DNS Server 1”. This puts the router in the list FIRST! Apply your secondary (if any) in “DNS Server 2”.

The last thing surrounding DNS, which ties into the router domain defined above, is the “Forward local domain queries to upstream DNS”. This should be No. You don’t want a query for “xbox.home” to be passed up to be resolved at the internet level. You want it to stay on your network.

With DNS setup in this way, your hosts (blah.home) are answered first from the local DNS cache while external hosts (www.apple.com) are answered from your ISP (or OpenDNS, Google, etc) DNS servers.

f) Click the Apply button when done.

I typically assign a static address to devices that I want to always be at a certain address (like a printer, NAS drive, etc). I typically setup appliances like streaming players and TV’s with static addresses too since they really don’t need to change.

I still wanted to resolve the problem where these non-DCHP devices (devices with static IP assignments) could be resolved on the network WITHOUT having to modify configuration from the command line. Remember, simple, low maintenance.

To resolve this I changed all devices with static IP’s to DHCP. Bonus that makes device setup simpler too. I then setup DHCP reservations for them within the DHCP pool in a particular range (99 or less). This way I can easily identify “appliances” from computing devices.

a) Set the “Enable Manual Assignment” to Yes.

b) Use the dropdown to select a device, which will have the MAC address or device name (if it was given by the requesting client or defined manually on the ASUSWRT Client list).

c) Set the address (it will default to whatever it was assigned by the server). If you want to change it, change it.

d) Click the + button.

e) Click the Apply button.

Traffic Control

With DD-WRT I had devices setup in ranges with guest range relegated to low bandwidth and peer to peer services blocked. I want the same thing with ASUSWRT. I also had my devices defined with particular classes of service.

The ASUSWRT firmware has defaults based on traffic type, mainly surrounding file transfer.

Once enabled you can delete the default ones, and add custom ones.

I added the peer to peer services using the service name drop down and selecting the common ones. To add, select it, set the priority, and click the + sign icon.

I then added my devices, this time using the Source IP or Mac dropdown. The name will show up if it was offered by the requesting client or was manually defined on the ASUS Client list. This makes it a cinch to add, unlike DD-WRT where you add each device by MAC address only.

Once defined, click the Apply button.

So what about the lower priority guest traffic? With ASUSWRT, any traffic not matching a rule gets routed to the “Low” setting. I have my low and lowest settings set to use very little bandwidth.

I now have ASUSWRT doing everything DD-WRT was doing, and without command line management.

Oh, and now is a good time to backup the configuration using the Administration/Save feature.

Оцените статью
ПК Знаток
Добавить комментарий

Adblock
detector