Re: Socket connection between multiple interfaces, through a router



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.

.



Relevant Pages

  • Re: Site-to-Site VPN client routing question - clients at branch office not able to acce
    ... You can check this by making sure that the dd interface on the answering router has changed to connected status. ... Your DC might only have one NIC, but as soon as your VPN connection is made it has two IP addresses, so you get all sorts of problems. ... select the demand-dial interface from the dropdown list. ...
    (microsoft.public.windows.server.networking)
  • Re: Connection stalls until I do ping/traceroute in router
    ... If it was not unique, and another host shared that address, the ARP table on your system would map the gateway's IP address to the MAC address of the gateway "some of the time", and map it to the MAC address of the host sharing the IP address at "other times". ... If you connected the LAN interface of your gateway router to the LAN interface of another device which used the same default IP address for its admin interface, ... between your ISP and their connection to the interknot. ...
    (alt.internet.wireless)
  • [Full-Disclosure] FW: Cisco Vulnerability forensic protocol analysis results.
    ... AMILABS CISCO IP PROTOCOL EXPLOIT TESTING RESULTS ... Cisco router interfaces using either all or one of the following IP ... of a remote Cisco interface uses all of them. ... output buffer failures, 0 output buffers swapped out Router4# ...
    (Full-Disclosure)
  • Re: Windows 2000 RAS Server and a Cisco Client Router
    ... You need to use the method which a router to router connection uses. ... This involves setting up a demand-dial interface on the server. ... dropdown list as the interface to link with the route. ...
    (microsoft.public.win2000.ras_routing)
  • Re: routing problem site to site
    ... a nat interface is enabled, site 2 is just a dmz behind a router. ... are both dd interfaces bound to the connection ... are the static routes added to the ...
    (microsoft.public.windows.server.networking)