Reassign IP address by command line

709 views
Skip to first unread message

Christian NGUYEN VAN THAN

unread,
Dec 16, 2014, 2:00:27 PM12/16/14
to google-c...@googlegroups.com
Hello,

I try to set up a fail over mechanism for my load balancers.
I don't want to use the build in network load balancer to avoid to pay the Ingress traffic.

I have 2 instances with HaProxy and Keepalived.

The problem is that i fail to switch the external IP between the 2 instances by command line.

I have a script that contains : 

#!/bin/bash

/opt/google-cloud-sdk/bin/gcloud compute instances delete-access-config loadbalancer01 \
 --access-config-name "External NAT" --zone europe-west1-b

/opt/google-cloud-sdk/bin/gcloud compute instances add-access-config loadbalancer02 \
 --access-config-name "External NAT" --address myExternalIPAddress --zone europe-west1-c


1st problem: there is a mistake in the documentation. According to the documentation i should have :
--access-config-name "external-nat"

But instead i must set : --access-config-name "External NAT"


2nd problem: when i run the second command i have the following error: 

ERROR: (gcloud.compute.instances.add-access-config) Some requests did not succeed:

 - At most one access config currently supported.


Is there somebody that have already detach an ip and reattach it to another instance by command line ?
Maybe i miss something in the documentation :'(

Thanks.




P   Please consider the environment - do you really need to print this email?

If you received this communication by mistake, please don't forward it to anyone else (it may contain confidential or privileged information), please erase all copies of it, including all attachments, and please let the sender know it went to the wrong person. Thanks. The above terms reflect a potential business arrangement, are provided solely as a basis for further discussion, and are not intended to be and do not constitute a legally binding obligation. No legally binding obligations will be created, implied, or inferred until an agreement in final form is executed in writing by all parties involved.

 


P   Please consider the environment - do you really need to print this email?

If you received this communication by mistake, please don't forward it to anyone else (it may contain confidential or privileged information), please erase all copies of it, including all attachments, and please let the sender know it went to the wrong person. Thanks. The above terms reflect a potential business arrangement, are provided solely as a basis for further discussion, and are not intended to be and do not constitute a legally binding obligation. No legally binding obligations will be created, implied, or inferred until an agreement in final form is executed in writing by all parties involved.

Vilas Jagannath

unread,
Dec 23, 2014, 2:53:58 PM12/23/14
to google-c...@googlegroups.com
Hi Christian,

Thank you for reporting this. I have forwarded the thread to gce-dis...@googlegroups.com which is a compute engine specific group. Please follow up there.

Cheers,

Vilas

Phun Lang

unread,
Dec 23, 2014, 3:29:54 PM12/23/14
to google-c...@googlegroups.com
Hey Christian,

In your script, it looks like you deleted your access config from loadbalancer01 and then attempted to add an access config to loadbalancer02. From the error message, it looks like loadbalancer02 has an existing access config, so I think you also need to delete that access config from loadbalancer02 before adding a new access config.

In summary:

1. Delete the existing access config from loadbalancer02.
2. Rerun your second command to add the new access config.

Hope that helps!

Phun
Reply all
Reply to author
Forward
0 new messages