dual nic access to 2 networks

Posted on 2004-11-26
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
    LVL 3

    Accepted Solution

    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

    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

    OK, I lied LOL some more info on multi homed machines;EN-US;Q262397

    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

    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

    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

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
    Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now