0

I have a private M2M GSM network for my company devices. I want to send traffic from my devices to AWS IOT but the M2M provider doesn't allow internet access from its sim cards, it only provide an IPSec connexion to a a private network.

I had now problem configuring the IPSec connexion to an AWS VPC and my sims can successfully ping all instance in my AWS VPC. However what I want is for my sims to access AWS IOT.

What I did:

  1. I configured my VPN with AWS third scenario. I have a public network with CIDR 192.168.0.0/24 and a private network with CIDR 192.168.1.0/24. My VPN has a static route CIDR 10.1.128.0/14 for my M2M network.
  2. Then I launched an EC2 Nat Instance inside my public network.
  3. I added a routing rule to my VPC main routing table to route trafic to 0.0.0.0/0 to my NAT instance.
  4. I launched an EC2 instance in my VPC's private network and try to access internet from it, this work and I can see trafic going throung my nat instance. So I assume my nat and routing is well configured.

However I still can't manage to access internet from my sim cards, traffic isn't even routed to my NAT instance. According to John Rotenstein's answer VPN traffic will not use my routing rule.

Does AWS VPN drop traffic which is not destinated to the VPC's or VPN's CIDR ? Is there a security reason for that ? If that's the case is there a way to customize routing rules for the VPN's traffic ? Or is the only solution to use a custom VPN within an EC2 instance ?

Thank you for your help.

Romaric
  • 186
  • 10
  • You can enable AWS Flow Log (VPC or subnet) to capture traffic details to your VPN and out. This will give you a clear insight for you to see what is happening under the hood. – S.N Apr 17 '18 at 10:19
  • Hi, thank you for your help. I enabled Flow logs for my VPC like you said. After that I tried to ping directly an EC2 instance from one of my sim and see the accepted packet in Flow Log. However when I try to ping 8.8.8.8 for instance I have no log recorded. So I guess that mean packets to internet are droped on the virtual private gateway, before entering the VPC. – Romaric Apr 17 '18 at 12:18

1 Answers1

0

I added a routing rule to my VPC main routing table to route trafic to 0.0.0.0/0 to my NAT instance.

It is an understandable misconception that the "main" route table of a VPC impacts traffic coming in from a VPC hardware VPN. It doesn't. There is no route table that applies to such traffic, only the implicit target of the VPC subnets. Only the assigned CIDR blocks can be reached from such a VPN.

Does AWS VPN drop traffic which is not destinated to the VPC's or VPN's CIDR? Is there a security reason for that?

Yes, that traffic is dropped.

It probably not specifically for security reasons... it's just the way the service was designed to work. Managed VPN connections are intended for access to instance-based services, and don't support traffic flows we might generally categorize as gateway, edge-to-edge, peering, or transit.

If you can configure your edge devices to use a web proxy, then a forward proxy server like squid could handle the connectivity for the devices, because the IP path between a device and a forward proxy is a connection involving only the device and proxy IPs.

A simpler solution would be to use an instance-based firewall to terminate the VPN, instead of the built-in VPC VPN service, because then the firewall instance could allow the traffic to hairpin through itself, source-masquerading (NAT) the traffic behind its own EIP, and this would be something the VPC infrastructure easily supports.

An instance-based firewall is something you can build yourself, of course, but there are also several products in the AWS Marketplace that provide IPSec tunnel termination and NAT capability. Some have free trial periods where the only cost is the cost of the instance.

Michael - sqlbot
  • 169,571
  • 25
  • 353
  • 427
  • Thank you for your answer, this does clear a lot of things and confirm my observations. I thought about a proxy and I will probably go for something like that to get a solution like [Soracom Beam](https://soracom.io/en/services/beam/). Thank you for your suggestions. – Romaric Apr 17 '18 at 12:51