Score:0

Can't connect to EC2 SSH via Private IP

us flag

I was earlier able to SSH to the EC2 instance via the Private IP address of the instance using OpenVPN.

But, recently I changed my internet provider and after that, I cannot connect to particular EC2 instances whose instances are in the range of local IPv4. For example:

  1. Can't connect to 192.168.1.x (ec2 private IP) and local ipv4 is 192.168.1.8
  2. Can connect to 192.168.5.x (ec2 private IP) and local ipv4 is as above. To test further, I changed the wifi connection to my mobile's hotspot and it again started to work. I checked the local IPv4 for the hotspot on my laptop, it was 192.168.76.x.

I am not a network expert but I am guessing that this issue may be due to the local ipv4 address.

Any idea how to resolve this?

Score:1
br flag

Yeah, your subnets are overlapping. Your local router is in subnet 192.168.1.0/24 and thus when you want to reach 192.168.1.x it looks for it on the local network. But it isn't there so you cannot connect to it. When you want to connect to 192.168.5.x it will work because your router knows that it has to route the traffic through the VPN gateway to reach it. So the easiest solution to the problem is to change the DHCP address pool of your local router and change its address as well. Instructions on how to do that are pretty vendor specific but you should be able to find them when googling for the model or just have a good look around the admin panel. If that is for whatever reason not an option, you are pretty much stuck with either changing the IPs of your EC2 instances or working with NAT and port forwarding...

Tim P avatar
af flag
For some ISP provided routers, OP will need to use their IPS's portal to change the subnet used locally, if it is offered as a configuration option.
Tim P avatar
af flag
If SSH access is all that is needed (not SCP), System Center Connection manager is another option that does not require network changes.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.