It would be 10 times easier to use a cheap store bought wired router. But if you wish to use the machine as a router then this should help in details of settings.
This is what I would do. First get eth0 on the one connected to the modem working. Configure and the machine can connect and browse the internet.
Now for eth1 on the same machine set the following info.
Netmask or Subnet 255.255.255.0
Do not set a gateway on this interface. Iptables and masquerading will handle that for you.
On the 2nd machine
DNS same as the one you set on the machine one router.
Now go here and and answer the questions to setup a router/firewall configuration. http://easyfwgen.morizot.net/gen/
Save the script it generates to a file called firewall.sh. Place the file in /etc
Make the file executable using this command as root. ' /sbin/chmod +x /etc/firewall.sh '.
Execute the firewall script as root ' ./firewall.sh '.
Now test machine 2 to connect to the internet. If not try pinging 192.168.1.1 and see if it responds. If it does then ping google 18.104.22.168. If that works then you have an issue with DNS IP settings.
Get the above working and then you can setup samba or nfs or other tools to transfer files and share printers or whatever.