Re: sending to same dest via different interfaces

2014-03-05 Thread Elazar Leibovich
Another idea from colleague, is to bind the source address of the socket to the address of the desired netwrokr interface. While it doesn't guarantee anything, he said that in practice the kernel routed the packets through the desired network interface. On Tue, Mar 4, 2014 at 10:02 AM, Erez D

Re: sending to same dest via different interfaces

2014-03-05 Thread Etzion Bar-Noy
Sorry. My default was not 'send to all'. Now posting to the list as well. On Wed, Mar 5, 2014 at 2:58 PM, Elazar Leibovich elaz...@gmail.com wrote: Another idea from colleague, is to bind the source address of the socket to the address of the desired netwrokr interface. While it doesn't

Re: sending to same dest via different interfaces

2014-03-05 Thread Etzion Bar-Noy
Eventually I will master the secret art of sending e-mail messages to the right persons, with the right content. A secret and holy art it is... Assuming you want the paths to be selected dynamically based on load, you can use iputils2 'ip route' to create a multi-homed routes. You will not have a

Re: sending to same dest via different interfaces

2014-03-04 Thread Erez D
On Tue, Mar 4, 2014 at 10:02 AM, Erez D erez0...@gmail.com wrote: Hello I have 2 external interfaces via two eth cards, both connected to the internet I want to send a udp packet to same host:port, but choose dynamically which interface to use. can this be done with linux, and how ? i

Re: sending to same dest via different interfaces

2014-03-04 Thread Dotan Shavit
raw socket might help. It will bypass routing, but it will also bypass the UDP stack... man 7 raw You may also try changing the routing rules: man route # On 04/03/14 10:02, Erez D wrote:

Re: sending to same dest via different interfaces

2014-03-04 Thread shimi
First Google result for raw sending packet linux might help: http://austinmarton.wordpress.com/2011/09/14/sending-raw-ethernet-packets-from-a-specific-interface-in-c-on-linux/ The other way is to do normal packets, and modify the kernel routing behavior in between (like with 'ip rule'...) - your

Re: sending to same dest via different interfaces

2014-03-04 Thread Elazar Leibovich
use the SO_BINDTODEVICE setsockopt. On Tue, Mar 4, 2014 at 10:02 AM, Erez D erez0...@gmail.com wrote: Hello I have 2 external interfaces via two eth cards, both connected to the internet I want to send a udp packet to same host:port, but choose dynamically which interface to use. can

Re: sending to same dest via different interfaces

2014-03-04 Thread Erez D
On Tue, Mar 4, 2014 at 11:05 AM, Elazar Leibovich elaz...@gmail.com wrote: use the SO_BINDTODEVICE setsockopt. requires me to be root ... On Tue, Mar 4, 2014 at 10:02 AM, Erez D erez0...@gmail.com wrote: Hello I have 2 external interfaces via two eth cards, both connected to the

Re: sending to same dest via different interfaces

2014-03-04 Thread Erez D
On Tue, Mar 4, 2014 at 10:20 AM, shimi linux...@shimi.net wrote: First Google result for raw sending packet linux might help: http://austinmarton.wordpress.com/2011/09/14/sending-raw-ethernet-packets-from-a-specific-interface-in-c-on-linux/ this is raw ethernet. i want to use the udp stack,

Re: sending to same dest via different interfaces

2014-03-04 Thread Elazar Leibovich
You can add capability of raw socket to the executable, hence run as non-root. Since what you're asking means potentially send illegal (unrouteable) IP packets, I guess that indeed the kernel will require special privileges to enable you to do that. As I said, you can mitigate that with

Re: sending to same dest via different interfaces

2014-03-04 Thread Shachar Shemesh
On 04/03/14 11:39, Elazar Leibovich wrote: You can add capability of raw socket to the executable, hence run as non-root. Since what you're asking means potentially send illegal (unrouteable) IP packets, I guess that indeed the kernel will require special privileges to enable you to do that.