million12 / linodeapi

Deploy CoreOS on Linode.
https://registry.hub.docker.com/u/million12/linode-coreos-api/
36 stars 9 forks source link

public and private ips reversed #11

Closed stevesmename closed 9 years ago

stevesmename commented 9 years ago

When attempting to run the script, the public and private IP addresses were incorrect. I'd suggest using the ISPUBLIC from the Linode API response.

pozgo commented 9 years ago

Hi, Please make sure that you are having those two sections in your cloud-config.yaml file:

# Environment Variables
  - path: /etc/environment
    content: |
      COREOS_PUBLIC_IPV4=$public_ipv4
      COREOS_PRIVATE_IPV4=$private_ipv4

and

# Linode Private network tweak
  - path: /etc/systemd/network/50-static.network
    content: |
      [Match]
      Name=eth0
      [Network]
      Address=$public_ipv4/24
      Address=$private_ipv4/17
      Gateway=$gateway.1
      DNS=8.8.8.8
      DNS=8.8.4.4

Those two sections are going to be modified after CoreOS is deployed on Linode accordingly to network settings created during the process of deployment.

pozgo commented 9 years ago

I have used linode api to deploy my test cluster and all works fine. Please use settings from above in network section.

Closing...

stevesmename commented 9 years ago

Maybe this will help better explain the Linode provisioning issue that helped me find and resolve the issue of why provisioning was not working. For me, the Private IP was the first IP and the Public IP was the second IP. I ran the script a few times successfully after finding the problem, prior it would loop through "Waiting for server to boot...". The provision failed because it was hitting the Private IP instead of the Public IP.

diff --git a/linode b/linode
index ac05ad7..1476a8e 100755
--- a/linode
+++ b/linode
@@ -288,8 +288,8 @@ log "Configuring node networking..."
 $LINODEAPI -c linode.ip.addprivate -d LINODEID=$linodeid 1>/dev/null
 # Contains pure list of IP addresses, one per-line. The 1st one is public.
 iplist=$($LINODEAPI -c linode.ip.list -d LinodeID=$linodeid | grep -E 'IPADDRESS\W' | sed -E 's/[^\.0-9]//g')
-publicip=$(echo "$iplist" | sed -n 1p) # get the 1st IP addr
-privateip=$(echo "$iplist" | sed -n 2p) # get the 2nd IP addr
+privateip=$(echo "$iplist" | sed -n 1p) # get the 1st IP addr
+publicip=$(echo "$iplist" | sed -n 2p) # get the 2nd IP addr
 gateway_net=$(echo $privateip | awk -F. '{print $1 "." $2 "." $3}') # private IP, but with no last segment
 log "Public IP: ${bold}${white}$publicip${reset}, private IP: ${bold}${white}$privateip${reset}, gateway: ${bold}${white}$gateway_net.1${reset}."
dwaite commented 9 years ago

These are also reversed for me

ryzy commented 9 years ago

Should be fixed by now, let us know it works for you, @stevesmename