title: Changing DNS settings in openwrt uci command line
body: <p>How can I change the DNS settings using the command line in an openwrt router?
  I see these files here <a href="https://openwrt.org/docs/guide-user/base-system/uci" rel="nofollow noreferrer">here</a></p>
  
  <p><code>/etc/config/ddns</code>
  <code>/etc/config/ipset-dns</code>
  But I slo see dnsmasq installed</p>
  
  <p>but not sure which can change the DNS servers on the router</p>
  
  <p>My end goal is to add a cron job that adds a custom DNS for couple of hours per day, then revert to the original DNS</p>
  
  <p><strong>Edit:</strong> I've found the following commands, can anybody explain?</p>
  
  <p><code>uci set network.wan.dns='&lt;list of space-separated DNS server IPs&gt;'</code></p>
  
  <p><code>uci commit network</code></p>
  
  <p><code>reload_config</code></p>
  
  <p>and </p>
  
  <p><code>uci set network.wan.peerdns='0'</code></p>
  
  <p><code>uci del network.wan.dns</code></p>
  
  <p><code>uci add_list network.wan.dns='9.9.9.9'</code></p>
  
  <p><code>uci add_list network.wan.dns='149.112.112.112'</code></p>
  
  <p><code>uci commit</code></p>