views:

138

answers:

1

Hello

I have a comp with 2 eth cards, connected with patch-cord (direct eth. cable from 1st to 2nd).

The linux is installed, I want to send data from 1st network card to 2nd. And I want to force the packet to pass via cable. I can set up any ip on cards.

With ping I get counters on cards constant.

Is it possible with tcp/ip sockets?

PS. I need to write a program. which will send packets via eth, so stackoverflow-related question. There can be some OS-dependent way, they will help me too

A: 

You should be able to write a program that does that using packet sockets (protocol family PF_PACKET), but you'll have to handle the headers for the IP and higher layers yourself.

caf
So I can't force TCP or IP packets do not be loopbacked?
osgx
I don't believe so, but you could try adding a host route for each IP through the opposite interface.
caf