summaryrefslogtreecommitdiff
path: root/docs/services/dns-forwarding.rst
blob: 2b06284eb543c0a00c9b5d72d72f906676b1a03d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
.. _dns-forwarding:

DNS Forwarding
--------------

Use DNS forwarding if you want your router to function as a DNS server for the
local network. There are several options, the easiest being 'forward all
traffic to the system DNS server(s)' (defined with set system name-server):

.. code-block:: none

  set service dns forwarding system

Manually setting DNS servers for forwarding:

.. code-block:: none

  set service dns forwarding name-server 8.8.8.8
  set service dns forwarding name-server 8.8.4.4

Manually setting DNS servers with IPv6 connectivity:

.. code-block:: none

  set service dns forwarding name-server 2001:4860:4860::8888
  set service dns forwarding name-server 2001:4860:4860::8844

Setting a forwarding DNS server for a specific domain:

.. code-block:: none

  set service dns forwarding domain example.com server 192.0.2.1

Set which networks or clients are allowed to query the DNS Server. Allow from all:

.. code-block:: none

  set service dns forwarding allow-from 0.0.0.0/0

Example 1
^^^^^^^^^

Router with two interfaces eth0 (WAN link) and eth1 (LAN). Split DNS for example.com.

* DNS request for a local domain (example.com) get forwarded to 192.0.2.1
* Other DNS requests are forwarded to Google's DNS servers.
* The IP address for the LAN interface is 192.168.0.1.

.. code-block:: none

  set service dns forwarding domain example.com server 192.0.2.1
  set service dns forwarding name-server 8.8.8.8
  set service dns forwarding name-server 8.8.4.4
  set service dns forwarding listen-address 192.168.0.1
  set service dns forwarding allow-from 0.0.0.0/0

Example 2
^^^^^^^^^

Same as example 1 but with additional IPv6 addresses for Google's public DNS
servers.

The IP addresses for the LAN interface are 192.168.0.1 and 2001:db8::1

.. code-block:: none

  set service dns forwarding domain example.com server 192.0.2.1
  set service dns forwarding name-server 8.8.8.8
  set service dns forwarding name-server 8.8.4.4
  set service dns forwarding name-server 2001:4860:4860::8888
  set service dns forwarding name-server 2001:4860:4860::8844
  set service dns forwarding listen-address 2001:db8::1
  set service dns forwarding listen-address 192.168.0.1
  set service dns forwarding allow-from 0.0.0.0/0