How do you change your external ip? - google-cloud-platform

What im trying to do is bypass ip detection from websites that i crawl.
Each website limit the amount of times per day you can crawl the site.
They limit your actions by reading your ip.
I use virtual machine (gcloud) to do my crawling so i won't keep my personal pc running.
When this happens, the website puts a block because of my ip.
Im trying to bypass this detection by getting a new ip.
My vm everytime i stop and restart the instance gives me the same 2 external ip addresses.
And in gcloud i thought since the setting was not static and set to ethereal, they would give you a new ip each time you stop the instance, but no.
They only flip flop between the same 2 external ip addresses.
I've learned that in my vm, the external ip is the ip websites look at to see if this address has been here before.
If i can continuously get a new address (like every time i stop the vm) i can keep crawling the websites.
BUT, the vm only gives me the same 2 external ip addresses... I've read that there is a shell command where you can demand a new ip but i do not know how to do this.

I would recommend you to assign a static IP to your VM and change it when you need to do it for your use case. You can change or assign an external IP address, either ephemeral or static, to an existing instance by modifying the instance's access configuration.

Related

Assigning domain name to Google Cloud VM

I'm attempting to assign a domain name to my Google Cloud VM external IP. I was following some walkthroughs and getting a bit confused. I set up apache with a simple "Hello" message when you visit my external IP. The walkthroughs I'm following are providing steps to reserve a new static external IP and creating a DNS zone.
Could someone provide clarification on why I would need to secure a new static external IP address when it appears I already have one assigned?
As discussed by #Ferregina Pelona in the comment section. The public IP that your VM already has is an ephimeral one which means that if the VM is stopped or restarted, there is a possibility this public IP changes. The problem will be that if it changes, your DNS will continue pointing to the old one which means your site will be not accesible until you update the DNS with the new IP. Reserving the public IP will warranty your VM always has the same IP.
Also, added by #DazWilkin. it should be more explicit in the documentation but I assume (!) it's an ephemeral IP. I submitted doc feedback for this.
I assume you're following a guide like [1]
The tutorial demonstrates the following steps when assigning a domain to a VM which would act as a server:
-Register a domain name using Google Domains or Cloud Domains
-Create a virtual machine (VM) instance
-Run a basic Apache web server
-Set up your domain using Cloud DNS
-Update name servers
-Verify your setup
However, there is a very important note that I believe clarifies completely the scenario you faced and the questions regarding this which states:
Note:By default, the VM instance that you create receives an ephemeral external IP address. Ephemeral external IP addresses are lost whenever the VM instance shuts down or reboots for any reason (for example, maintenance). To avoid shutdowns and reboots, use a static external IP address for web hosting. For instructions about how to reserve a static external IP address, see Reserving a static external IP address.
My suggestion would be that you try always to find an official docummentation according to the configuration/products you're expecting to use so as shown in this section, these are the advices that could avoid you yo fall into errors while moving forward. I hops this info make sense for you...
Cheers,

Assigning new IP to a VM each time

On GCP, I want to change external IP address of my VM instance several times in a day and in my project VM needs to be assigned new IP address each time. However, regardless of using ephemeral or static IP, when I try to change IP, there are only 3 or 4 different IP addresses. After 4 times change, the loop backs to start so the IP has been assigned before was assigned to VM again.
Is there a way to assign a new IP address to VM each time?
In this scenario you can use protocol forwarding in order to assign multiple/different external IP addresses to a VM instance. Then When traffic is sent to an external IP address that is served by a forwarding rule, the forwarding rule directs that traffic to the corresponding target pool or target instances.
As per document you can create up to 50 forwarding rule objects per project.
I think (don't know) that this isn't possible.
You are being loaned public IPs from Google's pool and, technically these are assigned randomly (you won't always get these IPs) but, over the timeframe you've monitored, you detect there's a pattern and the behavior is insufficient for your needs.
It's unclear why you need random IPs -- I assume random DNS naming won't suffice for your use-case -- you may want to submit a feature request to Google's Issue Tracker
Given that you detect a period of 3-4 IPs, you could temporarily hold these on VM interfaces and, once you obtain a different IP for your app, you could release the others?

Instance is running but ip shows nothing

I have a google cloud platform, with a VM instance and a SQL. Today they got suspended because the free trial ended. I restarted them both and now they are running. But when i try to go to the ip of the VM instance in my browser, it says This site can’t be reached and "refused to connect". Note that i know nothing about Google Cloud and instances, i just need to have my moodle up and running again.
I tried securing that it allowed http and https in the console. (Ref to this)
The external DNS setting is correct.
And i checked if it was on localhost (ref to this question)
Please help.
If you were using an ephemeral external IP address, that address has been release when the instance was stopped.
If you were using a static external IP address, that address was also released the moment your trial expired, hence reserved IPs generate costs.
When your re-started the instance, probably it received a new IP address.
Check for the external IP address that the instance is currently using and try to use it.
You can see the instances running in your project here: https://console.cloud.google.com/compute/instances
The resources you created during the trial are stopped and If you upgrade within 30 days of the end of the trial, you can restore the resources you created during the trial.
https://cloud.google.com/free/docs/gcp-free-tier#end
What happened is that all resources you created during the trial were stopped.
As Neo mentioned, if you didn’t have your external IP address reserved, the IP was released when the instances were stopped and when you started your instances again, GCP provided a new External IP.
You can check what External IP you have on the External IP addresses, and try to access your moodle through this new IP.
To avoid this problem in the future you can promote your ephemeral external IP address, you can use this guide as reference or follow the next steps:
In the Cloud Console, go to the External IP addresses page.
In the Type column, change the address type to Static for the IP address you want to promote.
Provide a name for the new static IP address and click Reserve.
In this way, the next time you stop your instance you will keep your IP.
Nevertheless, you are not charged for static external IP addresses that are assigned to forwarding rules.
Also you can consult the following documentation for External IP address pricing, in which the documentation provides you pricing for static and ephemeral external IP addresses.

Rotating IP on Google Cloud

I have one instance on Google Cloud Compute engine. By default, it has 1 ephemeral external IP address.
I need to constantly change this external IP, ideally every 1-2 minute.
Is there any way to make this "IP rotation" by running some code?
Also, once new IP assigned, is there any way to get this IP by the code from the previous question and save it in external DB?
Update: Use case is to provide back-connect IP proxy server with IP rotation
This likely can be accomplished with add-access-config. As the documentation reads:
gcloud compute instances add-access-config is used to create access configurations for network interfaces of Google Compute Engine virtual machines. This allows you to assign a public, external IP to a virtual machine.
This lists external IP addresses (and indicates if they're currently assigned):
gcloud compute addresses list | grep external
Adding all IP adresses to a NIC and then rotating the address of a service might be less disruptive.

Restrict the access to aws instance from specific IP

I want to set the security groups for the web server running in aws instance.My website should be accessible to through http/https. But file modification access to be set to particular IP address.I am currently connected to a Wifi router, and as I know IP that my PC assigned changes everytime.
Can someone please guide me on how to get a static IP address that I can allow access to my website.Thanks in advance.
You would need to see if you ISP can sell you a static IP - it's not always possible. I can't get one from my ISP when working from home, your ISP may be different for example.
However, if it is just you that needs static IP address (i.e. you as the developer/admin as opposed to users in the public), it is only a few clicks of the mouse to update the security rule thru the aws console each time you need elevated access. I do this for several servers running on EC2 which I keep locked down, and when I need to RDP into them, I open up the security groups to just my (dynamic) IP, and remove the rule when I am done - this will work if you only occasionally need access. You could also automate this process using a little scripting and/or lambda function.
Other option that I also do: I have an service that I need to access continually from a static IP - I use an another EC2 instance (with fixed IP) as the whitelist IP for this, and then I connect to that services by first connecting via RDP to the EC2 instance - and the EC2 instance with the fixed IP then accesses the service using its static IP.
You first have to know if your external IP changes if so you have to ask your ISP to change your IP to a static one
If it's the internal IP the one that changes but the external IP is the same you will have no problem accessing the aws.