4

I saw couple of related posts on this topic: How do client applications know to use IPv4 or IPv6? and How to know if your browser is connected to the Ipv4 or Ipv6 address of a website?

The first post is couple years old so I am not sure if it is still relevant and the 2nd one didn't answer my question.

Reason I ask is I installed pi hole to help blocking ads. I setup my router to use pi-hole as my IPv4 DNS server, however I still see advertisements when browsing site like CNN. I then realized that my ISP provider (Comcast) provided two IP addresses, one IPv4 and one IPv6 and my router also supports IPv6.

When I manually disable IPv6 on my network card then advertisements stop showing up when I browse CNN website. Therefore I concluded that I was using IPv6 to connect to the CNN website. My question is when a web browser decides to use IPv4 or IPv6 to connect to the destination? Does is simply try to use IPv6 first and if succeeded then use it, otherwise fall back to IPv4?

A side note, apparently Arris SBG6700-AC modem/router only allow you to configure IPv4 DNS server but not IPv6 DNS server. To specify your own IPv6 DNS server, I must set that up from the computer itself.

3
  • 1
    I suggest using UBlock Origins Apr 12, 2017 at 20:26
  • Have you tried installing pi-hole on a dual stack host and use it for resolution over both IPv4 and IPv6? At least four of the supported operating systems have IPv6 support.
    – kasperd
    Apr 17, 2017 at 12:37
  • Raspbian which is what pi-hole is installed on supports IPv6. It is my Arris SBG6700-AC modem/router that doesn't allow me to set a default IPv6 DNS server. I can of course set my IPv6 DNS server manually on each PC I have on the network but that's a bit inconvenient.
    – beyonddc
    Apr 18, 2017 at 19:41

3 Answers 3

15

First: How you resolve a hostname has nothing to do with what address you can resolve it to. DNS servers are perfectly capable of returning IPv6 AAAA records when asked via IPv4, and vice versa.

As for how a browser chooses which address to try: The first post you linked to is still relevant, the only things that changed are minor priority adjustments.

  • Most modern browsers use the Happy Eyeballs algorithm; they try all addresses at once and stick with the one which replies fastest. This is implemented entirely within the app and cannot be influenced by the OS. (Note that the algorithm is sometimes tweaked to give a head start to IPv6 or IPv4 in case they both give similar results.)

  • Older browsers and many other programs try all addresses one by one, sorted according to a default address selection algorithm, which usually prefers native IPv6 over native IPv4 over automatic v6 tunnels. This ordering is usually implemented in the OS (e.g. gai.conf), and programs don't sort addresses manually.

2
  • 1
    This is a pretty good answer, except it's not safe to say that Happy Eyeballs is all implemented in the app and not the OS. I'm pretty sure that all apps for iOS or macOS that use modern high-level NSURLSession or CFNetwork APIs (as opposed to creaky old low-level BSD sockets APIs) get an Apple-optimized version Happy Eyeballs for free via the OS.
    – Spiff
    Apr 12, 2017 at 22:01
  • Interesting, I didn't know that a IPv4 DNS server can reply back with an IPv6 address. I always thought that IPv4 DNS server only resolve IPv4 addresses and IPv6 DNS only resolve IPv6 addresses. Thanks for your links, I wasn't aware of Happy Eyeballs algorithm. It's very informative. Usage of pi-hole was a fun in-home exercise. It just happened that I hit this issue that I described in my question. That's why I am here to seek for answers and opinions. Thank you for your feedback!
    – beyonddc
    Apr 13, 2017 at 0:41
1

You cannot directly control how the web browser determines whether it uses IPv6 or IPv4.

That is all handled by the IP stack in the computer.

As for the ads, I suggest you look at alternative ad blockers. I don't believe the v4 vs v6 issue is responsible for the results you are seeing.

Hint for Windows: Adblock does a good job. Just don't use Adblock Plus because it is a memory hog as it loads in tables of "allowable" ads.

Meanwhile, from your question, I have a suggestion: Set all your routers to disable IPv6 until such a time as it may be required.

Then do the same for all your computers: For each interface, uncheck the IPv6 support (Windows), or set it to disabled or automatic (Linux) and let the routers handle the rest.

One day IPv6 will become necessary, but that will be largely an issue affecting ISPs. (I use Cox Cable) To push it all the way down to the user level, they would have to replace our combined modem/router box at that time. Or, they will require all their users to do their own router reconfigurations. They will suffer losses if they do either of those things, especially if the add any extra charges for the change or help-line support. In the end I predict that Cox will figure out a way to prevent such a large amount of work. They are a business and they must realize that if there are any more extra charges or possible user-induced configuration errors resulting in downtime then they will lose customers.

So for now, there is no need for IPv6 at all, at the user level.

All your systems behind your NAT router will likely be able to continue to use v4 for the forseeable future. v6 will only be necessary on the larger net.

2
  • 1
    Most larger ISPs are able to push new configurations and even firmware updates via TR-069. In many cases, the devices they give out already have IPv6 support as a standard feature, even if the ISP still doesn't run it in their network. Apr 12, 2017 at 20:48
  • 1
    If your network supports both IPv6 and IPv4, you can actually disable usage of IPv6 from Firefox and Chrome so you do have some control over it. I do have adblock installed on my browser. Usage of pi-hole is purely a fun exercise and when I hit this experience that I couldn't explain I come to site to seek answers and opinions. :) Apparently my Arris SBG6700-AC router doesn't even let me to disable IPv6 altogether. I can only do that at OS level of each computer. I am considering buying an EdgeRouter X so I can have more control over this type of settings. Thanks for your feedback
    – beyonddc
    Apr 13, 2017 at 0:32
-1

For adds use ublock origin. Small, fast, doesn't let adds trough if a company pays enough, blocks youtube adds too. Unless your computer is really slow it'll work fine. Noscript or umatrix are pretty necessary too to block as many google/facebook/.... spyware scripts. You can't block everything since you'd block recaptcha or ajax and break

For android there is dns66 (on f-droid) that will also block adds (sadly not youtube ones).

If you want a centralised solution, there are proxy servers that can be used to block adds too.

Afaik the browser uses the one with less latency. Since ipv4 adds are blocked the latency is effectively infinite so it uses ipv6.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .