Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

English | Русский

🛠️ Fix: YouTube opens but videos don't load (DNS / CDN issue on VPS)

📖 Overview

This guide explains how to diagnose and fix a situation where:

  • You can open YouTube (youtube.com)
  • But videos do not load or play

🌐 How DNS resolution works

🔄 Standard DNS flow

sequenceDiagram
    participant Client
    participant LocalResolver as 127.0.0.53 (systemd-resolved)
    participant DNS as External DNS (1.1.1.1 / 8.8.8.8)
    participant Root
    participant TLD as .com
    participant Authoritative as google.com NS

    Client->>LocalResolver: Query youtube.com
    LocalResolver->>DNS: Forward request
    DNS->>Root: Ask root servers
    Root-->>DNS: Refer to .com
    DNS->>TLD: Ask .com servers
    TLD-->>DNS: Refer to google NS
    DNS->>Authoritative: Ask google.com
    Authoritative-->>DNS: Return IP
    DNS-->>LocalResolver: Return IP
    LocalResolver-->>Client: Return IP
Loading

🎥 How YouTube actually works

flowchart LR
    A[Client] --> B[youtube.com]
    B --> C[HTML Page]

    A --> D[googlevideo.com]
    D --> E[Video Stream CDN]

    style A fill:#0d47a1,stroke:#000000,stroke-width:2px,color:#ffffff
    style C fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style B fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style D fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style E fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff

Loading

👉 Important:

  • youtube.com → loads website
  • googlevideo.com → streams video

❌ Failure scenario (your case)

flowchart LR
    A[Client] --> B[youtube.com OK]
    A --> C[googlevideo.com FAIL]

    B --> D[HTML loads]
    C --> E[No DNS resolution]

    E --> F[Video does not load]

    style A fill:#0d47a1,stroke:#000000,stroke-width:2px,color:#ffffff
    style B fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style D fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style C fill:#c62828,stroke:#8e0000,stroke-width:2px,color:#ffffff
    style E fill:#c62828,stroke:#8e0000,stroke-width:2px,color:#ffffff
    style F fill:#c62828,stroke:#8e0000,stroke-width:2px,color:#ffffff
Loading

🔍 Root Cause

Provider DNS servers assigned via DHCP

Example:

85.193.xxx.xxx
85.193.xxx.xxx

❌ These DNS servers returned incomplete or incorrect responses for CDN domains such as googlevideo.com, breaking video delivery.


✅ Fixed architecture

flowchart LR
    A[Client] --> B[systemd-resolved]
    B --> C[1.1.1.1]
    B --> D[8.8.8.8]

    C --> E[googlevideo.com OK]
    D --> F[youtube.com OK]

    E --> G[Video works]

    style A fill:#0d47a1,stroke:#000000,stroke-width:2px,color:#ffffff
    style B fill:#1565c0,stroke:#000000,stroke-width:2px,color:#ffffff
    style C fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style D fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style E fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style F fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
    style G fill:#66bb6a,stroke:#1b5e20,stroke-width:2px,color:#ffffff
Loading

🌍 Why DNS responses differ

flowchart LR
    A[Client] --> B[Cloudflare DNS]
    A --> C[Google DNS]

    B --> D[Single optimized IP]
    C --> E[Multiple IPs]

    D --> F[CDN Node A]
    E --> G[CDN Nodes A,B,C]

    style A fill:#0d47a1,stroke:#000000,stroke-width:2px,color:#ffffff

    style B fill:#1565c0,stroke:#0d47a1,stroke-width:2px,color:#ffffff
    style D fill:#1565c0,stroke:#0d47a1,stroke-width:2px,color:#ffffff
    style F fill:#1565c0,stroke:#0d47a1,stroke-width:2px,color:#ffffff

    style C fill:#ef6c00,stroke:#e65100,stroke-width:2px,color:#ffffff
    style E fill:#ef6c00,stroke:#e65100,stroke-width:2px,color:#ffffff
    style G fill:#ef6c00,stroke:#e65100,stroke-width:2px,color:#ffffff
Loading

🧠 Key Insight

flowchart TD
    A[Site works] --> B[But content fails]
    B --> C[Check CDN domains]
    C --> D[Check DNS]
    D --> E[Fix DNS]
    E --> F[Everything works]
Loading

⚙️ DNS Configuration (what to edit and what to set)

🇬🇧 English

Depending on your system, DNS may be managed via systemd-resolved, netplan, or directly through resolv.conf.


🔹 Option 1: systemd-resolved (recommended)

Edit the file:

sudo nano /etc/systemd/resolved.conf

Find or add the following lines:

[Resolve]
DNS=1.1.1.1 8.8.8.8
FallbackDNS=1.0.0.1 8.8.4.4
DNSSEC=no
DNSOverTLS=no

Apply changes:

sudo systemctl restart systemd-resolved

Verify:

resolvectl status


🔹 Option 2: Netplan (Ubuntu 18.04+)

Open the configuration file (name may vary):

sudo nano /etc/netplan/01-netcfg.yaml

Add DNS servers:

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: true
      nameservers:
        addresses:
          - 1.1.1.1
          - 8.8.8.8

Apply:

sudo netplan apply


🔹 Option 3: resolv.conf (temporary solution)

Edit the file:

sudo nano /etc/resolv.conf

Add:

nameserver 1.1.1.1
nameserver 8.8.8.8

⚠️ Note: this file may be overwritten by the system.


🏁 Conclusion

The issue was caused by:

❌ Broken DNS from hosting provider ✔ Fixed by switching to public DNS

After fix:

  • DNS resolution works
  • CDN accessible
  • YouTube video playback restored

About

YouTube video not loading on VPS? This guide explains how DNS issues break CDN access (googlevideo.com) and shows how to fix it using systemd-resolved and Netplan on Linux servers.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors