Routing from me to myself. Help.route problem

Routing from me to myself. Help.route problem

Post by Krzyc » Wed, 24 Mar 2004 10:40:54



Hello.

I have unusual problem. :)
I would like to send data from one alias of the same interface to
another.
Traffic should be "gatewayed" through another computer.
In case it was not clear.
Simplified example:
host A:
eth0:1 - 10.0.4.2
eth0:2 - 10.0.5.2
***something-i-can-not-work-out - check below***
route add 10.0.5.2 gw 10.0.4.1

host B:
eth0:1 - 10.0.4.1
eth0:2 - 10.0.5.1  
iptables -t filter -A FORWARD -s 10.0.4.2 -d 10.0.5.2

is there any way, that i could make host A to use table of routing
instead
his direct connection to his own interface? After clearing whole routing
table he is still able to ping his own address 10.0.5.2- i do not want
him
to do it. however, i want him to be "pingable" to another host.

I know it is unclear. I know it is crazy.
It is my idea to test implementation of ip routing protocols using only
two
computers. If this above would work, there would be no problem to build
whole bunch of hosts and links between them.

Thank you in advance.

 
 
 

Routing from me to myself. Help.route problem

Post by John-Paul Stewar » Wed, 24 Mar 2004 12:03:25



> Hello.

> I have unusual problem. :)
> I would like to send data from one alias of the same interface to
> another.
> Traffic should be "gatewayed" through another computer.
> In case it was not clear.
> Simplified example:
> host A:
> eth0:1 - 10.0.4.2
> eth0:2 - 10.0.5.2
> ***something-i-can-not-work-out - check below***
> route add 10.0.5.2 gw 10.0.4.1

> host B:
> eth0:1 - 10.0.4.1
> eth0:2 - 10.0.5.1  
> iptables -t filter -A FORWARD -s 10.0.4.2 -d 10.0.5.2

> is there any way, that i could make host A to use table of routing
> instead
> his direct connection to his own interface?

AFAIK, no.  Everything I've read on the subject indicates that packets
destined for a local IP never get to the routing tables and the rest of
the TCP/IP stack.

 
 
 

Routing from me to myself. Help.route problem

Post by P Gent » Thu, 25 Mar 2004 02:22:26


Keep your cross-posting (and top posting) to a minimum (none is
preferred if reasonable). Send your post where it will do the most
good and ask where to send if you are not sure.  I've trimmed them
back and now others may "lose" this thread but the others were not
appropriate anyway -- in fact, comp.os.linux.misc is not either but
sees lots of traffic where this may already have been seen.

Quote:> Hello.

> I have unusual problem. :)
> I would like to send data from one alias of the same interface to
> another.
> Traffic should be "gatewayed" through another computer.

Only happens when the hosts are on different subnets.  Local traffic
(on the same subnet) does not use a router.

Quote:> In case it was not clear.
> Simplified example:
> host A:
> eth0:1 - 10.0.4.2
> eth0:2 - 10.0.5.2
> ***something-i-can-not-work-out - check below***
> route add 10.0.5.2 gw 10.0.4.1

> host B:
> eth0:1 - 10.0.4.1
> eth0:2 - 10.0.5.1  
> iptables -t filter -A FORWARD -s 10.0.4.2 -d 10.0.5.2

This is not enough info in any setting, as routing needs to know the
netmask to understand if these two IPs are local (ie., on same subnet)
or on different subnets.

Quote:> is there any way, that i could make host A to use table of routing
> instead his direct connection to his own interface? After clearing whole routing
> table he is still able to ping his own address 10.0.5.2- i do not want
> him to do it. however, i want him to be "pingable" to another host.

> I know it is unclear. I know it is crazy.

Yes, it is unclear, but it doesn't sound crazy -- just may not be how
to achieve what you want.

Quote:> It is my idea to test implementation of ip routing protocols using only
> two computers. ...

With just two computers, you would need each one to have two nics.
-- Comp0-eth0-net0 <--> Comp1-eth0-net0
-- Comp0-eth1-net1 <--> Comp1-eth1-net1
Traffic will not be sent out on the same interface on which it was
received, thus the "routing" computer (Comp1) needs two nics.
Likewise, the "sending" computer needs two nics -- one on the
"sending" net and one on the "receiving" net.

Quote:> ... If this above would work, there would be no problem to build
> whole bunch of hosts and links between them.

> Thank you in advance.

This would be much easier to handle and understand with two _physical_
nics in each computer.  Aliases can be configured to act as a
"virtual" nic on a different net, but you would end up learning more
than you want or need to learn about the internal Linux routing
mechanisms than you would learn about IP routing over a network.

A "bunch" of hosts physically connected on the same subnet can
_already_ communicate with each other and don't need nor will they use
routing to do so.  Small, inexpensive 4 or 8 port switches make
connecting the machines a snap.   So, I'm not sure I understand what
you are trying to achieve.

Be sure to review the howto's about networking, bridging, and routing
if you need more complete background:
http://www.tldp.org/HOWTO/HOWTO-INDEX/howtos.html
Also:
http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/index.htm

There are many other good sources about networking on the web -- just
Google.

hth,
prg
email above disabled