{"id":1844,"date":"2023-02-04T16:49:06","date_gmt":"2023-02-05T00:49:06","guid":{"rendered":"https:\/\/wp.colliertech.org\/cj\/?p=1844"},"modified":"2023-02-12T15:56:33","modified_gmt":"2023-02-12T23:56:33","slug":"ipv6-with-centurylink-fiber","status":"publish","type":"post","link":"https:\/\/wp.c9h.org\/cj\/?p=1844","title":{"rendered":"IPv6 with CenturyLink Fiber"},"content":{"rendered":"<p>In case you want to know how to configure IPv6 using CenturyLink&#8217;s 6rd tunneling service.<\/p>\n<p>There are four files to update with my script:<\/p>\n<ul>\n<li><a href=\"https:\/\/raw.githubusercontent.com\/LLC-Technologies-Collier\/centurylink-6rd\/main\/etc\/radvd.conf.header\">\/etc\/radvd.conf.header<\/a><\/li>\n<li><a href=\"https:\/\/raw.githubusercontent.com\/LLC-Technologies-Collier\/centurylink-6rd\/main\/etc\/default\/centurylink-6rd\">\/etc\/default\/centurylink-6rd<\/a><\/li>\n<li><a href=\"https:\/\/raw.githubusercontent.com\/LLC-Technologies-Collier\/centurylink-6rd\/main\/etc\/ppp\/ip-up.d\/centurylink-6rd\">\/etc\/ppp\/ip-up.d\/centurylink-6rd<\/a><\/li>\n<li><a href=\"https:\/\/raw.githubusercontent.com\/LLC-Technologies-Collier\/centurylink-6rd\/main\/etc\/ppp\/ip-down.d\/centurylink-6rd\">\/etc\/ppp\/ip-down.d\/centurylink-6rd<\/a><\/li>\n<\/ul>\n<p>There are a couple of environment variables in \/etc\/default\/centurylink-6rd that you will want to set.  Mine looks like this:<\/p>\n<pre>LAN_IFACE=\"ens18,ens21,ens22\"\nHEADER_FILE=\/etc\/radvd.conf.header\n<\/pre>\n<p>The script will configure radvd to advertise v6 routes to a \/64 of clients on each of the interfaces delimited by a comma in LAN_IFACE.  Current interface limit is 9.  I can patch something to go up to 0xff, but I don&#8217;t want to <span title=\"unless Jennifer asks me to\">at this time<\/span>.<\/p>\n<p>If you have some static configuration that you want to preserve, place them into the file pointed to by ${HEADER_FILE} and it will be prepended to the generated \/etc\/radvd.conf file.  The up script will remove the file and re-create it every time your ppp link comes up, so keep that in mind and don&#8217;t manually modify the file and expect it to perist.  You&#8217;ve been warned :-)<\/p>\n<p>So here&#8217;s the script.  It&#8217;s also linked above if you want to curl it.<\/p>\n<pre>#!\/bin\/bash\n#\n# Copyright 2023 Collier Technologies LLC\n# https:\/\/wp.c9h.org\/cj\/?p=1844\n#\n\n# # These variables are for the use of the scripts run by run-parts\n# PPP_IFACE=\"$1\"\n# PPP_TTY=\"$2\"\n# PPP_SPEED=\"$3\"\n# PPP_LOCAL=\"$4\"\n# PPP_REMOTE=\"$5\"\n# PPP_IPPARAM=\"$6\"\n\n${PPP_IFACE:=\"ppp0\"}\nif [[ -z ${PPP_LOCAL} ]]; then\n    PPP_LOCAL=$(curl -s https:\/\/icanhazip.com\/)\nfi\n\n6rd_prefix=\"2602::\/24\"\n\n#printf \"%x%x:%x%x\\n\" $(echo $PPP_LOCAL | tr . ' ')\n\n# This configuration option came from CenturyLink:\n# https:\/\/www.centurylink.com\/home\/help\/internet\/modems-and-routers\/advanced-setup\/enable-ipv6.html\nborder_router=205.171.2.64\n\nTUNIFACE=6rdif\n\nfirst_ipv6_network=$(printf \"2602:%02x:%02x%02x:%02x00::\" $(echo ${PPP_LOCAL} | tr . ' '))\n\nip tunnel del ${TUNIFACE} 2&gt;\/dev\/null\nip -l 5 -6 addr flush scope global dev ${IFACE}\n\nip tunnel add ${TUNIFACE} mode sit local ${PPP_LOCAL} remote ${border_router}\nip tunnel 6rd dev ${TUNIFACE} 6rd-prefix \"${first_ipv6_network}0\/64\" 6rd-relay_prefix ${border_router}\/32\nip link set up dev ${TUNIFACE}\nip -6 route add default dev ${TUNIFACE}\n\nip addr add ${first_ipv6_network}1\/64 dev ${TUNIFACE}\n\nrm \/etc\/radvd.conf\ni=1\nDEFAULT_FILE=\"\/etc\/default\/centurylink-6rd\"\nif [[ -f ${DEFAULT_FILE} ]]; then\n    source ${DEFAULT_FILE}\n    if [[ -f ${HEADER_FILE} ]]; then\n\tcp ${HEADER_FILE} \/etc\/radvd.conf\n    fi\nelse\n    LAN_IFACE=\"setThis\"\nfi\n   \nfor IFACE in $( echo ${LAN_IFACE} | tr , ' ' ) ; do\n\n    ipv6_network=$(printf \"2602:%02x:%02x%02x:%02x0${i}::\" $(echo ${PPP_LOCAL} | tr . ' '))\n\n    ip addr add ${ipv6_network}1\/64 dev ${TUNIFACE}\n    ip -6 route replace \"${ipv6_network}\/64\" dev ${IFACE} metric 1\n\n    echo \"\ninterface ${IFACE} {\n   AdvSendAdvert on;\n   MinRtrAdvInterval 3;\n   MaxRtrAdvInterval 10;\n   AdvLinkMTU 1280;\n   prefix ${ipv6_network}\/64 {\n     AdvOnLink on;\n     AdvAutonomous on;\n     AdvRouterAddr on;\n     AdvValidLifetime 86400;\n     AdvPreferredLifetime 86400;\n   };\n};\n\" &gt;&gt; \/etc\/radvd.conf\n\n    let \"i=i+1\"\ndone\n\nsystemctl restart radvd\n<\/pre>\n\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=cjamescollier\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In case you want to know how to configure IPv6 using CenturyLink&#8217;s 6rd tunneling service. There are four files to update with my script: \/etc\/radvd.conf.header \/etc\/default\/centurylink-6rd \/etc\/ppp\/ip-up.d\/centurylink-6rd \/etc\/ppp\/ip-down.d\/centurylink-6rd There are a couple of environment variables in \/etc\/default\/centurylink-6rd that you will want to set. Mine looks like this: LAN_IFACE=&#8221;ens18,ens21,ens22&#8243; HEADER_FILE=\/etc\/radvd.conf.header The script will configure radvd to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[313,17,207,217,163,102],"tags":[],"class_list":["post-1844","post","type-post","status-publish","format-standard","hentry","category-bullseye","category-debian","category-git","category-kvm","category-networking","category-open-source"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1YDIB-tK","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/1844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1844"}],"version-history":[{"count":9,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/1844\/revisions"}],"predecessor-version":[{"id":1859,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=\/wp\/v2\/posts\/1844\/revisions\/1859"}],"wp:attachment":[{"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.c9h.org\/cj\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}