Creating a Nat Server From Scratch in an AWS Cloud setup.
1.)Start a t1.micro instance
2.)Disable "Change Source / Dest Check", You can get the option by right clicking the instance and selecting the "Change Source / Dest Check option .
3.)Make sure the Security Group Created is able to pass all the needed IP's and port.
4.)Configuring the Nat Server.
Edit and make the net.ipv4.ip_forward entry in the /etc/sysctl.conf to 1 to enable it if its disabled.
>>echo 1 > /proc/sys/net/ipv4/ip_forward
>>>sed -i "s/net.ipv4.ip_forward.*/net.ipv4.ip_forward = 1/g" /etc/sysctl.conf
cat /etc/sysctl.conf |grep net.ipv4.ip_forward
net.ipv4.ip_forward = 1
Add the following rules to iptables .After the command >>iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE .
This command is to route all the connections which reaches eth0 to all the available paths.
-A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
-A FORWARD -i eth0 -j ACCEPT
the Ports 80 and 443 are added so that the server updates in the private cloud can be done through the nat instance
Using the Nat instance as connection to Outer World for the Private Cloud.
Configure the default Route table to pass all the connection ie 0.0.0.0/0 to the Nat instance.
And configure the Route table of the Nat instance to pass all the connection ie 0.0.0.0/0 to the Internet gateway.