Problem:
I sometimes cannot access specific websites for days at a time and ping returns "destination port unreachable".
What I've investigated so far:
This occurs sometimes, and I don't know what triggers it. The most frequently affected website is reddit.com, but it also happens to docs.google.com sometimes. Right now reddit does not work and google docs does.
On my phone, when I switch from wifi to mobile data, everything works, so the websites themselves are still up.
I tried multiple devices in my network, both wired and wifi.
When I try to ping the website, I get this:
ping www.reddit.com
PING reddit.map.fastly.net (199.232.189.140) 56(84) bytes of data.
From OpenWrt.lan (192.168.4.1) icmp_seq=1 Destination Port Unreachable
I also tried getting an IP over mobile (in case it was a DNS issue, maybe a stale IP?) and ping that from within my network, but same thing - works over mobile, but not through the router.
However, when I try the built-in ping tool in OpenWRT (Network Utility), it works! So it's not my ISP.
I have not found out a reliable method of fixing this. Restarting my router sometimes works.
Researching online I only found that maybe it has something to do with iptables.
I don't think I changed anything in my firewall other than creating a port forward for port 34197 and I added some custom rules for Pi-Hole:
POSTROUTING -j MASQUERADE
iptables -t nat -I PREROUTING -i br-lan -p tcp --dport 53 -j DNAT --to 192.168.4.4:53
iptables -t nat -I PREROUTING -i br-lan -p udp --dport 53 -j DNAT --to 192.168.4.4:53
iptables -t nat -I PREROUTING -i br-lan -p tcp -s 192.168.4.4 --dport 53 -j ACCEPT
iptables -t nat -I PREROUTING -i br-lan -p udp -s 192.168.4.4 --dport 53 -j ACCEPT
Since DNS seems to work though, I don't think that's it.
Pinging reddit a few times gave me IPs of the pattern 199.232.xxx.140. I didn't write down any IPs while it did work.
Update: When it resolves to something like 151.101.13.140, it works.
My hardware/software:
Router: Netgear R7800
Software: OpenWrt 21.02-SNAPSHOT r16249-55d9c020a1 (build from this month)