# Win7 Routing Traffic Between NICs



## poppin (Mar 21, 2012)

So heres the deal. 
I want to route traffic from nic 2(192.168.2.1) to nic 1(192.168.1.1). 
In lame terms route the traffic from 192.168.2.10(gateway 192.168.2.1) to 192.168.135(192.168.1.1). 
I know how to use the route command in CMD. 
So how would I get the traffic from 192.168.2.10 to 192.168.1.135? 
I'm just not sure how I would do that with the route command. 
I've tried
Code:
route -p add 192.168.1.135 mask 255.255.255.0 192.168.1.1 IF 12
Also tried like 5 different ways!! lol

The IF 12 is my NIC 2. Can someone help me?(also I couldn't find a networking section)


----------



## poppin (Mar 21, 2012)

It seems nobody has a knowledge of this...


----------



## Shekka (Jan 6, 2012)

It takes time for us to respond. We are all *volunteers*, and do this in our spare time.


I believe it should look like this:

route -p add 192.168.2.10 mask 255.255.255.0 192.168.1.135

This will send the traffic from 192.168.2.10 to 192.168.1.135

You don't have to specify a metric, windows will enter a default.
You could also enter it like this:

route -p add 192.168.2.0 mask 255.255.255.0 192.168.1.0

This will take a little longer but will span the whole spectrum.
MS article below.
Microsoft Corporation


----------



## smartguykkd (Oct 8, 2010)

gust give the command like

route add 192.168.1.0 mask 255.255.255.0 192.168.2.1


----------



## poppin (Mar 21, 2012)

Thanks for your replies D Sorry for jumping the gun. I now understand the route command but I routed traffic from 192.168.2.1 > 192.168.1.135 and 192.168.1.135 > 192.168.2.1 and I didn't get a response on the second NIC.
Then i tried 192.168.2.0 > 192.168.1.0 and 192.168.1.0 > 192.168.2.0 and everything still only responds on 192.168.1.135(NIC A)
If you have the time. Could you explain how I would use route to make a web server respond on 2 external ips? All ports are forwarded its a matter of routing the traffic from NIC B(192.168.2.10|192.168.2.1) to the server on ip 192.168.1.135(server binds to this ip.) Is this called a multi-homed server? I really need to get this to work. Thanks in advance.


----------



## Shekka (Jan 6, 2012)

Ok maybe we should start over.

What is it exactly that you are trying to accomplish? What type of server / software are you using?


----------



## poppin (Mar 21, 2012)

I have a web server that can only bind to a single local ip for instance;
192.168.1.135(NIC A) and doesn't respond on the 192.168.2.10(NIC B).
What I want to do is have it respond on both adapters(two different Internets) 
What I believed was possible is to route; 
the traffic from 192.168.2.10 to 192.168.1.135 and also on the other end. 

I can't seem to properly route the traffic to make them respond on both networks. If you could somehow explain to me what i'm doing wrong or give me an example of one end route command once i understand the example i can do the other end myself i believe.


----------



## Shekka (Jan 6, 2012)

poppin said:


> I have a web server that can only bind to a single local ip for instance;
> 192.168.1.135(NIC A) and doesn't respond on the 192.168.2.10(NIC B).
> What I want to do is have it respond on both adapters(two different Internets)


So these systems are in two different locations with two different Internet connections?

Or do you have two nics in one computer and both go to different modems/routers for Internet?


----------



## poppin (Mar 21, 2012)

Its a dual NIC. So there is only one server tower and 2 internet connections in which would like the server to respond to. So yes two modems and 1 computer.


----------



## Shekka (Jan 6, 2012)

poppin said:


> Its a dual NIC. So there is only one server tower and 2 internet connections in which would like the server to respond to. So yes two modems and 1 computer.


Why two Internet connections? Are you trying to speed you Internet up by using two different connections?

I think what you actually need is a dual WAN router.


----------



## poppin (Mar 21, 2012)

No I'm not trying to speed up anything I am trying to create DDoS protection for my server so we have a fallback ip just in-case a network starts to get flooded.
I only what the server accessible on both external ips. And Yes, I have already port-forwarded correctly. 
Its a matter of getting the server to respond because it can only bind to one ip address I need to somehow route the traffic to 192.168.1.135(NIC A) so that the server is available on both IPs. Are you able to help me?


----------



## poppin (Mar 21, 2012)

So getting a dual wan router would completely destroy the point of having two separate internet connections for DDoS protection. Is what i'm trying to do possible because i have gotten the server to respond on both NICs but it will never use the right NIC for the main IP. So i figured with the route command i might be able to get around that.


----------



## poppin (Mar 21, 2012)

So Shekka do you happen to have any knowledge about this scenario?


----------



## tech_soul8 (Mar 23, 2012)

I'm not shure if i get it wright becouse it is a little bit messy explanation or it is becouse i just woked up wright now  
First of all is this second nic 192.168.1.135 connected directly to modem?


----------



## Shekka (Jan 6, 2012)

Poppin, I am gonna ask for some assistance on this. 

If I am understanding this correctly, you want to route NIC 1 to NIC 2 then route NIC 2 back to NIC 1. In my mind this is just going to create a infinite loop. 

But I will ask and we will see. 

It might take a while before they can come and read it, so please be patient.


----------



## poppin (Mar 21, 2012)

Alright  And for the infinite loop, all i want is the server to respond on both adapters but it binds to a single IP is there a way to route both NIC A and NIC B to a new created ip? It seems what i was saying wasn't quite logical but this way makes more sense.


----------



## poppin (Mar 21, 2012)

tech_soul8 said:


> I'm not shure if i get it wright becouse it is a little bit messy explanation or it is becouse i just woked up wright now
> First of all is this second nic 192.168.1.135 connected directly to modem?


 It was quite a messy explanation sorry. I just need the server to bind to a local IP that is connected to NIC A and NIC B, for response on both adapters some how.....
Edit: Both adapters are connect directly to a router that has internet access.


----------



## tech_soul8 (Mar 23, 2012)

Well if I'm getting you wright I'm affraid that's impossible.
Let's go from the beggining. You have modem which have external public ip address. On your win 7 machine you setup web server and you got 2 nic's. You make port forward from modem to your win 7's nic adapter 1 192.168.1.1. If you don't have public ip address from your ISP (and you probably don't becouse you're forwarded traffic to your nic 1) I suppose that you're connected to the internet by nat. Modem actually does nat mapping for you. What is nat? Nat is tehnology that allows yor computers from private ip addresses to communicate on internet by converting them to public ip address and than maps that conversion into nat table. What happens when some computer from the internet want's to communicate with your web server. It sends request to your modem and than modem forwards traffic to your nic 1 (becouse you opened that port). So traffic comes directly to nic 1 and there's no need to forward it somewhere else (and I think it's impossible too). I suppose you installed IIS on win 7. And at the end routing isn't involved here at all on your win 7 machine becouse both nic are on the same computer. I'm using Linux and there's possibility to configure iptables to forward traffic from one nic to other but I don't think that win 7 is capable of doing so. At the end win 7 insn't the smartest solution for setting up web server. You should get your self linux or some server product from microsoft if you ask me 

Hope I helped


----------



## poppin (Mar 21, 2012)

I have two ISPs and I want to have my server respond on BOTH external ips. I have NIC 1 connected to internet 1 and NIC 2 connected to internet 2 i want to somehow route incoming traffic to a single ip(possibly virtual adapter or maybe theres a way to do it with a gateway and some route commands but i've tried using the gateway but it wont respond on both ips when i try to use the metric 1 gateway for NIC 1 but when i set it to 2 when the server is already binded it responds on both but uses the secondary gateway instead of the main gateway)


----------



## TheCyberMan (Jun 25, 2011)

I think you are wanting failover so when one nic goes down it automatically switches to the other nic the server editions offer this windows 7 does not have this built in and won't handle this as shekka says it is going to an infinite loop.


----------



## tech_soul8 (Mar 23, 2012)

poppin said:


> I have two ISPs and I want to have my server respond on BOTH external ips. I have NIC 1 connected to internet 1 and NIC 2 connected to internet 2 i want to somehow route incoming traffic to a single ip(possibly virtual adapter or maybe theres a way to do it with a gateway and some route commands but i've tried using the gateway but it wont respond on both ips when i try to use the metric 1 gateway for NIC 1 but when i set it to 2 when the server is already binded it responds on both but uses the secondary gateway instead of the main gateway)


Well what you don't understand that there is no need for traffic to be routed. Your pc is final destination for packets that is incoming your network. Let me explain that to you. Someone on the internet wants to communicate with your server. It sends request to your ip (what ever it is) and that packet (SYN packet) reaches your modem, modem forwards traffic with packet destined to your web server. When web server recives incoming packet that's it. It will responde with SYN,ACK packet or discard packet. No further processing is needed becouse your WIN 7 is final destination. What you need to done is next. If you have to public ips and one web server than you must put gateway/firewall between yor modem and server. On gateway you sholud have at least 3 nics. Two nics which will be connected with modem public ips and one for the server. Than you route all incoming traffic from gateway nics to the web server. But if you got two nics on server than you bind one to one public ip (internet 1) and the other one to internet 2 and that's it. 

What about metrics? Metric is the value which specifies how far is the network destination from the interface which it is connected to. So for example if you got two routes to the same destination you could specify one with the lower metric and than interface with lower metric becomes preferred one. Otherwise router doesn't look at it at alll (if there is no two or more paths to the sam destination) That's the reason why server responded from other gateway when you changed the metric becouse other interface became preferred one.


----------



## poppin (Mar 21, 2012)

tech_soul8 said:


> Well what you don't understand that there is no need for traffic to be routed. Your pc is final destination for packets that is incoming your network. Let me explain that to you. Someone on the internet wants to communicate with your server. It sends request to your ip (what ever it is) and that packet (SYN packet) reaches your modem, modem forwards traffic with packet destined to your web server. When web server recives incoming packet that's it. It will responde with SYN,ACK packet or discard packet. No further processing is needed becouse your WIN 7 is final destination. What you need to done is next. If you have to public ips and one web server than you must put gateway/firewall between yor modem and server. On gateway you sholud have at least 3 nics. Two nics which will be connected with modem public ips and one for the server. Than you route all incoming traffic from gateway nics to the web server. But if you got two nics on server than you bind one to one public ip (internet 1) and the other one to internet 2 and that's it.
> 
> What about metrics? Metric is the value which specifies how far is the network destination from the interface which it is connected to. So for example if you got two routes to the same destination you could specify one with the lower metric and than interface with lower metric becomes preferred one. Otherwise router doesn't look at it at alll (if there is no two or more paths to the sam destination) That's the reason why server responded from other gateway when you changed the metric becouse other interface became preferred one.


Thanks for the review of what I already knew. Also your miss understanding somewhere. I have 2 separate Internets and NIC 2 has packets stopping 192.168.2.10 because the server is binded to NIC A. I just want it accessible from both external IPs(two different internet gateways). With a network bridge I got it to respond on both externals but when i changed it from 192.168.2.1(was metric 1) as the default gateway to 192.168.1.1(was metric 2). I reversed the metric values and that made it respond only on NIC 1 gateway. That is frustrating. Thanks for trying but, I know some how this is possible. I want it to be configured to use NIC 1 as the main gateway. Even though you say its not possible with route, i think it is especially with a virtual adapter or an internal IP of some sort anyways. Anyways with the ability of computers these days turning a computer into a router is easy, so i figured it might be possible. Looks like i'm getting windows server 2008 .


----------



## tech_soul8 (Mar 23, 2012)

Ok let's go from the beggining  I just wanna help if you're not gave up already  The easyest way for me to troubleshoot this kind of problems is to made a skatch of network on a pice of paper so lets start:

You have two modems? Tell as the addresses of those two modems public and private (doesn't need to be real ips you are using)

Modem 1 - ?
Modem 2 -?

You have one win 7 machine with two nics? How they are setup (tell as so we don't need to search through entire thread)

nic one address - ?
nic two address - ?

and default gateways on those two nics  Another question can you log in throug terminal or web browser to your modem/s?

And one final note: Win xp, vista, 7...they don't support packet forwarding by default. You need to hack your registry to enable it but you have to be aware of licence vioaltion if you decide to do so


----------



## tech_soul8 (Mar 23, 2012)

And you have to tell us which ip addresses are on win 7 machine? Because I don't understand where is 192.168.2.10 located iff you have only two nics on win 7?? It could be just the modem am I wright?


----------



## Shekka (Jan 6, 2012)

poppin said:


> Thanks for the review of what I already knew. Also your miss understanding somewhere. I have 2 separate Internets and NIC 2 has packets stopping 192.168.2.10 because the server is binded to NIC A. I just want it accessible from both external IPs(two different internet gateways). With a network bridge I got it to respond on both externals but when i changed it from 192.168.2.1(was metric 1) as the default gateway to 192.168.1.1(was metric 2). I reversed the metric values and that made it respond only on NIC 1 gateway. That is frustrating. Thanks for trying but, I know some how this is possible. I want it to be configured to use NIC 1 as the main gateway. Even though you say its not possible with route, i think it is especially with a virtual adapter or an internal IP of some sort anyways. Anyways with the ability of computers these days turning a computer into a router is easy, so i figured it might be possible. Looks like i'm getting windows server 2008 .


Getting a server OS is the best option in the end. Client OS's just aren't designed for what you are trying to achieve. 

Good luck.


----------



## poppin (Mar 21, 2012)

delete this single reply


----------



## poppin (Mar 21, 2012)

-NIC A(ip:192.168.1.135|GW:192.168.1.1)------R1(192.168.1.1)--OUT modem isp #1
Server
-NIC B(ip:192.168.2.10|GW:192.168.2.1)-------R2(192.168.2.1)--OUT modem isp #2

The server i'm trying to use binds to a local ip either 192.168.1.135 or 192.168.2.10(I've tried setting 0.0.0.0).

What I have tried is bridging NIC A and NIC B and the server binds to NIC A and then I put the metric for gateway 192.168.2.1(NIC B) to 1 and the server responds on both ips but contacts master server list through NIC B not A but I want it to use NIC A to contact master server so I'm going to try to do this completely the opposite and hopes of an opposite effect.

Edit: I have local web access to BOTH routers.
Also are you stating that route commands in Win7 don't work unless I edit an registry value?


----------



## TheCyberMan (Jun 25, 2011)

Windows 7 does not have routing between nics built in and can't handle it.

Windows server 2008 does thru RRAS.


----------

