I'm trying to setup an EC2 instance as NAT gateway of sorts that other instances in a private network will be routed to.
I have a following setup:
- A: 10.0.1.0/24
- B: 10.0.2.0/24
2 EC2 instances
- NAT instance with 2 network interfaces eth0, eth1, both in subnet A
- Another instance in subnet B
In the NAT instance, eth0 is meant for public network and eth1 for private and they have firewalls set accordingly.
I tried to create route table for subnet B that routes the default to eth1 of NAT, i.e.:
0.0.0.0/0 <id of eth1 on NAT>
Then I tried to run
tshark -i eth1 (Wireshark in command line) on NAT to see if any traffic is getting there and I ran
ping google.com on the other instance. With no success. I also tried
curl google.com just in case pings are blocked somewhere, but also nothing happened.
Looks like there is something wrong with the way AWS is routing the traffic so it never reaches the network interface even though the route table is set that way.
I'd appreciate if someone can help me with this. Thank you.
DISCLAIMER: I know that AWS has a built-in NAT gateway option and it's not suitable for my case.