S
seets375
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?
I'd appreciate if any one could help me with the solution to my above
problem, either with explanation or through sample code.
Thanks,
Seets.
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?
I'd appreciate if any one could help me with the solution to my above
problem, either with explanation or through sample code.
Thanks,
Seets.