Open nprime496 opened 5 months ago
This works for me on Ubuntu 22.04 with systemd-resolved.
Can you share the output of the following?
$ cat /etc/resolv.conf | grep -v "^#"
nameserver 127.0.0.53
options edns0 trust-ad
search lan
$ resolvectl status
Global
Protocols: -LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 3 (wlp0s20f3)
Current Scopes: DNS mDNS/IPv4 mDNS/IPv6
Protocols: +DefaultRoute +LLMNR mDNS=resolve -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.1.1
DNS Servers: 192.168.1.1
DNS Domain: lan
Link 10 (enx98fdb49ce22d)
Current Scopes: DNS mDNS/IPv4 mDNS/IPv6
Protocols: +DefaultRoute +LLMNR mDNS=resolve -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.1.1
DNS Servers: 192.168.1.1
DNS Domain: lan
$ grep hosts /etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname
Hi, the output is
$ cat /etc/resolv.conf | grep -v "^#"
nameserver 127.0.0.53
options edns0 trust-ad
search .
@nprime496 can you check if the domain names resolve correctly in brave://net-internals/dns#dns
? There's also a button there to "clear resolver cache", which might be worth checking.
And please check if clearing/disabling browser cache changes anything (e.g. a hard reload can be done with shift+ctrl+r, cache can be cleared at brave://settings/clearBrowserData
, developer tools also have a "disable cache" checkbox).
I only see pages load with a hosts entry to block their domain if they were previously loaded without the hosts entry. Otherwise they're inaccessible. And it seems the behavior is the same in Brave and Chromium, but different in Firefox.
@nprime496 Can you also share how you installed brave? Native packages? Snap or Flatpak? From brave.com or another source? I'm wondering if the packaging is hiding your /etc/hosts or otherwise affecting the resolver.
@nprime496 can you check if the domain names resolve correctly in
brave://net-internals/dns#dns
? There's also a button there to "clear resolver cache", which might be worth checking.And please check if clearing/disabling browser cache changes anything (e.g. a hard reload can be done with shift+ctrl+r, cache can be cleared at
brave://settings/clearBrowserData
, developer tools also have a "disable cache" checkbox).I only see pages load with a hosts entry to block their domain if they were previously loaded without the hosts entry. Otherwise they're inaccessible. And it seems the behavior is the same in Brave and Chromium, but different in Firefox.
It resolves correctly using brave://net-internals/dns#dns
.
The output is :
Resolved IP addresses of "twitter.com": ["0.0.0.0"].
Yet the site site is still accessible.
The hard reload using brave://settings/clearBrowserData
is a too destructive solution for me and I don't want to do it every day, I am automating something with my host file.
@rillian for the installation, I do not recall, how can I check it ?
The hard reload using brave://settings/clearBrowserData is a too destructive solution for me and I don't want to do it every day, I am automating something with my host file.
You can test using a fresh browser profile by starting the browser with brave --user-data-dir="$(mktemp -d)"
- clearing the cache in this browser instance won't affect your main profile.
Given that domains resolve to the expected IPs in ping and net-internals, caching seems like the next thing to look at.
For instance, on my machine, in Firefox, if I go to domain.com, then add 0.0.0.0 domain.com
to /etc/hosts and reload, I'll still get the site as if no changes were made in the hosts file, but a hard reload with ctrl+shift+r does cause the page to fail to load. This is different in Chromium and Brave - AFAICT the two behave the same way - a hard reload doesn't cause a connection failure and the page is still loaded.
If I add the hosts entry first, before going to the domain, it just fails to load, as expected. In all browsers.
Clearing the browser cache at brave://settings/clearBrowserData causes the host file changes to immediately take effect, regardless of the prior state, or the order in which changes were made. In Firefox that's not the case - a hard reload is still needed, regardless of whether the cache was cleared.
So Brave/Chromium behave differently to Firefox. Which behavior is more correct - I'll leave that to others to decide.
for the installation, I do not recall, how can I check it ?
It depends on your distribution and desktop environment. Generally, look for the package source in whatever tool you use to install/update software. For example, the gnome 'Software" application on Fedora has a popup menu listing the source paths (flatpak or rpm).
On the command line you can try things like
dpkg -l brave-browser*
or
rpm -qf /usr/bin/brave-browser
or
flatpak list | grep -i brave
or
snap list | grep -i brave
To see if there is a version installed through one of those systems.
@nprime496 has there been any update on your side for this?
Description
My changes in
/etc/hosts
file to update DNS are ignored by Brave. I tried on Firefox and Chrome, the configuration works.There are already similar issues filled (#13332 and https://github.com/brave/browser-laptop/issues/3750 ).
I disabled DNS over HTTP, no result.
I restarted Brave, no result.
I restarted my computer twice, no result.
Again, my other browsers worked immediately.
Please, I did not plan to spend so much time on this. What is the problem and the solution ?
Steps to reproduce
sudo nano /etc/hosts
add the following line
Restart the network manager :
sudo service NetworkManager restart
Test that the loopback is applied Expected result:
Try to access the site using Brave browser.
Actual result
The site opens.
Expected result
The site should not open as a loopback is configured.
Reproduces how often
Easily reproduced
Brave version (brave://version info)
Brave 1.66.118 Chromium: 125.0.6422.147 (Official Build) (64-bit) Revision 07af53490e0a52336cfb99a376f87671be258049 OS Linux
Channel information
Reproducibility
Miscellaneous information
This is a reccurent and persistent bug that has no explanation and workaround of my knowing.
Related posts across the web : https://community.brave.com/t/hosts-file-localhost-loopback-failure-for-127-0-0-1-twitter-com/470023 (check this, it is very in depth experiment with reports) https://community.brave.com/t/brave-seems-to-be-igoring-my-hosts-file-settings/427045/5 https://community.brave.com/t/brave-doesnt-use-hosts-file-anymore/440885 https://www.reddit.com/r/brave_browser/comments/nhmlmb/make_brave_behave_a_hosts_file/ https://github.com/brave/browser-laptop/issues/3750