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.
> I have unusual problem. :)
> I would like to send data from one alias of the same interface to
> 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.
> 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.
> 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.
> ... 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:
There are many other good sources about networking on the web -- just
email above disabled