Hello forum, posting here to try to get some help and also learn more about networking in general in the process. I have setup my x86-64 OpenWRT router behind my fiber gateway without issue, and then I directed OpenWRT to honor the DHCP and DNS server I'm running on my LAN behind the OpenWRT (DHCP and DNS server is a pi-hole + unbound setup).
OPKG now behaves like this:
root@OpenWrt:~# opkg update
Downloading https://downloads.openwrt.org/releases/23.05.3/targets/x86/64/packages/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/releases/23.05.3/targets/x86/64/packages/Packages.gz
Downloading https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/base/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/base/Packages.gz
Downloading https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/luci/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/luci/Packages.gz
Downloading https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/packages/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/packages/Packages.gz
Downloading https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/routing/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/routing/Packages.gz
Downloading https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/telephony/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/telephony/Packages.gz
Collected errors:
* opkg_download: Failed to download https://downloads.openwrt.org/releases/23.05.3/targets/x86/64/packages/Packages.gz, wget returned 4.
* opkg_download: Check your network settings and connectivity.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/base/Packages.gz, wget returned 4.
* opkg_download: Check your network settings and connectivity.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/luci/Packages.gz, wget returned 4.
* opkg_download: Check your network settings and connectivity.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/packages/Packages.gz, wget returned 4.
* opkg_download: Check your network settings and connectivity.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/routing/Packages.gz, wget returned 4.
* opkg_download: Check your network settings and connectivity.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/23.05.3/packages/x86_64/telephony/Packages.gz, wget returned 4.
* opkg_download: Check your network settings and connectivity.
The problem is, I'm fairly sure, that I have set up DNS resolution on the LAN side to be as follows:
(The 192.168.1.100 address is my pihole/unbound server)
I'd like to continue using my pihole server for DHCP and DNS, but unfortunately it seems to mean that I can't use opkg for udpates... nor does any DNS query done by the OpenWRT LuCi diagnostic page work. Is there a way I can ask OpenWRT to please use the same DNS server as the rest of my LAN?
Looks like the resolver is not configured well in openwrt.
Try this
echo search lan >> /etc/custom_dns.conf
echo nameserver 192.168.1.100 >> /etc/custom_dns.conf
And then edit the /etc/config/dhcp nano /etc/config/dhcp
under the config dnsmasq replace the existing resolvfile option with '/etc/custom_dns.conf'
service dnsmasq restart nslookup one.one.one.one
The output of nslookup should contain the server 192.168.1.100
To confirm log in pihole and then nslookup from openwrt and then see if it is requesting to pi hole.
does not work, I think because dnsmasq is not running on my openwrt. As previously stated, DHCP and DNS are supposed to be handled on this network by the pihole system:
I am going to revert /etc/config/dhcp to its previous state until further notice.
root@OpenWrt:~# cat /etc/custom_dns.conf
search lan
nameserver 192.168.1.100
If I understand correctly, then perhaps there is some other reason why it did not work when I directed /etc/config/dhcp to use your custom_dns.conf file?
I've simulated the command on my router. It worked for me. You have to ignore the no lease, failing error. And you have to restart the whole router before nslookup or opkg update. Again I am writing the sequence of commands-
*replace the option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto' with option resolvfile '/etc/custom_dns.conf'
be careful with the apostrophes(') and the slashes (/)
save the file properly.
double check with cat /etc/config/dhcp
uci set dhcp.@dnsmasq[0].localuse='0'
uci commit dhcp
Then reboot. During boot /tmp/resolv.conf will be linked to /tmp/resolv.conf.d/resolv.conf.auto, and /etc/init.d/dnsmasq will no longer re-write it with 127.0.0.1. but use the DNS server set e.g. 192.168.x.x