Re: Pretending to be a network node
- From: Barry Margolin <barmar@xxxxxxxxxxxx>
- Date: Fri, 08 Jun 2007 23:21:00 -0400
In article <20070608053423.51720c87.rafaelc@xxxxxxxxxxx>,
Rafael Almeida <rafaelc@xxxxxxxxxxx> wrote:
On Thu, 07 Jun 2007 21:37:00 -0400
Barry Margolin <barmar@xxxxxxxxxxxx> wrote:
In article <20070607220537.8e7e5559.rafaelc@xxxxxxxxxxx>,
Rafael Almeida <rafaelc@xxxxxxxxxxx> wrote:
Hello,
I have a program P that connects on eth0, it sends and receives packets
from the network on that interface. I want to make another program that
pretends to be on the eth0 network, but it's actually on the same
machine as P. Is there a way to do that?
I was thinking maybe there's a way of creating a new interface, say
eth1, and somehow connect it to eth0 in a way that eth0 thinks it's
getting messages from the network, when in fact it's getting messages
from another interface in the same computer. That way I'd be able to
listen to the same udp port on both interfaces and stabilish a two-way
connection between two programs, one connected to eth0 and another
connected to eth1.
I'm using Debian Linux, so system-specific solutions are ok. I'm
interested in knowing solutions for this problem that will work in other
unix systems as well (or even non-unix systems).
You can create virtual interfaces eth0:1, eth0:2, etc. and give them
different IPs. You need to ensure that the program allows you to tell
it which IP to bind to.
I didn't know about virtual interfaces, they're indeed neat. Is there
any work around in the case I can't set which address the program is to
bind? It's propertary software, so I can't really change it, I can only
change the client I'm doing for communicating with the propertary
software.
I thought you were trying to run two copies of the same program, and get
them to communicate with each other.
Why does the client need to use the same source port as the server?
Normally clients let the OS select an unused port, by calling bind()
with the port set to 0. They send from this port to the well-known port
of the server, and the server sends back to this dynamically-generated
port.
--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.
- References:
- Pretending to be a network node
- From: Rafael Almeida
- Re: Pretending to be a network node
- From: Barry Margolin
- Re: Pretending to be a network node
- From: Rafael Almeida
- Pretending to be a network node
- Prev by Date: Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- Next by Date: Re: new user cannot access UNIX share
- Previous by thread: Re: Pretending to be a network node
- Next by thread: Re: Pretending to be a network node
- Index(es):
Relevant Pages
|
|