PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Noms de domaine > comp.protocols.tcp-ip > one subnet, different IPs
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.protocols.tcp-ip TCP and IP network protocols.

one subnet, different IPs

Réponse
 
LinkBack Outils de la discussion
Vieux 26/09/2007, 13h49   #1
Vega
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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.

  Réponse avec citation
Vieux 26/09/2007, 16h05   #2
Pascal Hambourg
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
  Réponse avec citation
Vieux 26/09/2007, 20h51   #3
Moe Trin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 .

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

Old guy
  Réponse avec citation
Vieux 27/09/2007, 00h29   #4
Rick Jones
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: one subnet, different IPs

Moe Trin <ibuprofin@painkiller.example.tld> 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...
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h22.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 1,66290 seconds with 12 queries