All of lore.kernel.org
 help / color / mirror / Atom feed
* DNAT for two external NIC
@ 2006-08-29 21:42 Mikhail
  2006-08-29 22:00 ` Pascal Hambourg
  2006-08-30  7:15 ` Florent Guiliani
  0 siblings, 2 replies; 8+ messages in thread
From: Mikhail @ 2006-08-29 21:42 UTC (permalink / raw)
  To: netfilter

  I have Linux gateway/firewall with 3 NIC: eth0 – LAN, eth1 – ISP1, eth2 –
ISP2.
I’ve got separate static IPs from each of the ISP (IP1 & IP2) which I
statically assigned to eth1 and eth2.
My default route points to ISP1 gateway via eth1. I need to provide external
access to a few computers on the LAN using different IPs and port numbers
(no load balancing and target machines are IP-specific). 
  Everything works fine if I use IP1 address but I was unable to get to the
corresponding LAN machine through IP2. Ping requests are also not responded
if they’re made to IP2. They do reach eth2 and I can see them using tcpdump
but then nothing goes out on any NIC. The same goes for TCP/IP requests –
I’ve managed to trace them to the nat table PREROUTING chain but they could
not be found in either INPUT or FORWARD chain of the mangle table. If I make
default route through eth2 – everything starts working through that NIC and
stops through eth1. I seem to be missing something simple. Any help is
greatly appreciated.

Mikhail.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DNAT for two external NIC
  2006-08-29 21:42 DNAT for two external NIC Mikhail
@ 2006-08-29 22:00 ` Pascal Hambourg
  2006-08-30  7:15 ` Florent Guiliani
  1 sibling, 0 replies; 8+ messages in thread
From: Pascal Hambourg @ 2006-08-29 22:00 UTC (permalink / raw)
  To: netfilter

Hello,

Mikhail a écrit :
>   Everything works fine if I use IP1 address but I was unable to get to the
> corresponding LAN machine through IP2. Ping requests are also not responded
> if they're made to IP2. They do reach eth2 and I can see them using tcpdump
> but then nothing goes out on any NIC. The same goes for TCP/IP requests -
> I've managed to trace them to the nat table PREROUTING chain but they could
> not be found in either INPUT or FORWARD chain of the mangle table. If I make
> default route through eth2 - everything starts working through that NIC and
> stops through eth1.

Maybe you need to disable rp_filter (reverse path filtering) on the 
interface that has not the default route.

sysctl -w net/ipv4/conf/eth2/rp_filter=0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DNAT for two external NIC
  2006-08-29 21:42 DNAT for two external NIC Mikhail
  2006-08-29 22:00 ` Pascal Hambourg
@ 2006-08-30  7:15 ` Florent Guiliani
  1 sibling, 0 replies; 8+ messages in thread
From: Florent Guiliani @ 2006-08-30  7:15 UTC (permalink / raw)
  To: netfilter

$> echo "2 ISP2" >> /etc/iproute2/rt_tables
$> ip route add default via gatewayISP2 dev devISP2 table ISP2
$> ip rule  add from IPISP2 lookup ISP2 prio 1000
$> ip route flush table cache

so ping will be ok on the ISP2, you will able to connect any services on 
your router throuht ISP2 but DNAT will only work with ISP1. I'm working 
on this problem. I think I will use Shorewall to so that automatically

Mikhail a écrit :
>   I have Linux gateway/firewall with 3 NIC: eth0 – LAN, eth1 – ISP1, eth2 –
> ISP2.
> I’ve got separate static IPs from each of the ISP (IP1 & IP2) which I
> statically assigned to eth1 and eth2.
> My default route points to ISP1 gateway via eth1. I need to provide external
> access to a few computers on the LAN using different IPs and port numbers
> (no load balancing and target machines are IP-specific). 
>   Everything works fine if I use IP1 address but I was unable to get to the
> corresponding LAN machine through IP2. Ping requests are also not responded
> if they’re made to IP2. They do reach eth2 and I can see them using tcpdump
> but then nothing goes out on any NIC. The same goes for TCP/IP requests –
> I’ve managed to trace them to the nat table PREROUTING chain but they could
> not be found in either INPUT or FORWARD chain of the mangle table. If I make
> default route through eth2 – everything starts working through that NIC and
> stops through eth1. I seem to be missing something simple. Any help is
> greatly appreciated.
> 
> Mikhail.
> 
> 
> 

-- 
     	*  Florent GUILIANI - Développement Système*
41, avenue Jean Jaurès - 67100 STRASBOURG
/Tel :/ 03.88.44.96.00 /- Fax :/ 03.88.44.96.29
/E-mail :/ fguiliani@perinfo.com <mailto:fguiliani@perinfo.com>
/Site Web :/ http://www.perinfo.com



^ permalink raw reply	[flat|nested] 8+ messages in thread

* DNAT for two external NIC
@ 2006-09-01  1:01 Mikhail
  0 siblings, 0 replies; 8+ messages in thread
From: Mikhail @ 2006-09-01  1:01 UTC (permalink / raw)
  To: netfilter

Pascal Hambourg wrote:
>Maybe you need to disable rp_filter (reverse path filtering) on the 
>interface that has not the default route.

>sysctl -w net/ipv4/conf/eth2/rp_filter=0

You're absolutely right; it requires that non- default interface had it set
to 0 if I want to do source-based routing. It is working like a charm now,
thank you.

Mikhail.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* DNAT for two external NIC
@ 2006-09-01  6:32 Ming-Ching Tiew
  2006-09-01  8:35 ` longraider
  0 siblings, 1 reply; 8+ messages in thread
From: Ming-Ching Tiew @ 2006-09-01  6:32 UTC (permalink / raw)
  To: netfilter

Pascal Hambourg wrote :-

>Hello,
>
>Mikhail a écrit :
>>   Everything works fine if I use IP1 address but I was unable to get to the
>> corresponding LAN machine through IP2. Ping requests are also not responded
>> if they're made to IP2. They do reach eth2 and I can see them using tcpdump
>> but then nothing goes out on any NIC. The same goes for TCP/IP requests -
>> I've managed to trace them to the nat table PREROUTING chain but they could
>> not be found in either INPUT or FORWARD chain of the mangle table. If I make
> default route through eth2 - >everything starts working through that NIC and
>> stops through eth1.
>
>Maybe you need to disable rp_filter (reverse path filtering) on the
>interface that has not the default route.
>
>sysctl -w net/ipv4/conf/eth2/rp_filter=0

Isn't this a bug in rp_filter ? In multipath routing, it's often the system
will have multiple routing tables. The rp_filter seems to only look at
the main routing table.

Regards.






^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DNAT for two external NIC
  2006-09-01  6:32 Ming-Ching Tiew
@ 2006-09-01  8:35 ` longraider
  2006-09-01  9:32   ` Ming-Ching Tiew
  0 siblings, 1 reply; 8+ messages in thread
From: longraider @ 2006-09-01  8:35 UTC (permalink / raw)
  To: netfilter

Ming-Ching Tiew wrote:

>>Maybe you need to disable rp_filter (reverse path filtering) on the
>>interface that has not the default route.
>>
>>sysctl -w net/ipv4/conf/eth2/rp_filter=0
> 
> Isn't this a bug in rp_filter ? In multipath routing, it's often the system
> will have multiple routing tables. The rp_filter seems to only look at
> the main routing table.
> 

It looks at different tables (according to ip rule). I've recently
posted a problem with the same solution. The problem was with the fwmark
in the ip rules.

http://lists.netfilter.org/pipermail/netfilter/2006-August/066553.html

-- 
mati




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DNAT for two external NIC
  2006-09-01  8:35 ` longraider
@ 2006-09-01  9:32   ` Ming-Ching Tiew
  0 siblings, 0 replies; 8+ messages in thread
From: Ming-Ching Tiew @ 2006-09-01  9:32 UTC (permalink / raw)
  To: netfilter


From: "longraider" <longraider@gazeta.pl>

> Ming-Ching Tiew wrote:
> 
> >>Maybe you need to disable rp_filter (reverse path filtering) on the
> >>interface that has not the default route.
> >>
> >>sysctl -w net/ipv4/conf/eth2/rp_filter=0
> > 
> > Isn't this a bug in rp_filter ? In multipath routing, it's often the system
> > will have multiple routing tables. The rp_filter seems to only look at
> > the main routing table.
> > 
> 
> It looks at different tables (according to ip rule). I've recently
> posted a problem with the same solution. The problem was with the fwmark
> in the ip rules.
> 
> http://lists.netfilter.org/pipermail/netfilter/2006-August/066553.html
> 

I did not go through your post carefully enough to know what you are talking
about. But my question was why do we have to turn off reverse filter path
checking to get multipath routing to work ? The original idea of reverse
filter path checking is to improve security by doing reverse path checking,
ie by checking the source IP address of all packets coming in via an interface 
against the networks known to be behind that interface, the firewall/router 
can simply drop packets that aren't supposed to come from there. In the
multipath routing case, the packets are INDEED supposed to be from the
interface where it is coming from, why they are dropped ?

Regards.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DNAT for two external NIC
@ 2006-09-05  2:29 Ming-Ching Tiew
  0 siblings, 0 replies; 8+ messages in thread
From: Ming-Ching Tiew @ 2006-09-05  2:29 UTC (permalink / raw)
  To: netfilter


From: "Ming-Ching Tiew" <mingching.tiew@redtone.com>
> 
> I did not go through your post carefully enough to know what you are talking
> about. But my question was why do we have to turn off reverse filter path
> checking to get multipath routing to work ? The original idea of reverse
> filter path checking is to improve security by doing reverse path checking,
> ie by checking the source IP address of all packets coming in via an interface 
> against the networks known to be behind that interface, the firewall/router 
> can simply drop packets that aren't supposed to come from there. In the
> multipath routing case, the packets are INDEED supposed to be from the
> interface where it is coming from, why they are dropped ?
> 

Perhaps this is what this patch is all about ?

                     http://www.ssi.bg/~ja/#rp_filter_mask

I have noticed that Julian Anastasov's patch has existed long long time ago
but it is never included into the standard kernel. I really wonder why. 

Cheers.






^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-09-05  2:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-29 21:42 DNAT for two external NIC Mikhail
2006-08-29 22:00 ` Pascal Hambourg
2006-08-30  7:15 ` Florent Guiliani
  -- strict thread matches above, loose matches on Subject: below --
2006-09-01  1:01 Mikhail
2006-09-01  6:32 Ming-Ching Tiew
2006-09-01  8:35 ` longraider
2006-09-01  9:32   ` Ming-Ching Tiew
2006-09-05  2:29 Ming-Ching Tiew

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.