title: Netplan ipv6 "No route to host"
body: <p>I've clearly misconfigured my ipv6 listener addresses.  Question 1: I need someone to spot the error. And a bonus Question 2: is there any risk to removing the "/sbin/ip address add" command below?  </p>
  
  <p>This is on a ubuntu 18.04 virtual machine.  </p>
  
  <p>Here's a curl command, showing that ipv6 routing is not set up correctly:</p>
  
  <pre><code>curl -vvv -L "http://[2600:1303:d000:1::17c3:4571]"
  *   Trying 2600:1303:d000:1::17c3:4571...
  * TCP_NODELAY set
  * Immediate connect fail for 2600:1303:d000:1::17c3:4571: No route to host
  * Closing connection 0
  curl: (7) Couldn't connect to server
  </code></pre>
  
  <p>Previously, when the program started, it issued a native "/sbin/ip address add".  That turned out to be problematic because when the network interface was reset, the route would be lost.  </p>
  
  <p>So, I added /etc/netplan because configuring the ipv6 routing survives a network restart.  However, I didn't remove the "ip addr add" on startup.  Currently, two commands are used to setup routing: netplan and "/sbin/ip address add".  Here's the order of commands executed:</p>
  
  <pre><code>1.  Manual one-time command of "/etc/netplan apply" which didn't return any errors.  
  
  2.  "ip addr add" every time the server starts.  So, at least once since the manual netplan command.
  </code></pre>
  
  <p>Here's the ipv6 addresses it's listening on:</p>
  
  <pre><code>netstat -anp | grep redir | grep LISTEN
  tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
  tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
  tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
  tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
  tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
  </code></pre>
  
  <p>Here's what I want it to be listening on:
      [2600:1303:c000:1::15d4:456f]:80"
      [2600:1303:d000:1::17c3:4570]:80"
      [2600:1303:d000:1::17c3:4571]:80"
      [2600:1303:d000:1::17c3:4572]:80"</p>
  
  <p>Here's the "ip address add" command.  Notice that the I'm using "/24" and I wonder if that's the problem.  Or perhaps using both "ip addr add" and netplan isn't working as intended.  This is a legacy application and because my networking skills in this area aren't strong, I wasn't sure if it would be safe to remove the "ip addr add".  I didn't think it would hurt to keep the "ip addr add" command, but perhaps I was wrong.</p>
  
  <pre><code>out, e = exec.Command("/sbin/ip", "-6", "addr", "add", ip + "/24", "dev", "eth0").CombinedOutput()
  </code></pre>
  
  <p>Here's my netplan config file.  Note that this is only part of the file; for security reasons I'm not including the mac address, name servers or gateway.  However, they are correct because my ipv4 addresses work.  Also, I haven't posted the real ipv6 addresses for security reasons as well.  </p>
  
  <pre><code>root@ubuntu:~# cat /etc/netplan/50-cloud-init.yaml
  # This file is generated from information provided by
  # the datasource.  Changes to it will not persist across an instance.
  # To disable cloud-init's network configuration capabilities, write a file
  # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
  # network: {config: disabled}
  network:
      version: 2
      ethernets:
          eth0:
              addresses: [ '2600:1303:d000:1::17c3:456e/24', '2600:1303:d000:1::17c3:4570/24', '2600:1303:d000:1::17c3:4572/24', '2600:1303:d000:1::17c3:4571/24', '2600:1303:d000:1::17c3:456f/24' ]
  </code></pre>
  
  <p>Thanks in Advance ;)</p>