{"id":1546,"date":"2017-09-15T22:16:54","date_gmt":"2017-09-15T21:16:54","guid":{"rendered":"https:\/\/www.hutsky.cz\/blog\/?p=1546"},"modified":"2017-09-15T22:16:54","modified_gmt":"2017-09-15T21:16:54","slug":"ipv6-with-gateway-in-a-different-subnet","status":"publish","type":"post","link":"https:\/\/www.hutsky.cz\/blog\/2017\/09\/ipv6-with-gateway-in-a-different-subnet\/","title":{"rendered":"IPv6 with gateway in a different subnet"},"content":{"rendered":"<p>I&#8217;ve run across this peculiar problem. I was trying to set up IPv6 on a Centos 6 machine. I thought that it would be a simple task &#8211; a couple of minutes at most &#8211; as I had done that on other Centos 6 machines before. But I was wrong.<\/p>\n<p>My initial configuration steps were:<\/p>\n<pre class=\"\"># cat \/etc\/sysconfig\/network | grep IPV6\r\nNETWORKING_IPV6=yes\r\n<\/pre>\n<pre class=\"\"># cat \/etc\/sysconfig\/network-scripts\/ifcfg-eth0\r\nDEVICE=eth0\r\nTYPE=Ethernet\r\nONBOOT=yes\r\nNM_CONTROLLED=no\r\nBOOTPROTO=none\r\n...\r\nIPV6INIT=yes\r\nIPV6_AUTOCONF=no\r\nIPV6_DEFROUTE=yes\r\nNAME=\"System eth0\"\r\nIPV6ADDR=2a01:xxxx:xxxx:xxxx::1\/64\r\nIPV6_DEFAULTGW=2a01:xxxx:xxxx:yyyy::1\r\n<\/pre>\n<p>Take note of the two (obfuscated) IP addresses, the machine IP address\u00a02a01:xxxx:xxxx:xxxx::1 is in a different subnet than the IP address 2a01:xxxx:xxxx:yyyy::1 of the default gateway given to me by the ISP.<\/p>\n<p>On other machines I had configured in the past, IPV6_DEFAULTGW was <em>2a01:xxxx:xxxx::1,<\/em>\u00a0in other words &#8211; my own machine&#8217;s IP address <em>2a01:xxxx:xxxx:xxxx::1<\/em> was in a subnet that was a part of the bigger\u00a0<em>2a01:xxxx:xxxx::<\/em> subnet in which the ISP&#8217;s gateway machine was located. In those cases, IPv6 worked without any problems when I used the above mentioned simple configuration. But here, it didn&#8217;t work, I was getting the following warning and wasn&#8217;t able to connect\/ping anywhere:<\/p>\n<pre class=\"\">WARN : [ipv6_add_route] 'No route to host' adding route '::\/0' via gateway '2a01:xxxx:xxxx:yyyy::1'\r\n<\/pre>\n<p>I tried specifying the interface, like this:<\/p>\n<pre>IPV6_DEFAULTGW=2a01:xxxx:xxxx:yyyy::1%eth0\r\n<\/pre>\n<p>but that didn&#8217;t help either.<\/p>\n<p>Eventually, I got an advice from a friend who&#8217;s far more IPv6 savvy than I am. I had thought that it was not possible to have default gateway in a completely different subnet and that this was the reason why I was running into this problem, but I was told that IPv6, unlike IPv4, did actually allow for a gateway to be in a different subnet, but in those cases, addtional network script has to be configured like this:<\/p>\n<pre class=\"\"># cat \/etc\/sysconfig\/network-scripts\/route6-eth0 \r\n2a01:xxxx:xxxx:yyyy::1 dev eth0\r\ndefault via 2a01:xxxx:xxxx:yyyy::1\r\n<\/pre>\n<p>Having set the gateway this way, I had to remove it from the interface configuration file, of course:<\/p>\n<pre class=\"\"># cat \/etc\/sysconfig\/network-scripts\/ifcfg-eth0\r\n...\r\nIPV6ADDR=2a01:xxxx:xxxx:xxxx::1\/64\r\n#IPV6_DEFAULTGW=2a01:xxxx:xxxx:yyyy::1\r\n<\/pre>\n<p>After restarting network, this machine was finally IPv6 ready.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve run across this peculiar problem. I was trying to set up IPv6 on a Centos 6 machine. I thought that it would be a simple task &#8211; a couple of minutes at most &#8211; as I had done that &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.hutsky.cz\/blog\/2017\/09\/ipv6-with-gateway-in-a-different-subnet\/\"> <span class=\"screen-reader-text\">IPv6 with gateway in a different subnet<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[39,38],"class_list":["post-1546","post","type-post","status-publish","format-standard","hentry","category-operatingsystems","tag-centos","tag-networking"],"_links":{"self":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/comments?post=1546"}],"version-history":[{"count":17,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1546\/revisions"}],"predecessor-version":[{"id":1563,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1546\/revisions\/1563"}],"wp:attachment":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/media?parent=1546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/categories?post=1546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/tags?post=1546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}