ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Force apt-get to use IPv4 or IPv6

    IT Discussion
    ipv4 ipv6 apt-get ubuntu 17.10
    1
    1
    1.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • black3dynamiteB
      black3dynamite
      last edited by black3dynamite

      Non-Persistent Option

      # Force apt-get to use IPv4
      apt-get -o Acquire::ForceIPv4=true update
      
      # Force apt-get to use IPv6
      apt-get -o Acquire::ForceIPv6=true update
      

      Persistent Option

      # /etc/apt/apt.conf.d/99force-IPv4or6
      sudo tee /etc/apt/apt.conf.d/99force-IPv4or6 <<EOF
      Acquire::ForceIPv4 "true";
      EOF
      
      # If you are using the persistent option, you can switch between IPv4 or IPv6 by changing 4 and 6
      
      # This is how you change them using sed
      # IPv4 to IPv6
      sudo sed -i 's/ForceIPv4/ForceIPv6/' /etc/apt/apt.conf.d/99force-ipv4or6
      
      # IPv6 to IPv4
      sudo sed -i 's/ForceIPv6/ForceIPv4/' /etc/apt/apt.conf.d/99force-ipv4or6
      
      # To confirm the changes
      cat /etc/apt/apt.conf.d/99force-ipv4or6
      

      Sources:
      https://www.vultr.com/docs/force-apt-get-to-ipv4-or-ipv6-on-ubuntu-or-debian
      https://askubuntu.com/a/20416

      1 Reply Last reply Reply Quote 3
      • 1 / 1
      • First post
        Last post