Here you can do 2 things...
1. Use Iptables with proxy
2. Use proxy only
_________________________
If you are running this for office enviroment then you don't need a dns masquerading...,
Now you have to use Ip routing or NAT...
OR use squid proxy.. to use the caching... (very good proxy server)
Or use Transparent proxy..
_____________
Now to make linux gateway you have to use iptables...
See
http://www.linuxforum.com/forums
and also you can manage with transparent proxy..
which , i think is the best...