Re: Generate traffic with only one machine - what's wrong with this routing?



Hello,

purplerain a écrit :
So basically I tried to set up
a routing which send out any packet generated on this host to an
external interface even if the IP address is assigned to interface
attached on this host.

You cannot do this with a standard kernel.

Here is my solution:
[...]
ip route del local 10.0.1.1 table local
ip route del local 10.0.1.11 table local
# add local delivery route for the packets coming from outside
# basically it's moving the routes deleted above from table local to
table main
ip route add local 10.0.1.1 dev eth1 proto kernel table main
ip route add local 10.0.1.11 dev eth2 proto kernel table main

AFAIK, local routes are valid only in the local table.

But it does't work:
---------------
clapham:~# ping 10.0.1.1
connect: Invalid argument
clapham:~# ping 10.0.1.11
connect: Invalid argument
[...]
the "connect: Invalid argument" message is somewhat disturbing. It
seems like an sytax error in the routing tables. But everything is
O.K. until I delete the routes in the local table.

My explanation : a local route in the local table is what really makes the destination local, what makes the routing subsystem recognize an address as its own. Removing the local route to 10.0.1.1 from the local table has the same effect on routing as removing 10.0.1.1 from eth1. 10.0.1.1 is used as a source address in the main table route to 10.0.1.11 but is not a local address (and the source address must be a local address), I guess this is what causes the error message.

I delete the one route in the local table:
------------
ip route del local 10.0.1.1 table local
-------------
pinging 10.0.1.1 is now partly successful:
-------------
clapham:~# ping 10.0.1.1
PING 10.0.1.1 (10.0.1.1) 56(84) bytes of data.
From 10.0.1.11 icmp_seq=1 Destination Host Unreachable
From 10.0.1.11 icmp_seq=2 Destination Host Unreachable
-----------
the packets are sent out on the other interface eth2 as the "From
10.0.1.11" tells - just as intended. Both interfaces are connected to
the same switch. But the packet is not recognized as local entering
eth1.

As I wrote, removing the local route to 10.0.1.1 from the local table makes the routing subsystem consider that the address is not local, and discard incoming packets destined to it.
.



Relevant Pages

  • Re: DECWindows SET/DISPLAY & CREATE/TERM/DETACH problem on Alphaserver DS10L
    ... So we have a default route. ... Maybe what is happening is that because of the way routing is setup the ... DHCP client failed to configure interface WE1 ... INTERnet ACP Created INTERnet interface: ...
    (comp.os.vms)
  • Re: Policy-based routing for packets originating from local machine (reinject packets back into
    ... have set up nat and balanced routing for machines ... work with packets originating from the router itself. ... rules don't work as it seems local packets don't have any 'in' interface ... ('tcpdump -ni ngeth0' on other terminal for great justice) ...
    (freebsd-net)
  • Re: Multiple external interfaces
    ... thanks for your fast response. ... >> routing table (unless you are routing to two different gateways, ... Are you NATing the outbound packets from the 10.x.x.x nets? ... > address of my second external interface, I don't know if this is possible. ...
    (comp.os.linux.networking)
  • Re: tun0 not responding to ping
    ... IP as the address of its public interface (192.168.0.2 in this ... This causes FreeBSD to have routing problems, ... default route. ... vpnc does seem to be establishing the VPN ...
    (freebsd-net)
  • Re: Multi-homing with win2k srv
    ... interface that connects to the Internet. ... I would install Network Monitor and capture packets on each external ... The destination does not match any specific route so it will be sent to your ...
    (microsoft.public.win2000.ras_routing)