Skip to contentSkip to conversation

simpler version, How to bypass the local routing table?

LARTC Antony Lesuisse 3 participants 3 messages Dec 12, 2003

lore
Share & tools
lore
#0 lore raw

imagine the folowing simpler configuration

Hub | Linux

 +----- eth0 192.168.1.1/24
 |   |
 +----- eth1 192.168.1.2/24
     |

I would like that the packets of ping -I eth0 192.168.1.2, go on wire via the eth0 interface to the hub, that the hub broadcast them to eth1, and the kernel receive them from eth1 and process it and the send the ICMP replies back to the wire via eth1, and eth0 and ping recieve it.

For that the kernel HAS to NOT recognize the dest ip (192.168.1.2) as local, when packets comes from processes, so that the packet will be sent over the interface even if there is an other interface eth2 configurated with the destination ip (192.168.1.2) on the same kernel.

So the problem is how to bypass the lookup in the table shown by:
ip route show table local

Or how to change the priority of the rule 0: shown by:
ip rule

One dirty solution might be altering the dest ip of outgoingpackets that comes from processes (OUTPUT ROUTING), using ip&(1<<8), to fool the kernel. Then having the HUB (i can program the hub) to remove that bit. (but that forbids using with that bit set).

References:

Guide to IP Layer Network Administration
http://linux-ip.net/

Kernel Packet Traveling Diagram
http://www.docum.org/stef.coene/qos/kptd/

Signature · 5 lines
Antony Lesuisse                       http://antony.lesuisse.com
GPG EA2CCD66: 4B7F 6061 3DF5 F07A ACFF  F127 6487 54F7 EA2C CD66
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#1 lore raw

From your previous example my understanding of the hub, was that it was
on a tapX interface in software on the same box, not another physical host on the ethernet segment.

I see, your immediate problem is the packets won't leave the host and don't appear appear on the wire, the only (proper) way around this is not to use the real IP of the other ethernet interface as the dest address during the ping. Instead create a fake IP to use.

Then perform address translation at the hub, which is neither of the 1.1 or 1.2 addresses itself, but say 1.3, that translates all packets going to the fake addresses in each direction, don't forget you have to translate both the src and dest addresses to each others fake address, replace fake with real and real with fake. The fake addresses would also best be in another 2 subnet of their own, call them 192.168.3.1/24 and 192.168.4.2/24.

I'd also recommend you don't overlap the subnets of eth0 and eth1 on the same box, make eth1 192.168.2.2/24 or something.

Mangling the IP on OUTPUT won't work, AFAIK, since it never gets into that routing path out of the kernel as its in the local table.

But your original request is improper from a network standpoint, each host has one IP stack, trying to split it in the middle is asking for trouble.

Quoted 10 lines · Antony Lesuisse

imagine the folowing simpler configuration

Hub | Linux

+----- eth0 192.168.1.1/24
|   |
+----- eth1 192.168.1.2/24
    |

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/