|
1 | | -# Fedora DNS Configuration: Forcing Specific DNS Server |
| 1 | +# Fedora DNS Configuration: Forcing a Specific DNS Server |
2 | 2 |
|
3 | 3 | ## Problem |
4 | 4 |
|
5 | | -Fedora system configured to use a specific DNS server (e.g., AdGuard, Pi-hole) for IPv4, but systemd-resolved was falling back to the router's DNS via IPv6 DHCPv6 advertisements. |
| 5 | +A Fedora system was configured to use a specific IPv4 DNS server (e.g., AdGuard, Pi-hole), but systemd-resolved still used the router’s IPv6 DNS advertised via DHCPv6/SLAAC. |
6 | 6 |
|
7 | | -## Diagnosis Commands |
| 7 | +## Diagnosis |
8 | 8 |
|
9 | | -### Check Current DNS Configuration |
| 9 | +### Check Active DNS |
10 | 10 |
|
11 | 11 | ```bash |
12 | 12 | resolvectl status |
13 | 13 | ``` |
14 | 14 |
|
15 | | -This shows which DNS servers are currently being used and where they come from. |
16 | | - |
17 | | -### Identify IPv6 Link-Local Address |
18 | | - |
19 | | -If you see an IPv6 link-local address (starts with `fe80::`) and want to find its corresponding IPv4: |
| 15 | +### Inspect Neighbor Tables |
20 | 16 |
|
21 | 17 | ```bash |
22 | | -# Show IPv6 neighbors with their MAC addresses |
23 | 18 | ip -6 neigh show dev <interface> |
24 | | - |
25 | | -# Show IPv4 neighbors with their MAC addresses |
26 | 19 | ip neigh show |
27 | | - |
28 | | -# Find specific device by MAC address |
29 | 20 | ip neigh show | grep <mac-address> |
30 | 21 | ``` |
31 | 22 |
|
32 | | -### Check NetworkManager Connection Settings |
| 23 | +### Inspect NetworkManager Connection |
33 | 24 |
|
34 | 25 | ```bash |
35 | | -# List all connections |
36 | 26 | nmcli connection show |
37 | | - |
38 | | -# View detailed connection settings |
39 | 27 | nmcli connection show "<connection-name>" |
40 | 28 | ``` |
41 | 29 |
|
42 | | -Look for these key settings: |
43 | | -- `ipv4.dns` - Your configured IPv4 DNS |
44 | | -- `ipv6.method` - How IPv6 is configured (auto/manual/disabled) |
45 | | -- `ipv6.ignore-auto-dns` - Whether to ignore router-provided DNS |
46 | | -- `IP6.DNS[1]` - Currently active IPv6 DNS |
| 30 | +Key fields: |
47 | 31 |
|
48 | | -## Root Cause |
| 32 | +* `ipv4.dns` |
| 33 | +* `ipv6.method` |
| 34 | +* `ipv6.ignore-auto-dns` |
| 35 | +* `IP6.DNS[1]` |
49 | 36 |
|
50 | | -When `ipv6.method` is set to `auto`, the router can advertise its own DNS server via DHCPv6/SLAAC. systemd-resolved may prioritize this over manually configured IPv4 DNS. |
| 37 | +## Root Cause |
51 | 38 |
|
52 | | -## Solution |
| 39 | +With `ipv6.method=auto`, the router may supply its own DNS via DHCPv6. systemd-resolved may prefer it over the manually configured IPv4 DNS. |
53 | 40 |
|
54 | | -### Recommended: Ignore Auto-Configured IPv6 DNS |
| 41 | +## Fix |
55 | 42 |
|
56 | | -Keep IPv6 working but ignore DNS from router advertisements: |
| 43 | +### Ignore Auto-Provided IPv6 DNS (recommended) |
57 | 44 |
|
58 | 45 | ```bash |
59 | | -nmcli connection modify <connection-name> ipv6.ignore-auto-dns yes |
60 | | -nmcli connection up <connection-name> |
| 46 | +nmcli connection modify <connection> ipv6.ignore-auto-dns yes |
| 47 | +nmcli connection up <connection> |
61 | 48 | ``` |
62 | 49 |
|
63 | | -### Verify the Fix |
| 50 | +### Verify |
64 | 51 |
|
65 | 52 | ```bash |
66 | 53 | resolvectl status |
67 | 54 | ``` |
68 | 55 |
|
69 | | -Check that only your desired DNS server is listed as "Current DNS Server". |
70 | | - |
71 | | -## Alternative Solutions |
| 56 | +## Alternatives |
72 | 57 |
|
73 | | -### Option 1: Set IPv6 DNS Explicitly |
74 | | - |
75 | | -If your DNS server has an IPv6 address: |
| 58 | +### Explicit IPv6 DNS |
76 | 59 |
|
77 | 60 | ```bash |
78 | | -nmcli connection modify <connection-name> ipv6.dns "<ipv6-address>" |
79 | | -nmcli connection modify <connection-name> ipv6.ignore-auto-dns yes |
80 | | -nmcli connection up <connection-name> |
| 61 | +nmcli connection modify <connection> ipv6.dns "<ipv6-address>" |
| 62 | +nmcli connection modify <connection> ipv6.ignore-auto-dns yes |
| 63 | +nmcli connection up <connection> |
81 | 64 | ``` |
82 | 65 |
|
83 | | -### Option 2: IPv6 Link-Local Only |
84 | | - |
85 | | -Keep basic IPv6 connectivity without DHCPv6: |
| 66 | +### IPv6 Link-Local Only |
86 | 67 |
|
87 | 68 | ```bash |
88 | | -nmcli connection modify <connection-name> ipv6.method link-local |
89 | | -nmcli connection up <connection-name> |
| 69 | +nmcli connection modify <connection> ipv6.method link-local |
| 70 | +nmcli connection up <connection> |
90 | 71 | ``` |
91 | 72 |
|
92 | | -### Option 3: Disable IPv6 Completely |
93 | | - |
94 | | -If IPv6 is not needed: |
| 73 | +### Disable IPv6 |
95 | 74 |
|
96 | 75 | ```bash |
97 | | -nmcli connection modify <connection-name> ipv6.method disabled |
98 | | -nmcli connection up <connection-name> |
| 76 | +nmcli connection modify <connection> ipv6.method disabled |
| 77 | +nmcli connection up <connection> |
99 | 78 | ``` |
100 | 79 |
|
101 | | -### Option 4: Configure Router |
| 80 | +### Configure Router |
102 | 81 |
|
103 | | -Configure your router to advertise your preferred DNS server in IPv6 router advertisements instead of itself. |
| 82 | +Adjust router RAs to advertise your preferred IPv6 DNS. |
104 | 83 |
|
105 | | -## Testing Commands |
| 84 | +## Testing |
106 | 85 |
|
107 | | -### Test DNS Server Connectivity |
| 86 | +### Connectivity |
108 | 87 |
|
109 | 88 | ```bash |
110 | | -# Test IPv4 DNS server |
111 | | -ping -c 2 <dns-server-ip> |
112 | | - |
113 | | -# Test IPv6 link-local (requires interface specification) |
| 89 | +ping -c 2 <dns-ip> |
114 | 90 | ping -c 2 <ipv6-address>%<interface> |
115 | 91 | ``` |
116 | 92 |
|
117 | | -### Test DNS Resolution |
| 93 | +### Resolution |
118 | 94 |
|
119 | 95 | ```bash |
120 | | -# Query a domain |
121 | 96 | nslookup google.com |
122 | | - |
123 | | -# Or use dig for more details |
124 | 97 | dig google.com |
125 | | - |
126 | | -# Check which DNS server resolved the query |
127 | 98 | resolvectl query google.com |
128 | 99 | ``` |
129 | 100 |
|
130 | | -### Check Network Neighbor Tables |
| 101 | +### Neighbor Tables |
131 | 102 |
|
132 | 103 | ```bash |
133 | | -# View all IPv4 neighbors (ARP table) |
134 | 104 | ip neigh show |
135 | | - |
136 | | -# View all IPv6 neighbors (NDP table) |
137 | 105 | ip -6 neigh show |
138 | | - |
139 | | -# View neighbors on specific interface |
140 | 106 | ip neigh show dev <interface> |
141 | 107 | ip -6 neigh show dev <interface> |
142 | 108 | ``` |
143 | 109 |
|
144 | 110 | ## Quick Reference |
145 | 111 |
|
146 | | -| Command | Purpose | |
147 | | -|---------|---------| |
148 | | -| `resolvectl status` | Show current DNS configuration | |
149 | | -| `nmcli connection show` | List NetworkManager connections | |
150 | | -| `nmcli connection show "<name>"` | View connection details | |
151 | | -| `ip neigh show` | Show IPv4 neighbor table | |
152 | | -| `ip -6 neigh show` | Show IPv6 neighbor table | |
153 | | -| `nmcli connection modify <name> ipv6.ignore-auto-dns yes` | Ignore router DNS | |
154 | | -| `nmcli connection up <name>` | Apply connection changes | |
155 | | -| `ping <address>` | Test connectivity | |
156 | | -| `nslookup <domain>` | Test DNS resolution | |
| 112 | +| Command | Purpose | |
| 113 | +| --------------------------------------------------------- | ---------------------- | |
| 114 | +| `resolvectl status` | Show DNS configuration | |
| 115 | +| `nmcli connection show` | List connections | |
| 116 | +| `nmcli connection modify <name> ipv6.ignore-auto-dns yes` | Ignore router DNS | |
| 117 | +| `ip neigh show` / `ip -6 neigh show` | View ARP/NDP neighbors | |
157 | 118 |
|
158 | 119 | ## Common Scenarios |
159 | 120 |
|
160 | | -### Scenario 1: Router Overriding DNS via IPv6 |
161 | | -**Symptom:** Custom DNS configured but router's DNS is being used |
162 | | -**Fix:** `nmcli connection modify <name> ipv6.ignore-auto-dns yes` |
| 121 | +### Router Overriding DNS |
| 122 | + |
| 123 | +Fix: |
| 124 | + |
| 125 | +```bash |
| 126 | +nmcli connection modify <name> ipv6.ignore-auto-dns yes |
| 127 | +``` |
163 | 128 |
|
164 | | -### Scenario 2: Want to Use IPv6 DNS |
165 | | -**Symptom:** DNS server has IPv6 but not configured |
166 | | -**Fix:** Set `ipv6.dns` and enable `ipv6.ignore-auto-dns` |
| 129 | +### Need IPv6 DNS |
167 | 130 |
|
168 | | -### Scenario 3: Don't Need IPv6 |
169 | | -**Symptom:** IPv6 causing DNS issues |
170 | | -**Fix:** Set `ipv6.method disabled` |
| 131 | +Set `ipv6.dns` and ignore auto DNS. |
| 132 | + |
| 133 | +### IPv6 Not Needed |
| 134 | + |
| 135 | +Disable IPv6 entirely. |
| 136 | + |
| 137 | +## Setting DNS with NetworkManager |
| 138 | + |
| 139 | +### IPv4 |
| 140 | + |
| 141 | +```bash |
| 142 | +nmcli connection modify <connection> ipv4.dns "8.8.8.8 8.8.4.4" |
| 143 | +nmcli connection up <connection> |
| 144 | +``` |
| 145 | + |
| 146 | +### IPv6 |
| 147 | + |
| 148 | +```bash |
| 149 | +nmcli connection modify <connection> ipv6.dns "2001:4860:4860::8888" |
| 150 | +nmcli connection up <connection> |
| 151 | +``` |
| 152 | + |
| 153 | +### Prevent DHCP Overrides |
| 154 | + |
| 155 | +```bash |
| 156 | +nmcli connection modify <connection> ipv4.ignore-auto-dns yes |
| 157 | +nmcli connection modify <connection> ipv6.ignore-auto-dns yes |
| 158 | +nmcli connection up <connection> |
| 159 | +``` |
| 160 | + |
| 161 | +### Find Connection Name |
| 162 | + |
| 163 | +```bash |
| 164 | +nmcli connection show |
| 165 | +nmcli connection show --active |
| 166 | +``` |
0 commit comments