Using hosts file for dns and gateway

I know I can use the windows hosts file to resolve dns, but I have 2 gateways on my network and would like to send queries for a certain web site, out a certain gateway. Is this possible with the hosts file or is there another way?
So all http traffic out out
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If it is only a webpage you can set the hosts file with the correct domain name and the ip address you want.  

If as I'm understanding it you want to force a particular request down a particular GW you may need to setup a persistent route
something like (not 100% on the mask been /32)

route -p add mask

route print to see the current table.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
you can also do this at the network level with static routes on your network equipment. As a rule of thumb, you must have a default gateway which will handle all the traffic unless there is a rule that routes a specific address through a different path.
Depending what your equipment is, you would do this one way or another. For instance if you have Cisco routers, router A and router B. Let's say router A is your default gateway but you want to send traffic to a specific ip address through router b, you can add a static route on router A that says IP route X.X.X.X 255.X.X.X (IP address and mask of website) X.X.X.X ( IP address of router B)
Again is going to depend on your network equipment.
Also keep in mind that some websites have multipla ip addresses and you may not always connect to it using the same IP unless you force it to on you DNS  server or your hosts file.
Depending on how advanced your network is, the network devices (as in the case of Cisco and other routers) can utilize "Routing" protocols, such as RIP, EIGRP, OSPF and learn where different networks are on different interfaces, but this is something that your network department would normally take care of.

One last thing to bear in mind is that even if you put multiple gateways on a Windows XP machine, the machine will only use the first one in the list until its no longer valid, then it will fail over to the next gateway.  While this is how you might want the gateways to function, there is no method for it to fail back to the original gateway should that one become available again.  It will continue to use the current gateway until its no longer valid or the machine is rebooted (or the IP configureation is refreshed, as in an ipconfig /release and renew)
TuscolaCountyAuthor Commented:
Thanks for the replies, I am going to try the route -p add mask
this seems to be what we are looking for.

We know we can change and route traffic via the routers but I am looking for an easy way for only a few computers which are on a different subnet than the rest of our network users (200+)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.