?
Solved

dual nic access to 2 networks

Posted on 2004-11-26
5
Medium Priority
?
1,433 Views
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 192.168.1.0/24

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

Then I have an Windows XP home box w/ 2 nics.
Nic 1 is connected to 192.168.24.0/24 default gateway is 192.168.24.1 (router connected to 192.168.20.0 and 192.168.101.0)
Nic 2 is connected to 192.168.1.0/24 default gateway is 192.168.1.1 router connected to internet.

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

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

0
Comment
Question by:gfarnham
  • 3
5 Comments
 
LVL 3

Accepted Solution

by:
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
or
netstat -rn

on the command prompt.

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

So you can reach two KNOWN networks and all packets for other directions are routed through the default network 0.0.0.0 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 192.168.101.0 mask 255.255.255.0 192.168.24.1
route add 192.168.20.0 mask 255.255.255.0 192.168.24.1

Do a route print do confirm your setup

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

Thats it.

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

Hope this helps.


0
 
LVL 41

Expert Comment

by:stevenlewis
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)
0
 
LVL 41

Expert Comment

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



http://support.microsoft.com/directory/article.asp?ID=KB;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 192.168.1.1 and the router is connecting the 192.168.1.0

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

prompt within Windows or from a batch file:

ROUTE ADD 201.115.1.0 MASK 255.255.255.0 192.168.1.1

This command instructs Windows to send all traffic that is destined for the 201.115.1.0 network to the

192.168.1.1 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.


0
 

Author Comment

by:gfarnham
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.
0
 
LVL 41

Expert Comment

by:stevenlewis
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
0

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