Networking Forums

Networking Forums > Computer Networking > Windows Networking > Pick IP/NIC used to send UDP traffic

Reply
Thread Tools Display Modes

Pick IP/NIC used to send UDP traffic

 
 
Smedly Tonker
Guest
Posts: n/a

 
      10-26-2006, 06:46 PM
Is there any network Gurus out there that can answer the below question?



Question:

How in software can I specify that socket traffic only be sent using a
certain IP? Remember that binding to an address only grantees which IP the
traffic can come from and not how it is sent. From my description of the
problem below, it is not possible to mess with the route table as either one
instance of my server software will work and the other will fail. What is
needed is a way to grantee delivery using a certain IP at the socket level.



Description of problem:

I need to be able to run two instances of my server software on a server
(Windows Server 2003). I have two NICs within the server and should be able
to bind a listen socket on the same port for each IP address. I will bind
each listen socket to one of the two IP address. This will grantee that
incoming traffic will only be received by the designated NIC. It will not
however grantee which IP/NIC is used to send a UDP message. Messages must be
sent from the correct IP address or the corresponding ACKs will be received
by the wrong server instance. If each NIC has the same route metric than it
is a dice game on which will be used to send my UDP traffic.


 
Reply With Quote
 
 
 
 
Markus Humm
Guest
Posts: n/a

 
      10-26-2006, 06:58 PM
Hello,

I'd say this depends on your subnet configuration. Think about the NICs
being on different subnets, then there may only be one route.

Greetings

Markus
 
Reply With Quote
 
Skywing [MVP]
Guest
Posts: n/a

 
      10-26-2006, 07:03 PM
I don't think that there is any good documented way to override the routing
table with selecting which physical interface to send on with the default
Microsoft sockets provider in use. SO_DONTROUTE is, as far as I know,
ignored for Microsoft providers.

I think that the DHCP client service (in dhcpsvc.dll) used some undocumented
setsockopt and WSAIoctl calls to turn off routing for a UDP socket, but I'm
not sure if these are still used for modern OS's. You might try
disassembling a bit of dhcpsvc to find out.

--
Ken Johnson (Skywing)
Windows SDK MVP
http://www.nynaeve.net

"Smedly Tonker" <(E-Mail Removed)> wrote in message
news:u52ci8S%(E-Mail Removed)...
> Is there any network Gurus out there that can answer the below question?
>
>
>
> Question:
>
> How in software can I specify that socket traffic only be sent using a
> certain IP? Remember that binding to an address only grantees which IP the
> traffic can come from and not how it is sent. From my description of the
> problem below, it is not possible to mess with the route table as either
> one instance of my server software will work and the other will fail. What
> is needed is a way to grantee delivery using a certain IP at the socket
> level.
>
>
>
> Description of problem:
>
> I need to be able to run two instances of my server software on a server
> (Windows Server 2003). I have two NICs within the server and should be
> able to bind a listen socket on the same port for each IP address. I will
> bind each listen socket to one of the two IP address. This will grantee
> that incoming traffic will only be received by the designated NIC. It will
> not however grantee which IP/NIC is used to send a UDP message. Messages
> must be sent from the correct IP address or the corresponding ACKs will be
> received by the wrong server instance. If each NIC has the same route
> metric than it is a dice game on which will be used to send my UDP
> traffic.
>
>



 
Reply With Quote
 
Mike Lowery
Guest
Posts: n/a

 
      10-26-2006, 07:59 PM

"Smedly Tonker" <(E-Mail Removed)> wrote in message
news:u52ci8S%(E-Mail Removed)...
> Is there any network Gurus out there that can answer the below question?
>
>
>
> Question:
>
> How in software can I specify that socket traffic only be sent using a certain
> IP? Remember that binding to an address only grantees which IP the traffic can
> come from and not how it is sent. From my description of the problem below, it
> is not possible to mess with the route table as either one instance of my
> server software will work and the other will fail. What is needed is a way to
> grantee delivery using a certain IP at the socket level.
>
>
>
> Description of problem:
>
> I need to be able to run two instances of my server software on a server
> (Windows Server 2003). I have two NICs within the server and should be able to
> bind a listen socket on the same port for each IP address. I will bind each
> listen socket to one of the two IP address. This will grantee that incoming
> traffic will only be received by the designated NIC. It will not however
> grantee which IP/NIC is used to send a UDP message. Messages must be sent from
> the correct IP address or the corresponding ACKs will be received by the wrong
> server instance. If each NIC has the same route metric than it is a dice game
> on which will be used to send my UDP traffic.


You need to modify your route table. See
http://www.informit.com/articles/art...p?p=24375&rl=1.


 
Reply With Quote
 
Smedly Tonker
Guest
Posts: n/a

 
      10-26-2006, 08:31 PM
Did you read in my post why setting a route table entry would not work?
Assuming you did, but did not understand, the reason is that if these NICs
are on the same subnet and you give one IP/NIC a preference in the route
table, then all traffic by either server will be deliver from the IP/NIC. So
if a message is sent from server A then it might be delivered by server Bs
IP/NIC. This will cause my remote client to ACK server B and not server A.
As far as server A knows the message was not delivered.



"Mike Lowery" <(E-Mail Removed)> wrote in message
news:uTozOlT%(E-Mail Removed)...
>
> "Smedly Tonker" <(E-Mail Removed)> wrote in message
> news:u52ci8S%(E-Mail Removed)...
>> Is there any network Gurus out there that can answer the below question?
>>
>>
>>
>> Question:
>>
>> How in software can I specify that socket traffic only be sent using a
>> certain IP? Remember that binding to an address only grantees which IP
>> the traffic can come from and not how it is sent. From my description of
>> the problem below, it is not possible to mess with the route table as
>> either one instance of my server software will work and the other will
>> fail. What is needed is a way to grantee delivery using a certain IP at
>> the socket level.
>>
>>
>>
>> Description of problem:
>>
>> I need to be able to run two instances of my server software on a server
>> (Windows Server 2003). I have two NICs within the server and should be
>> able to bind a listen socket on the same port for each IP address. I will
>> bind each listen socket to one of the two IP address. This will grantee
>> that incoming traffic will only be received by the designated NIC. It
>> will not however grantee which IP/NIC is used to send a UDP message.
>> Messages must be sent from the correct IP address or the corresponding
>> ACKs will be received by the wrong server instance. If each NIC has the
>> same route metric than it is a dice game on which will be used to send my
>> UDP traffic.

>
> You need to modify your route table. See
> http://www.informit.com/articles/art...p?p=24375&rl=1.
>
>



 
Reply With Quote
 
Mike Lowery
Guest
Posts: n/a

 
      10-27-2006, 03:34 PM
Then your design is faulty. You shouldn't have both NICs on the same subnet.
Windows gets confused by this as explained here:
http://support.microsoft.com/kb/175767

"Smedly Tonker" <(E-Mail Removed)> wrote in message
news:uWKIq3T%(E-Mail Removed)...
> Did you read in my post why setting a route table entry would not work?
> Assuming you did, but did not understand, the reason is that if these NICs are
> on the same subnet and you give one IP/NIC a preference in the route table,
> then all traffic by either server will be deliver from the IP/NIC. So if a
> message is sent from server A then it might be delivered by server Bs IP/NIC.
> This will cause my remote client to ACK server B and not server A. As far as
> server A knows the message was not delivered.
>
>
>
> "Mike Lowery" <(E-Mail Removed)> wrote in message
> news:uTozOlT%(E-Mail Removed)...
>>
>> "Smedly Tonker" <(E-Mail Removed)> wrote in message
>> news:u52ci8S%(E-Mail Removed)...
>>> Is there any network Gurus out there that can answer the below question?
>>>
>>>
>>>
>>> Question:
>>>
>>> How in software can I specify that socket traffic only be sent using a
>>> certain IP? Remember that binding to an address only grantees which IP the
>>> traffic can come from and not how it is sent. From my description of the
>>> problem below, it is not possible to mess with the route table as either one
>>> instance of my server software will work and the other will fail. What is
>>> needed is a way to grantee delivery using a certain IP at the socket level.
>>>
>>>
>>>
>>> Description of problem:
>>>
>>> I need to be able to run two instances of my server software on a server
>>> (Windows Server 2003). I have two NICs within the server and should be able
>>> to bind a listen socket on the same port for each IP address. I will bind
>>> each listen socket to one of the two IP address. This will grantee that
>>> incoming traffic will only be received by the designated NIC. It will not
>>> however grantee which IP/NIC is used to send a UDP message. Messages must be
>>> sent from the correct IP address or the corresponding ACKs will be received
>>> by the wrong server instance. If each NIC has the same route metric than it
>>> is a dice game on which will be used to send my UDP traffic.

>>
>> You need to modify your route table. See
>> http://www.informit.com/articles/art...p?p=24375&rl=1.
>>
>>

>
>



 
Reply With Quote
 
Pavel A.
Guest
Posts: n/a

 
      10-27-2006, 05:05 PM
For a quick and 100% robust solution, try a virtual machine.
Bind it's NIC to your other physical NIC, and run the 2nd instance
of your server in the VM.

--PA

"Smedly Tonker" wrote:
> Is there any network Gurus out there that can answer the below question?
>
>
>
> Question:
>
> How in software can I specify that socket traffic only be sent using a
> certain IP? Remember that binding to an address only grantees which IP the
> traffic can come from and not how it is sent. From my description of the
> problem below, it is not possible to mess with the route table as either one
> instance of my server software will work and the other will fail. What is
> needed is a way to grantee delivery using a certain IP at the socket level.
>
>
>
> Description of problem:
>
> I need to be able to run two instances of my server software on a server
> (Windows Server 2003). I have two NICs within the server and should be able
> to bind a listen socket on the same port for each IP address. I will bind
> each listen socket to one of the two IP address. This will grantee that
> incoming traffic will only be received by the designated NIC. It will not
> however grantee which IP/NIC is used to send a UDP message. Messages must be
> sent from the correct IP address or the corresponding ACKs will be received
> by the wrong server instance. If each NIC has the same route metric than it
> is a dice game on which will be used to send my UDP traffic.
>
>
>

 
Reply With Quote
 
Michael K. O'Neill
Guest
Posts: n/a

 
      10-27-2006, 05:37 PM

"Mike Lowery" <(E-Mail Removed)> wrote in message
news:%23BC2b1d%(E-Mail Removed)...
> Then your design is faulty. You shouldn't have both NICs on the same

subnet.
> Windows gets confused by this as explained here:
> http://support.microsoft.com/kb/175767
>


Interesting; thanks for this link.

So, if one computer has two adapters connected to the same physical network,
how should they be configured, and can this be accomplished with DHCP?


 
Reply With Quote
 
Bill Grant
Guest
Posts: n/a

 
      10-27-2006, 10:59 PM
No, you can't really do that with DHCP. When a machine starts, the NIC
sends a broadcast on the wire to find a DHCP server. The server will send
back an offer of an IP from the scope which matches the IP subnet where the
broadcast was received.

If two NICs are on the same Ethernet segment they will always get IP
addresses in the same IP subnet, because the request will always arrive
directly at the same NIC on the DHCP server.

What exactly do you want these two NICs to do?

"Michael K. O'Neill" <(E-Mail Removed)> wrote in message
news:eJMwZ6e%(E-Mail Removed)...
>
> "Mike Lowery" <(E-Mail Removed)> wrote in message
> news:%23BC2b1d%(E-Mail Removed)...
>> Then your design is faulty. You shouldn't have both NICs on the same

> subnet.
>> Windows gets confused by this as explained here:
>> http://support.microsoft.com/kb/175767
>>

>
> Interesting; thanks for this link.
>
> So, if one computer has two adapters connected to the same physical
> network,
> how should they be configured, and can this be accomplished with DHCP?
>
>



 
Reply With Quote
 
Arkady Frenkel
Guest
Posts: n/a

 
      10-28-2006, 10:27 AM
Or use IPHLPAPI to change forwarding on the fly
Arkady

"Pavel A." <(E-Mail Removed)> wrote in message
news:7911158D-5075-494D-8069-(E-Mail Removed)...
> For a quick and 100% robust solution, try a virtual machine.
> Bind it's NIC to your other physical NIC, and run the 2nd instance
> of your server in the VM.
>
> --PA
>
> "Smedly Tonker" wrote:
>> Is there any network Gurus out there that can answer the below question?
>>
>>
>>
>> Question:
>>
>> How in software can I specify that socket traffic only be sent using a
>> certain IP? Remember that binding to an address only grantees which IP
>> the
>> traffic can come from and not how it is sent. From my description of the
>> problem below, it is not possible to mess with the route table as either
>> one
>> instance of my server software will work and the other will fail. What is
>> needed is a way to grantee delivery using a certain IP at the socket
>> level.
>>
>>
>>
>> Description of problem:
>>
>> I need to be able to run two instances of my server software on a server
>> (Windows Server 2003). I have two NICs within the server and should be
>> able
>> to bind a listen socket on the same port for each IP address. I will bind
>> each listen socket to one of the two IP address. This will grantee that
>> incoming traffic will only be received by the designated NIC. It will not
>> however grantee which IP/NIC is used to send a UDP message. Messages must
>> be
>> sent from the correct IP address or the corresponding ACKs will be
>> received
>> by the wrong server instance. If each NIC has the same route metric than
>> it
>> is a dice game on which will be used to send my UDP traffic.
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pick one, please: Travis McGee Wireless Internet 2 06-29-2007 01:47 AM
Want to send traffic between two NICs Asif Linux Networking 3 06-07-2007 06:23 PM
pick up your free gift here Alfred Shofolahan Linux Networking 0 12-26-2006 11:04 PM
Please help me pick out a router RJP Wireless Networks 3 02-06-2005 03:37 AM
Send IP traffic to own IP address over first router/gateway Achim Linux Networking 3 06-29-2004 12:21 PM



1 2 3 4 5 6 7 8 9 10 11