dual nic access to 2 networks

Posted on 2004-11-26
Medium Priority
Last Modified: 2009-02-13
How does an application decide which nic to go out when going to an external IP or network?

I have a home router going to internet with

I also have a home lab with 3 routers connected together and routing between them.  The ethernet networks on these 3 routers are:

Then I have an Windows XP home box w/ 2 nics.
Nic 1 is connected to default gateway is (router connected to and
Nic 2 is connected to default gateway is router connected to internet.

If I try and ping it fails.
If I disable Nic 2, then ping it works.

Why does it try to go out Nic 2?  How do I configure it to go out Nic 1 for and and go out Nic 2 for everything else?

Question by:gfarnham
  • 3

Accepted Solution

cagri earned 500 total points
ID: 12685819
Hi Gfarnham,

This is the routing table of windows XP deciding on which network to push packets throug. You can see your routing table via the command

route print
netstat -rn

on the command prompt.

Ok, as you may see from your output the list has 2 directly connected networks and and a DEFAULT route noted as

So you can reach two KNOWN networks and all packets for other directions are routed through the default network which is directing your Internet network.

Windows unable to get information about other networks unless you use a "routing protocol" (like RIP, OSPF) or enter them manually. The first is not a simple task on XP environment (needs extra software) and second is the way you shold follow.

Back to command prompt, type the commands:

route add mask
route add mask

Do a route print do confirm your setup

So you simply instruct your network stack to forward packets for and VIA

Thats it.

You may add the two lines in a start up script to avoid doing it every time.

Hope this helps.

LVL 41

Expert Comment

ID: 12686024
the only thing I might add to the good advoce above, is  you can use the -p switch to make the route persistent (to avoid the startup script or batch file)
LVL 41

Expert Comment

ID: 12686028
OK, I lied LOL some more info on multi homed machines


When two network adapters are present in a computer (multihomed), a default gateway should only be assigned

to one of the network adapter's TCP/IP properties. If one of the network adapters is used to connect

to the Internet, the default gateway should be assigned to that network adapter. In many cases, the

default gateway, as well as the other necessary TCP/IP information is assigned automatically by the

Internet Service Provider by using Dynamic Host Configuration Protocol (DHCP). This can be confirmed

by using the IP Configuration utility (Winipcfg.exe) to view the TCP/IP properties for the network adapter

you are using to connect to the Internet.

For the network adapter that is connected only to the Local Area Network (LAN), such as a home or corporate

network, a static routing entry must be entered into the computer's routing table if the computer needs

to obtain access to network resources across a router or multiple routers. For example, if the router

interface on the same subnet has an IP address of and the router is connecting the

network to a network, the following command would need to be entered either at a command

prompt within Windows or from a batch file:


This command instructs Windows to send all traffic that is destined for the network to the interface on the router. To verify that the ROUTE ADD command was successful, use the ROUTE

PRINT command to view the current routing table. If multiple routers are being used on the LAN segment,

a separate ROUTE ADD is needed for each router.

Note that the routing entry is not persistent in Windows 98/95, even with the -p switch, and is lost

after you restart the computer. To have this entry automatically added for every Windows session, create

a batch file with the necessary ROUTE ADD command(s) and place it in the Windows StartUp folder to be

executed each time Windows starts.

If DHCP is used to assign IP addresses on the LAN, the DHCP server should be configured to not provide

a default gateway.


Author Comment

ID: 12687237
Thank caqri, great answer.
stevenlewis, I used -p since I'm on XP probably is ok, your 2nd message says not supported in 98/95.
LVL 41

Expert Comment

ID: 12689942
It means the -p (persitent) switch is not supported in 9x, but the route add command is :-)
so you have to use a batch file on 9x and put it in the startup folder, and then it will run and add the routes on startup

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Migration of Exchange mailbox can be done with the ExProfre.exe tool. But at times, when the ExProfre.exe tool migrates the Exchange Server user profile, it results in numerous synchronization problems. Synchronization error messages appear in the e…
Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question