{"id":2840,"date":"2026-05-19T17:39:35","date_gmt":"2026-05-19T17:39:35","guid":{"rendered":"https:\/\/hauweele.net\/~gawen\/blog\/?p=2840"},"modified":"2026-05-19T17:39:35","modified_gmt":"2026-05-19T17:39:35","slug":"freebsd-disable-ipv6-on-pkg","status":"publish","type":"post","link":"https:\/\/hauweele.net\/~gawen\/blog\/?p=2840","title":{"rendered":"FreeBSD: disable IPv6 on PKG"},"content":{"rendered":"<p>\n  <code>pkg<\/code> on FreeBSD uses <code>libfetch<\/code> under the hood to fetch packages and metadata. Unlike modern HTTP clients, <code>libfetch<\/code> does not implement <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc6555\" target=\"_blank\" rel=\"noopener\">Happy Eyeballs<\/a> which lets a client race IPv4 and IPv6 connections and use whichever responds first.\n<\/p>\n<p>\n  Without this protocol, with a broken IPv6 path, the client just sits there waiting for the IPv6 connection to time out before falling back to IPv4. That is exactly what <code>pkg<\/code> does when IPv6 is broken on your network \u2014 it hangs.\n<\/p>\n<p>The fix is straightforward: tell <code>pkg<\/code> to use IPv4 only.<\/p>\n<p>Edit <code>\/usr\/local\/etc\/pkg.conf<\/code> and find the commented-out line:<\/p>\n<pre><code>#IP_VERSION=0<\/code><\/pre>\n<p>Uncomment it and change the value to <code>4<\/code>:<\/p>\n<pre><code>IP_VERSION=4<\/code><\/pre>\n<p>\n  <code>pkg<\/code> will now skip IPv6, and installs and updates will no longer stall on networks where IPv6 connectivity is broken. That may be a better temporary solution than disabling IPv6 entirely.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>pkg on FreeBSD uses libfetch under the hood to fetch packages and metadata. Unlike modern HTTP clients, libfetch does not implement Happy Eyeballs which lets a client race IPv4 and IPv6 connections and use whichever responds first. Without this protocol, &hellip; <a href=\"https:\/\/hauweele.net\/~gawen\/blog\/?p=2840\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[389,164,394],"class_list":["post-2840","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-freebsd","tag-ipv6","tag-pkg"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2840"}],"version-history":[{"count":0,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2840\/revisions"}],"wp:attachment":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}