From: "Salim S I" Date: Tue, 21 Aug 2007 03:44:59 +0000 Subject: RE: [LARTC] Policy base forwarding issues Message-Id: <000a01c7e3a5$aa283820$b9021d0a@SalimSi> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============1409874724==" List-Id: References: In-Reply-To: To: lartc@vger.kernel.org This is a multi-part message in MIME format. --===============1409874724== Content-Type: multipart/alternative; boundary="----=_NextPart_000_000B_01C7E3E8.B84B7820" This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C7E3E8.B84B7820 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Why don't you use DNAT ? The via address is supposed to be the address of nexthop router. -----Original Message----- From: lartc-bounces@mailman.ds9a.nl [mailto:lartc-bounces@mailman.ds9a.nl] On Behalf Of Pranav Desai Sent: Saturday, August 18, 2007 6:53 AM To: lartc Subject: [LARTC] Policy base forwarding issues Hello All, I am trying to setup a linux box as a forwarding router based of src IP. The problem is that it does forward the pkts to the intended server specified in the ip rule, but it also forwards it to the original dst (dst specified in the pkt). Here is the setup: [10.1.0.166] [192.168.1.225] | | | [A] [B] | |-------[10.1.0.63/172.16.1.63] ----------- [172.16.1.64/192.168.1.65] ---------| | linux box only has linux-router in question | | net.ipv4.ip_forward=1 | | | [10.1.0.167] [192.168.1.100] A - is just a linux box doing forwarding for the 2 networks 10.1.x.x - > 172.16.1.x. B - is the linux router which I want to setup as forwarding. The pkts come from 10.1.0.166 and .167 -> to 192.168.1.100 I want to setup rules on [B] to forward all pkts with src addr. 10.1.0.166 to 192.168.1.225. And, all pkts from 10.1.0.167 to 192.168.1.100 should still go to 192.168.1.100. Here are the rules I setup. [root@forwarder ~]# ip rule sh 0: from all lookup local 32765: from 10.1.0.166 lookup 225 32766: from all lookup main 32767: from all lookup default [root@forwarder ~]# ip ro sh tab 225 192.168.1.0/24 via 192.168.1.225 dev eth1 The pkts still go to both .225 and .100. I checked on another machine connected to the same switch as 192.168.1.100 and 192.168.1.225 and its not receiving the pkts. So, it doesnt seem like the switch is screwing up and broadcasting the packets everywhere. I would appreciate any kind of help or pointers. Thanks for your time. -- pranav ------------------------------ http://pd.dnsalias.org ------=_NextPart_000_000B_01C7E3E8.B84B7820 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Why don’t you use DNAT ?

The = via address is supposed to be the address of nexthop router.

 

-----Original Message-----
From: lartc-bounces@mailman.ds9a.nl [mailto:lartc-bounces@mailman.ds9a.nl] = On Behalf Of Pranav Desai
Sent: Saturday, August = 18, 2007 6:53 AM
To: lartc
Subject: [LARTC] Policy = base forwarding issues

 

Hello All,

I am trying to setup a linux box as a forwarding router based of src IP. = The problem is that it does forward the pkts to the intended server = specified in the ip rule, but it also forwards it to the original dst (dst specified = in the pkt).


Here is the setup:

[10.1.0.166]      =                        =                     &= nbsp;           &n= bsp;           &nb= sp;           [192.168.1.225]
         |                   =                       =                                   &= nbsp;           &n= bsp;           &nb= sp;   |
         |                [A]                    =               =             &= nbsp;     [B]           &nbs= p;            = ;  |
         |-------[10.1.0.63/172.16.1.63] = ----------- [172.16.1.64/192.168.1.65] = ---------|
         |       linux box only has           &nbs= p;          linux-router in = question           = ;   |
         |  =     net.ipv4.ip_forward=3D1             &= nbsp;                           &= nbsp;           &n= bsp;           |
         |            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =             &= nbsp;    |
[10.1.0.167]     &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =             &= nbsp;        [192.168.1.100]


A - is just a linux box doing forwarding for the 2 networks 10.1.x.x - = > 172.16.1.x.
B - is the linux router which I want to setup as forwarding.

The pkts come from 10.1.0.166 and = .167  ->  to 192.168.1.100
I want to setup rules on [B] to forward all pkts with src addr. 10.1.0.166 to 192.168.1.225.
And, all pkts from 10.1.0.167 to 192.168.1.100 should still go to 192.168.1.100.

Here are the rules I setup.

[root@forwarder ~]# ip rule sh
0:      from all lookup local
32765:  from 10.1.0.166 lookup = 225
32766:  from all lookup main
32767:  from all lookup default

[root@forwarder ~]# ip ro sh tab 225
192.168.1.0/24 via 192.168.1.225 dev eth1

The pkts still go to both .225 and .100. I checked on another machine = connected to the same switch as 192.168.1.100 = and 192.168.1.225 and its not receiving = the pkts. So, it doesnt seem like the switch is screwing up and broadcasting the = packets everywhere.

I would appreciate any kind of help or pointers.

Thanks for your time.

-- pranav

------------------------------
http://pd.dnsalias.org =

------=_NextPart_000_000B_01C7E3E8.B84B7820-- --===============1409874724== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============1409874724==--