Google Cloud Engine - Change External IP address from CA to SG - networking

I have google cloud compute engine which is centOS 7. It was located in asia-southeast1 (SG). However, I checked the external IP it was on the Mountain View, CA.
Is it possible to change the IP where it can be located to Singapore?
Thanks,
Edmhar

Sure. At this moment you need to:
1 Reserve a new IP in the wanted region.
2 Stop your VM.
3 Assign the new IP to your VM.
4 Re-Start your VM
It is easier to do it through the console, but will take more time. If you decide to do it with gcloud. You need to delete the access and Assign the new one.
Delete access
gcloud compute instances describe [INSTANCE_NAME]
gcloud compute instances delete-access-config [INSTANCE_NAME] \
--access-config-name "[ACCESS_CONFIG_NAME]"
Define the new IP reserved ( here you specify the actual IP x.x.x.x, not its name)
gcloud compute instances add-access-config [INSTANCE_NAME] \
--access-config-name "[ACCESS_CONFIG_NAME]" --address [IP_ADDRESS]
Assign the IP to the VM
gcloud compute instances add-access-config [INSTANCE_NAME] \
--access-config-name "[ACCESS_CONFIG_NAME]"
The official documentation has also the step by step.
https://cloud.google.com/compute/docs/configure-ip-addresses

Related

Openstack Kolla Ansible reconfigure all compute node to enable provider network

May I ask how to reconfigure all compute node to enable provider network in Kolla Ansible openstack?
As I know, openstack will support to create provider network while kolla-ansible deploy success.
Because it enable the relevant composes default in all-in-one or multinode file, something like this:
# Neutron
[neutron-server:children]
control
[neutron-dhcp-agent:children]
neutron
[neutron-l3-agent:children]
neutron
While neutron-l3-agent enable default, you could also create Self-service network not only Provider networks.
IIUC, you could create the provider network and launch instance with this network, like the documentation describe:
$ openstack network create --share --external \
--provider-physical-network provider \
--provider-network-type flat provider
One more thing, your network infrastructure (such as switch or router) should configure correctly at first while you using it.

How to attach static IP to a virtual machine using gcloud?

Trying to attach existing reserved IP address to a new virtual machine using gcloud
it's easy to do in the console, can't find a way how to do it using gcloud
See:
link
gcloud compute instances create [INSTANCE_NAME] --address [IP_ADDRESS]

Openstack - how to assign floating IP pool to specific tenant

In OpenStack (regardless of particular release/version), can you assign a specific floating IP pool to specific tenants? i.e. Pool 1 gets used by Tenant 1 and Pool 2 gets used by Tenant 2?
I need a way to distinguish clients from on a network layer.
You can check the command nova floating-ip-associate or if you are using Neutron, try the following:
Select a floating IP address for the new VM instance to use.
Use the neutron floatingip-list command to display floating IP addresses for the tenant you chose in Step 1. If necessary, use the neutron floatingip-create command to create a floating IP address for this tenant. Note the ID of the floating IP address.
Associate the floating IP address with the new VM instance.
Use the neutron floatingip-associate command to associate the floating IP address from Step 6 with the new VM instance.
http://docs.oracle.com/cd/E36784_01/html/E54155/clicreatevm.html
You can check Openstack docs, it explained there just share with the exact command line. But be careful when associate by command line by practice I find its better to de associate by command line.

Openstack, make my insstance acessible from different machine

How to make my instance accessible from another machine in the same network, I've already asssign a floating IP?
Once you have assigned FIP,
1. verify you have ingress/egress allow on CIDR 0.0.0.0/0 rules configured on security-group.
2. Ping from other machine which is in same network as FIP.
If step 2 succeeds, then you should be able to access VM over network.
In case if step 2 fails, check below things.
Run neutron floatingip-list and check if you have FIP configured for Instance
Go to to nova-api and check logs for clue

How does open stack assign ip to virtual machines?

I want to know how does the openstack assign ip to virtual machines ? and how to find out port and ips used by the VM. Is it possible for us to find out the IP and ports being used by an application running inside the VM ?
To assign an IP to your VM you can use this command:
openstack floating ip create public
To associate your VM and the IP use the command below:
openstack server add floating ip your-vm-name your-ip-number
To list all the ports used by applications, ssh to your instance and run:
sudo lsof -i
Assuming you know the VM name
do the following:
On controller run
nova interface-list VM-NAME
It will give you port-id, IP-address and mac address of VM interface.
You can login to VM and run
netstat -tlnp to see which IP and ports being used by applications running inside the VM.
As to how a VM gets IP, it depends on your deployment. On a basic openstack deployment when you create a network and create a subnet under that network, you will see on the network node a dhcp namespace getting created. (do ip netns on network node). The namespace name would be qdhcp-network-id. The dnsmasq process running inside the dhcp namespace allots IPs to VM. This is just one of the many ways in which VM gets IP.
This particular End User page of the official documentation could be a good start:
"Each instance can have a private, or fixed, IP address and a public, or floating, one.
Private IP addresses are used for communication between instances, and public ones are used for communication with the outside world.
When you launch an instance, it is automatically assigned a private IP address that stays the same until you explicitly terminate the instance. Rebooting an instance has no effect on the private IP address.
A pool of floating IPs, configured by the cloud operator, is available in OpenStack Compute.
You can allocate a certain number of these to a project: The maximum number of floating IP addresses per project is defined by the quota.
You can add a floating IP address from this set to an instance of the project. Floating IP addresses can be dynamically disassociated and associated with other instances of the same project at any time.
Before you can assign a floating IP address to an instance, you first must allocate floating IPs to a project. After floating IP addresses have been allocated to the current project, you can assign them to running instances.
You can assign a floating IP address to one instance at a time."
There are of course deeper layers to look at in this section of the Admin Guide
Regarding how to find out about ports and IPs, you have two options: command line interface or API.
For example, if you are using Neutron* and want to find out the IPs or networks in use with the API:
GET v2.0/networks
And using the CLI:
$ neutron net-list
You can use similar commands for ports and subnets, however I haven't personally tested if you can get information about the application running in the VM this way.
*Check out which OpenStack release you're running. If it's an old one, chances are it's using the Compute node (Nova) for networking.

Resources