one subnet, different IPs - TCP-IP

This is a discussion on one subnet, different IPs - TCP-IP ; Hi, All! I have two Ethernet Cards at my computer with the same subnet but different IPs something like: eth0: 192.168.0.125 eth1: 192.168.0.126 (net 192.168.0.0 mask 255.255.255.0) OS: linux Assume I have another host with IP address 192.168.0.127. How can ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: one subnet, different IPs

  1. one subnet, different IPs

    Hi, All!

    I have two Ethernet Cards at my computer with the same subnet but
    different IPs
    something like:

    eth0: 192.168.0.125
    eth1: 192.168.0.126
    (net 192.168.0.0 mask 255.255.255.0)
    OS: linux

    Assume I have another host with IP address 192.168.0.127.

    How can I send from my program udp packets to 192.168.0.127 exactly
    via eth1 interface?
    May be it's not possible because than progam call sendto(...) function
    OS uses first
    appropriate interface - eth0?

    Pls don't talk about different subnet for eth0, eth1!

    Best Regards!
    thx!
    Arkadi K.


  2. Re: one subnet, different IPs

    Hello,

    Vega a écrit :
    >
    > How can I send from my program udp packets to 192.168.0.127 exactly
    > via eth1 interface?


    What about adding a host route ?
    # route add 192.168.0.127 dev eth1

  3. Re: one subnet, different IPs

    On Wed, 26 Sep 2007, in the Usenet newsgroup comp.protocols.tcp-ip, in article
    <1190810962.142246.256310@d55g2000hsg.googlegroups. com>, Vega wrote:

    >I have two Ethernet Cards at my computer with the same subnet but
    >different IPs
    >something like:
    >
    >eth0: 192.168.0.125
    >eth1: 192.168.0.126
    >(net 192.168.0.0 mask 255.255.255.0)


    Is this one network, with two cards connected to the "same" wire, or
    is this really two isolated segments.

    >How can I send from my program udp packets to 192.168.0.127 exactly
    >via eth1 interface?


    Set the routing correctly. Either:

    1. Correct the network layout - two _different_ address ranges
    2. Use a 'host' route ('/sbin/route -add host 192.168.0.127 eth1')
    3. Use iproute2 and traffic control (see Adv-Routing-HOWTO).

    >May be it's not possible because than progam call sendto(...) function
    >OS uses first appropriate interface - eth0?


    Your program uses the kernel routing functions. The kernel normally
    assumes that when you create two routing entries to the same destination
    with the same metric, that you "changed your mind" and really want to
    use the last one declared. If you look at the routing table output
    (/sbin/route -n), this shows up as the first route _listed_

    >Pls don't talk about different subnet for eth0, eth1!


    What "problem" are you trying to solve by using two network cards with
    the same network setup? Perhaps the HOWTOs will help.

    -rw-rw-r-- 1 gferg ldp 297491 Sep 4 2003 Adv-Routing-HOWTO

    Old guy

  4. Re: one subnet, different IPs

    Moe Trin wrote:
    > On Wed, 26 Sep 2007, in the Usenet newsgroup comp.protocols.tcp-ip, in article
    > <1190810962.142246.256310@d55g2000hsg.googlegroups. com>, Vega wrote:


    > >I have two Ethernet Cards at my computer with the same subnet but
    > >different IPs
    > >something like:
    > >
    > >eth0: 192.168.0.125
    > >eth1: 192.168.0.126
    > >(net 192.168.0.0 mask 255.255.255.0)


    > Is this one network, with two cards connected to the "same" wire, or
    > is this really two isolated segments.


    In other words, does your setup look like:

    rest of 192.168.0 <->your box .125 .126 <-> 192.168.0.127

    If so, you might also consider enabling bridging, put both eth0 and
    eth1 into the bridge, assign it an ip of .125 and/or .126 and let the
    bridging code figure-out which interface to send stuff, with the added
    benefit that your .127 host will be able to reach the rest of
    192.168.0 without any additional routing setup.

    rick jones
    --
    firebug n, the idiot who tosses a lit cigarette out his car window
    these opinions are mine, all mine; HP might not want them anyway...
    feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

+ Reply to Thread