If I understand your question, correctly, you have a network of systems and you wish to restrict Internet access to only two machines. The answer depends on your network setup, in particular:
1) Do you have a DHCP server which assigns addresses to all systems? If so,
2) Are the IP addresses for the two systems randomly chosen or reserved?
3) Do any or all systems reference the Internet gateway as their default router?
Iptables references machines using IP addresses. If those machines are assigned an address via DHCP (and IP addresses are not reserved for them) their IP address can change. It is easier to configure iptables if the IP addresses do not change, either via a static configuration or by reserving the address in the DHCP server.
At a minimum, you will need to configure the Internet gateway for NAT. This web page has a lot of extra info, but it is very good:
http://iptables-tutorial.frozentux.net/iptables-tutorial.htmlPost additional info regarding the above questions if you need more help.
Daniel