* Request: how do packet routing based on input gateway
@ 2009-10-24 13:22 Luca Dionisi
2009-10-24 14:19 ` Dunc
0 siblings, 1 reply; 3+ messages in thread
From: Luca Dionisi @ 2009-10-24 13:22 UTC (permalink / raw)
To: netdev, linux-net
Hi all
I must instruct my server to route packets based on destination prefix
and on the gateway from which the packet arrived.
E.g.
I am 192.168.0.1
a packet for 192.168.1.0/24 which arrived from gateway 192.168.0.2
must go through 192.168.1.1 dev eth0
a packet for 192.168.1.0/24 which arrived from gateway 192.168.0.3
must go through 192.168.1.2 dev eth1
a packet for 192.168.1.0/24 which arrived from any other gateway must
go through 192.168.1.3 dev eth2
The gateway I mean is just the last hop traversed, before me. It's not
necessarily the source of the packet.
How am I supposed to do that?
Regards.
Luca Dionisi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Request: how do packet routing based on input gateway
2009-10-24 13:22 Request: how do packet routing based on input gateway Luca Dionisi
@ 2009-10-24 14:19 ` Dunc
[not found] ` <73dbe2850910241013k7a83b07qed1f6f365e18c90e@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Dunc @ 2009-10-24 14:19 UTC (permalink / raw)
To: Luca Dionisi; +Cc: netdev, linux-net
If both of your last hops are on the same subnet you can't use incoming
interface, so the only thing I can think of is to match the MAC address
of the ethernet frame. If the last hop wasn't the source of the packet I
don't think there's anything else to uniquely identify it.
Cheers,
Dunc
Luca Dionisi wrote:
> Hi all
>
> I must instruct my server to route packets based on destination prefix
> and on the gateway from which the packet arrived.
> E.g.
> I am 192.168.0.1
> a packet for 192.168.1.0/24 which arrived from gateway 192.168.0.2
> must go through 192.168.1.1 dev eth0
> a packet for 192.168.1.0/24 which arrived from gateway 192.168.0.3
> must go through 192.168.1.2 dev eth1
> a packet for 192.168.1.0/24 which arrived from any other gateway must
> go through 192.168.1.3 dev eth2
>
> The gateway I mean is just the last hop traversed, before me. It's not
> necessarily the source of the packet.
>
> How am I supposed to do that?
>
> Regards.
> Luca Dionisi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-net" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Request: how do packet routing based on input gateway
[not found] ` <73dbe2850910241013k7a83b07qed1f6f365e18c90e@mail.gmail.com>
@ 2009-10-24 17:14 ` Luca Dionisi
0 siblings, 0 replies; 3+ messages in thread
From: Luca Dionisi @ 2009-10-24 17:14 UTC (permalink / raw)
To: netdev, linux-net
On Sat, Oct 24, 2009 at 4:19 PM, Dunc <dunc@lemonia.org> wrote:
> If both of your last hops are on the same subnet you can't use incoming
> interface, so the only thing I can think of is to match the MAC address
> of the ethernet frame. If the last hop wasn't the source of the packet I
> don't think there's anything else to uniquely identify it.
There is another reason why I can't use the input interface. It's
because 2 or more gateways of mine could be accessible by the same
interface. I have to distinguish the route on the base of the last
hop, not on the base of the interface.
If I get it right, the kernel is aware of what the MAC address of the
previous hop was, but it is not aware of its IP address.
This is surprising to me. I mean, I can understand that this
information is not in the headings of the packet, but nevertheless I
thought the kernel was able to remember the gateway it came from.
If this is the situation I have to live in, then what are the commands
I must give to instruct the kernel?
Suppose I want a packet for 192.168.1.0/24 to be forwarded to
192.168.2.1 if the packet was sent to me by MAC 00:22:44:99:66:77.
Thanks alot
--Luca Dionisi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-24 17:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-24 13:22 Request: how do packet routing based on input gateway Luca Dionisi
2009-10-24 14:19 ` Dunc
[not found] ` <73dbe2850910241013k7a83b07qed1f6f365e18c90e@mail.gmail.com>
2009-10-24 17:14 ` Luca Dionisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).