Sahka
Sahka

Reputation: 220

How to assign an external ip to linux server at gcloud?

Last several days I'm struggling with a problem.

I have two instances(ubuntu server) on gcloud and I want to assign them their external IP.

And I can ping and ssh to my instances but when I try to do telnet it is not performed.

On gcloud all instances have one internal ip and one external IP.

And they does not know their ip. I get it from gcloud console.

How could I assign it to them?

Also I've tried sudo ifconfig eth0:0 130.211.95.1 up

Upvotes: 1

Views: 1839

Answers (2)

Gonzalo
Gonzalo

Reputation: 21175

You can do something like this to add the external IP to a local interface:

ip addr add 130.211.95.1/32 dev eth0 label eth0:shortlabel

Replace 'add' with 'del' to remove it once you are done with it.

shortlabel can be any string up to a certain (short) length.

Update: also see this GCE support issue for related information.

Upvotes: 2

Kamran
Kamran

Reputation: 3527

A feature request for this is already filed on GCE public issue tracker, however it is not yet implemented. You can star it to get notification if any update posted on the thread.

May you also mention what's your use case? so I can probably provide you with a workaround.

Upvotes: 1

Related Questions