Re: Socket connection between multiple interfaces, through a router
- From: "Nils O. Selåsdal" <noselasd@xxxxxxxxxxxxxxxxxxxxx>
- Date: 17 Jul 2006 05:59:35 +0200
seets375@xxxxxxxxx wrote:
Hi,
I have two ethernet interfaces on my system, with IPs assigned to the
interfaces from different subnets (e.g. eth1 - 10.10.10.10 and eth2 -
20.20.20.20 ). I'm connecting these interfaces to a home gateway or
router. The 'eth1' interface connects to LAN interface of the router
with IP address 10.10.10.1 and the 'eth2' interface connects to WAN
interface of the router with IP address 20.20.20.1.
I'm trying a simple socket program with C on Redhat Linux 9. I'm trying
to create a server socket (UDP or TCP) on my eth2 interface
(20.20.20.20), and a client socket (UDP or TCP) on my eth1 interface
(10.10.10.10). When I try to connect and send packets from eth1 to eth2
or vice-versa, the packets do not seem to pass through the router and
instead seem to create a local connection within the system. I verified
this with ethereal on both the interfaces eth1 and eth2). I wasn't
seeing any packets on these interfaces.
Just FYI, I was using AF_INET address family. I have routes
appropriately setup for the interfaces with 10.10.10.1 as the gateway
on the LAN side, and 20.20.20.1 as the gateway on the WAN side.
Why does the socket connection bypass the router? Is there a way to
ensure that my socket connection goes through the router, instead of
creating a local connection?
Your OS is smart, and sees the connection/packet(s) is to itself, thereby bypassing the media layer and possibly bypassing larger parts of
the IP stack too.
.
- References:
- Prev by Date: New Problem
- Next by Date: execlp question
- Previous by thread: Socket connection between multiple interfaces, through a router
- Next by thread: Re: Socket connection between multiple interfaces, through a router
- Index(es):
Relevant Pages
|
|