open firewall for multiple IPs - google-cloud-platform

I am trying to give the following IPs access t0 post data to mysql installed on VM google cloud (drupal8) i cannot figure out how to write the format correctly. error Invalid IP address or range. Use CIDR notation and enter the lowest IP address in the subnet.
174.129.249.162|65.17.248.|68.71.103.|184.73.155.222|184.72.56.152|184.72.56.199|184.73.192.230|184.169.131.85|52.0.132.63|52.71.25.2|52.71.19.16|52.71.25.60|52.71.25.97|52.11.235.107|52.35.106.209|52.32.146.111|52.25.210.125|52.33.176.145

The format should be 174.129.249.162/32 184.73.155.222/32 etc

Related

How do I add an ip range to aws?

I haven't found anything that details out how to add a range through the AWS portal. I have a range of salesforce ids that I need to add. When i set the server to only allow from specific ids I'm unable to reach the server by adding the basic single addresses. I found an address in the first range which allowed traffic, but when I've restricted access to only the listed ips I'm unable to ping salesforce from the server. I have all outbound traffic allowed. Also, when I allow all traffic, I am able to ping in both directions. I have very limited network experience, so any help is appreciated. Here is an example of the first ARIN range 13.108.0.0 - 13.111.255.255
If you have a range like 13.108.0.0 - 13.111.255.255 first convert that to a CIDR range using a web site that can do the conversion: wmtips
Then add the CIDR address to the inbound rules of the security group attached to your EC2 (Make sure the correct protocol is selected). This is to allow access for the remote system. Set the outbound rules on the security group to 0.0.0.0/0.

Get IP with subnet mask for use with AWS EC2 SSH

When setting up an EC2 instance AWS Console has a useful feature to find your current IP address complete with subnet mask for whitelisting. Here is the UI I'm sure we have all seen.
This is convenient when you are setting it up but if you need to white list a remote DEV's home WIFI or you are using cloudformation it is not longer convenient to get the IP address this way.
So, is there a convenient way to print out your IP address complete with the subnet mask (/) from your terminal? I have not found one.
If you're on linux or mac it's fairly simple to do a ip addr show or assign to a variable with IP_ADDR=$(ip addr show).
On windows, there's a PowerShell module you can use.
Invoke-WebRequest ifconfig.me/ip
though that prints out more than just the IP, you can always parse it.
Ok, I realized I did not understand CIDR notation and subnet masking.
Basically AWS requires CIDR notation and CIDR notation allows you to specify a range of addresses. It works out that the /32 means a range of 0 so the address is everything to the left of the /.
So, to whitelist a single IP you say myIP/32

Not able to connect to EC2 instance from a different IP address

I have an EC2 instance that has an IPv4 filter for my IP Address only. However, I'd like a friend of mine to get access (who lives in another city). I currently maintain the IP Address filters on my management console.
I have UFW enabled (however, I limit UFW everywhere for the ssh port).
I added my friend's IP address in the AWS management console, but he's unable to access the server (we have checked all the pem files).
My questions:
Is there a limit on the number of IP addresses that I can enter using aws management console?
Is UFW clashing with management console here?
If I want to provide access to my friend, is there any other way (apart from VPN - We tried it, but we couldn't implement it)?
So troubleshooting stuff
1: Ask your friend check is IP address again is that static or not . http://whatismyipaddress.com/
2: Ask him to test using telnet command
telnet IPADDRESSOFSERVER 22
3: Check you setting again on security group it should be like SSH open to XX.XX.XX.XX/32 this is your friend IP address
let us know above results

How to get the IP address of RDS instance in AWS

I got the same answer everywhere on the internet regarding my question of how to get the IP address of an RDS instance in AWS, but I don't know what dig is, and how to use it.
How to allocate IP address in VPC to RDS instance?
Please help me find the IP address of my RDS instance in AWS?
It won't display the ip address on the configuration page for the RDS instance because RDS IP's are dynamic in nature. You can dig for them if you need them but you would be better server using the DNS endpoint for the instance. This remains static and can be found on the details tab of the RDS instance within AWS.
The IP address of your AWS instance will be the IP address of the RDS instance.
If your hostname of your AWS instance is blah.blah.amazonaws.com then you can use the dig command (on Linux machines) or ping command on both Windows and Linux to find out the IP address of the host:
ping blah.blah.amazonaws.com
This will give you back the IP address of the host (something like this):
c:\ping www.google.com
Pinging www.google.com [216.58.210.100] with 32 bytes of data:
Reply from 216.58.210.100: bytes=32 time=14ms TTL=58
Reply from 216.58.210.100: bytes=32 time=15ms TTL=58
Reply from 216.58.210.100: bytes=32 time=14ms TTL=58
So the IP address of www.google.com is 216.58.210.100. dig will give you more output but the IP address is also in there. But sometimes the actual IP address of your AWS instance is actually in the hostname itself. For example:
ip-12-34-56-78.us-west-2.compute.internal
The IP address 12.34.56.78 is already in the name (depending on your instance). You can find the hostname in the AWS Console/Dashboard.
Use this:
SELECT inet_server_addr();
Simple method to find RDS ip address: Open command prompt from local machine and ping your RDS Endpoint. You will see the reply from destination host ip address. That is your RDS ip address! Regardless if it is public accessible or not.
The answer given by Paolo Bolla is good, but only works for Postgresql.
For Microsoft SQL Server, please use:
SELECT
local_net_address = ConnectionProperty('local_net_address')
, local_tcp_port = ConnectionProperty('local_tcp_port')
You can also use Nslookup <<RDS SQL Server>> command to figure out the IP address as suggested in this AWS blog post.
dig is command-line utility that finds an IP address a domain name leads to.
You can simply install it using :
apt-get update && apt-get install dnsutils -y
Then to find an IP of RDS instance (with endpoint xxx.yyy.us-east-1.rds.amazonaws.com), run the following command :
dig xxx.yyy.us-east-1.rds.amazonaws.com
In the output of dig, you will be able to find IP address in ANSWER SECTION :
;; ANSWER SECTION:
xxx.yyy.us-east-1.rds.amazonaws.com. 5 IN A 172.30.1.253
As you can see RDS instance endpoint, resolved to A type of DNS record with Private IP address
On AWS Management Console - Location : AWS Management Console -> EC2 -> Network & Security, Network interfaces
You can see all of IP addresses and its resource's details on description tab together.

Sagepay Direct on AWS

I can't seem to be able to whitelist the correct IP ranges for use with Sagepay direct payment module.
I keep getting invalid response 4020 : Information received from an Invalid IP address.
The instance is a non VPC instance and it is able to talk outbound on the correct port (hence getting any response at all). It has a public IP address attached to it and I have whitelisted that in the sagepay backend.
The entry looks something like this
054.217.010.211 - 255.255.255.000
Any help with this would be greatly appreciated
4020 error - happens with a Server or Direct integration. Fixed IP recommended. If you've added the IP address and subnet mask to cover the range to MySagePay (Sage Pays admin portal) and still getting error, means we're not recognising the IP your posting from as the IP you have given.
Invalid Transactions within MySagePay, you should be able to see the IP we're recognising that you're posting from. Then add that IP to MySagePay.
Sage Pay may need to check that our internal IPs are registered against your account.
Sage Pay can add the IP ranges for you to your Sage Pay account if needed so you can check it resolves.