Search code examples
youtubeipfirewallblockingwindows-firewall

Is there a way to get all IP addresses of YouTube to block it with Windows Firewall?


I want to programme my own anti-distraction tool. I can not / do not want to use the hosts file or third-party apps. When using IPsec or Windows Firewall, it only accepts IP addresses. There is

youtube.[264 TLD]
www.youtube.[264 TLD]
subdomains.youtube.[264 TLD]

Apparently, there is no way any more to get a complete list of YouTube sub domains.

Is there a way to somehow obtain all YouTube IP addresses and block them on the IP address level other than using brute force subdomain pinging?


Solution

  • If you have your own DNS server you can block domains from resolving. Here is a guide to block domains in a BIND DNS server.

    To get all the IP addresses there isn't any way. You can install dig. It's available on Linux, but not on Windows.

    Then it is to time enter dig youtube.com. It'll show you all the resolved IP addresses from the DNS cache.

    See my result of dig youtube.com A:

    ; <<>> DiG 9.7.0-P1 <<>> youtube.com A
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13442
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;youtube.com.                   IN      A
    
    ;; ANSWER SECTION:
    youtube.com.            83      IN      A       74.125.235.47
    youtube.com.            83      IN      A       74.125.235.46
    youtube.com.            83      IN      A       74.125.235.45
    youtube.com.            83      IN      A       74.125.235.44
    youtube.com.            83      IN      A       74.125.235.43
    youtube.com.            83      IN      A       74.125.235.42
    youtube.com.            83      IN      A       74.125.235.41
    youtube.com.            83      IN      A       74.125.235.40
    youtube.com.            83      IN      A       74.125.235.39
    youtube.com.            83      IN      A       74.125.235.38
    youtube.com.            83      IN      A       74.125.235.37
    youtube.com.            83      IN      A       74.125.235.36
    youtube.com.            83      IN      A       74.125.235.35
    youtube.com.            83      IN      A       74.125.235.34
    youtube.com.            83      IN      A       74.125.235.33
    youtube.com.            83      IN      A       74.125.235.32
    
    ;; Query time: 0 msec
    ;; SERVER: 127.0.0.1#53(127.0.0.1)
    ;; WHEN: Sat Feb 18 22:26:58 2012
    ;; MSG SIZE  rcvd: 285