How do I configure NAT to forward external requests?

1

I have three Raspberry Pi's connected to Linux machines and one computer (also a Linux machine) connected to a router which is connected to the Internet. My goal is to configure each Raspberry Pi and the main computer so that they can communicate directly with each other, but also automatically route any Internet requests through the main computer's router so I can ping actual websites and get a response.

So far, I have used:

sudo ifconfig eth0 192.168.1.X netmask 255.255.255.0 up
sudo route add default gw 192.168.1.254 eth0

Where X is 10, 11, and 12 respectively for the Raspberry Pi Linux machines. The IP address of the machine with access to the Internet is 192.168.1.254, but I now need to configure NAT so that the IP tables properly forward Internet requests from the Linux machines using the Raspberry Pi's.

As of now, the IP table of the Internet-connected machine is:

Kernel IP routing table
Destination   Gateway       Genmask        Flags    Metric    Ref    Use   Iface
192.168.0.0   *             255.255.255.0  U        1         0      0     eth1
default       192.168.0.1   0.0.0.0        UG       0         0      0     eth1

Currently, all four of the machines can ping each other and get responses. The only issue I'm facing is getting the three Linux machines to ping websites like this ping www.google.com.

I'm pretty sure I have the subnets properly configured, but I need help figuring out how to configure the default gateways and configuring the routing machine as a router. I don't know if I need to do anything with DNS, but if I do please let me know. Thanks.

weskpga

Posted 2013-11-17T07:25:34.513

Reputation: 123

No answers